Back out 027b0144a1a6 (bug 1239459) for failures in responsive.html/test/browser/browser_menu_item_02.js

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2016-05-10 21:01:28 -07:00
Родитель 3bf0a9dfae
Коммит cfa9b03a03
18 изменённых файлов: 10 добавлений и 197 удалений

Просмотреть файл

@ -44,9 +44,6 @@ createEnum([
// Update the device modal open state.
"UPDATE_DEVICE_MODAL_OPEN",
// Update the touch simulation enabled state.
"UPDATE_TOUCH_SIMULATION_ENABLED",
], module.exports);
/**

Просмотреть файл

@ -9,6 +9,5 @@ DevToolsModules(
'index.js',
'location.js',
'screenshot.js',
'touch-simulation.js',
'viewports.js',
)

Просмотреть файл

@ -1,22 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env browser */
"use strict";
const {
UPDATE_TOUCH_SIMULATION_ENABLED
} = require("./index");
module.exports = {
updateTouchSimulationEnabled(enabled) {
return {
type: UPDATE_TOUCH_SIMULATION_ENABLED,
enabled,
};
},
};

Просмотреть файл

@ -20,7 +20,6 @@ const {
rotateViewport
} = require("./actions/viewports");
const { takeScreenshot } = require("./actions/screenshot");
const { updateTouchSimulationEnabled } = require("./actions/touch-simulation");
const DeviceModal = createFactory(require("./components/device-modal"));
const GlobalToolbar = createFactory(require("./components/global-toolbar"));
const Viewports = createFactory(require("./components/viewports"));
@ -31,9 +30,8 @@ let App = createClass({
propTypes: {
devices: PropTypes.shape(Types.devices).isRequired,
location: Types.location.isRequired,
screenshot: PropTypes.shape(Types.screenshot).isRequired,
touchSimulation: PropTypes.shape(Types.touchSimulation).isRequired,
viewports: PropTypes.arrayOf(PropTypes.shape(Types.viewport)).isRequired,
screenshot: PropTypes.shape(Types.screenshot).isRequired,
},
displayName: "App",
@ -82,23 +80,11 @@ let App = createClass({
this.props.dispatch(updateDeviceModalOpen(isOpen));
},
onUpdateTouchSimulationEnabled() {
let { enabled } = this.props.touchSimulation;
window.postMessage({
type: "update-touch-simulation",
enabled,
}, "*");
this.props.dispatch(updateTouchSimulationEnabled(!enabled));
},
render() {
let {
devices,
location,
screenshot,
touchSimulation,
viewports,
} = this.props;
@ -113,7 +99,6 @@ let App = createClass({
onScreenshot,
onUpdateDeviceDisplayed,
onUpdateDeviceModalOpen,
onUpdateTouchSimulationEnabled,
} = this;
return dom.div(
@ -122,10 +107,8 @@ let App = createClass({
},
GlobalToolbar({
screenshot,
touchSimulation,
onExit,
onScreenshot,
onUpdateTouchSimulationEnabled,
}),
Viewports({
devices,

Просмотреть файл

@ -11,11 +11,9 @@ const Types = require("../types");
module.exports = createClass({
propTypes: {
screenshot: PropTypes.shape(Types.screenshot).isRequired,
touchSimulation: PropTypes.shape(Types.touchSimulation).isRequired,
onExit: PropTypes.func.isRequired,
onScreenshot: PropTypes.func.isRequired,
onUpdateTouchSimulationEnabled: PropTypes.func.isRequired,
screenshot: PropTypes.shape(Types.screenshot).isRequired,
},
displayName: "GlobalToolbar",
@ -24,18 +22,11 @@ module.exports = createClass({
render() {
let {
screenshot,
touchSimulation,
onExit,
onScreenshot,
onUpdateTouchSimulationEnabled
screenshot,
} = this.props;
let touchButtonClass = "toolbar-button devtools-button";
if (touchSimulation.enabled) {
touchButtonClass += " active";
}
return dom.header(
{
id: "global-toolbar",
@ -46,11 +37,6 @@ module.exports = createClass({
className: "title",
},
getStr("responsive.title")),
dom.button({
id: "global-touch-simulation-button",
className: touchButtonClass,
onClick: onUpdateTouchSimulationEnabled,
}),
dom.button({
id: "global-screenshot-button",
className: "toolbar-button devtools-button",

Просмотреть файл

@ -10,5 +10,4 @@ DevToolsModules(
'rotate-viewport.svg',
'screenshot.svg',
'select-arrow.svg',
'touch-events.svg',
)

Просмотреть файл

@ -1,9 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<style type="text/css">
.st0{fill:#F5F5F5;}
</style>
<path class="st0" d="M12.5 5.3c-.2 0-.4 0-.6.1-.2-.6-.8-1-1.4-1-.3 0-.5.1-.8.2C9.4 4.2 9 4 8.6 4h-.4V1.5C8.2.7 7.5 0 6.7 0S5.2.7 5.2 1.5v6.6l-.7-.6c-.6-.6-1.6-.6-2.2 0-.5.6-.5 1.4-.1 2.1.3.4.6 1.1 1 1.8C4.2 13.6 5.3 16 7 16h3.9s3.1-1 3.1-4V6.7c.1-.8-.7-1.4-1.5-1.4zm.6 6.7c0 2-2.1 3-2.4 3H7c-1 0-2.1-2.4-2.9-4-.3-.8-.7-1.6-1-2-.2-.3-.2-.5-.1-.7.1-.1.2-.1.3-.1.1 0 .2 0 .3.1l1.5 1.5c.3.2.6.2.7.1.1 0 .4-.2.4-.5V1.5c0-.2.2-.4.5-.4s.5.2.5.4v5.3c0 .3.2.5.5.5s.5-.2.5-.5V5.5c0-.4.2-.5.5-.5.2 0 .5.2.5.4v2c-.1.3.2.6.4.6.3 0 .5-.2.5-.5V5.8c0-.2.2-.4.5-.4s.5.2.5.4v2.3c0 .3.2.5.5.5s.5-.2.5-.5V6.7c0-.2.2-.4.5-.4s.5.2.5.4V12z"/>
</svg>

До

Ширина:  |  Высота:  |  Размер: 963 B

Просмотреть файл

@ -100,15 +100,6 @@ html, body {
height: 12px;
}
#global-touch-simulation-button::before {
background-image: url("./images/touch-events.svg");
margin: -6px 0 0 -6px;
}
#global-touch-simulation-button.active::before {
filter: url("chrome://devtools/skin/images/filters.svg#checked-icon-state");
}
#global-screenshot-button::before {
background-image: url("./images/screenshot.svg");
margin: -6px 0 0 -6px;

Просмотреть файл

@ -9,7 +9,6 @@ const promise = require("promise");
const { Task } = require("resource://gre/modules/Task.jsm");
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
const EventEmitter = require("devtools/shared/event-emitter");
const { TouchEventSimulator } = require("devtools/shared/touch/simulator");
const { getOwnerWindow } = require("sdk/tabs/utils");
const { on, off } = require("sdk/event/core");
const { startup } = require("sdk/window/helpers");
@ -198,11 +197,6 @@ ResponsiveUI.prototype = {
*/
toolWindow: null,
/**
* Touch event simulator.
*/
touchEventSimulator: null,
/**
* For the moment, we open the tool by:
* 1. Recording the tab's URL
@ -226,23 +220,15 @@ ResponsiveUI.prototype = {
yield waitForMessage(toolWindow, "init");
toolWindow.addInitialViewport(contentURI);
yield waitForMessage(toolWindow, "browser-mounted");
let browser = toolWindow.document.querySelector("iframe.browser");
this.touchEventSimulator = new TouchEventSimulator(browser);
}),
destroy: Task.async(function* () {
let tabBrowser = this.tab.linkedBrowser;
let browserWindow = this.browserWindow;
this.browserWindow = null;
this.tab = null;
this.inited = null;
this.toolWindow = null;
yield this.touchEventSimulator.stop();
this.touchEventSimulator = null;
let loaded = waitForDocLoadComplete(browserWindow.gBrowser);
tabBrowser.goBack();
yield loaded;
@ -268,21 +254,9 @@ ResponsiveUI.prototype = {
toolWindow.removeEventListener(event.type, this);
ResponsiveUIManager.closeIfNeeded(window, tab);
break;
case "update-touch-simulation":
let { enabled } = event.data;
this.updateTouchSimulation(enabled);
break;
}
},
updateTouchSimulation: Task.async(function* (enabled) {
if (enabled) {
this.touchEventSimulator.start();
} else {
this.touchEventSimulator.stop();
}
}),
getViewportSize() {
return this.toolWindow.getViewportSize();
},

Просмотреть файл

@ -7,5 +7,4 @@
exports.devices = require("./reducers/devices");
exports.location = require("./reducers/location");
exports.screenshot = require("./reducers/screenshot");
exports.touchSimulation = require("./reducers/touch-simulation");
exports.viewports = require("./reducers/viewports");

Просмотреть файл

@ -8,6 +8,5 @@ DevToolsModules(
'devices.js',
'location.js',
'screenshot.js',
'touch-simulation.js',
'viewports.js',
)

Просмотреть файл

@ -1,29 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {
UPDATE_TOUCH_SIMULATION_ENABLED,
} = require("../actions/index");
const INITIAL_TOUCH_SIMULATION = { enabled: false };
let reducers = {
[UPDATE_TOUCH_SIMULATION_ENABLED](touchSimulation, { enabled }) {
return Object.assign({}, touchSimulation, {
enabled,
});
},
};
module.exports = function (touchSimulation = INITIAL_TOUCH_SIMULATION, action) {
let reducer = reducers[action.type];
if (!reducer) {
return touchSimulation;
}
return reducer(touchSimulation, action);
};

Просмотреть файл

@ -19,5 +19,4 @@ skip-if = (e10s && debug) # Bug 1267278: browser.xul leaks
[browser_mouse_resize.js]
[browser_resize_cmd.js]
[browser_screenshot_button.js]
[browser_touch_simulation.js]
[browser_viewport_basics.js]

Просмотреть файл

@ -1,25 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test global touch simulation button
const TEST_URL = "data:text/html;charset=utf-8,";
addRDMTask(TEST_URL, function* ({ ui }) {
let { store, document } = ui.toolWindow;
let touchButton = document.querySelector("#global-touch-simulation-button");
// Wait until the viewport has been added
yield waitUntilState(store, state => state.viewports.length == 1);
yield waitForFrameLoad(ui, TEST_URL);
ok(!touchButton.classList.contains("active"),
"Touch simulation is not active by default.");
touchButton.click();
ok(touchButton.classList.contains("active"),
"Touch simulation is started on click.");
});

Просмотреть файл

@ -1,23 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test updating the touch simulation `enabled` property
const {
updateTouchSimulationEnabled,
} = require("devtools/client/responsive.html/actions/touch-simulation");
add_task(function* () {
let store = Store();
const { getState, dispatch } = store;
ok(!getState().touchSimulation.enabled,
"Touch simulation is disabled by default.");
dispatch(updateTouchSimulationEnabled(true));
ok(getState().touchSimulation.enabled,
"Touch simulation is enabled.");
});

Просмотреть файл

@ -12,4 +12,3 @@ firefox-appdir = browser
[test_resize_viewport.js]
[test_rotate_viewport.js]
[test_update_device_displayed.js]
[test_update_touch_simulation_enabled.js]

Просмотреть файл

@ -85,16 +85,6 @@ exports.screenshot = {
};
/**
* Touch simulation.
*/
exports.touchSimulation = {
// Whether or not the touch simulation is enabled
enabled: PropTypes.bool.isRequired,
};
/**
* A single viewport displaying a document.
*/

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var { Ci } = require("chrome");
var promise = require("promise");
var Services = require("Services");
@ -24,7 +25,12 @@ function TouchEventSimulator(browser) {
return simulator;
}
let mm = browser.frameLoader.messageManager;
let mm = browser.messageManager;
if (!mm) {
// Maybe browser is an iframe
mm = browser.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader.messageManager;
}
mm.loadFrameScript(FRAME_SCRIPT, true);
simulator = {