diff --git a/.eslintignore b/.eslintignore index 8b073acb0f..3f4a462199 100644 --- a/.eslintignore +++ b/.eslintignore @@ -94,7 +94,6 @@ devtools/client/framework/** devtools/client/inspector/computed/** devtools/client/inspector/fonts/** devtools/client/inspector/markup/test/** -devtools/client/inspector/rules/** devtools/client/inspector/shared/test/** devtools/client/inspector/test/** devtools/client/inspector/*.js diff --git a/.eslintrc b/.eslintrc index 18f05d6d4e..7a04f51360 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,6 +3,11 @@ "plugins": [ "mozilla" ], + "rules": { + "mozilla/components-imports": 1, + "mozilla/import-globals": 1, + "mozilla/this-top-level-scope": 1, + }, "env": { "es6": true }, diff --git a/devtools/.eslintrc b/devtools/.eslintrc index 17b611f383..a80346533e 100644 --- a/devtools/.eslintrc +++ b/devtools/.eslintrc @@ -35,6 +35,8 @@ "mozilla/mark-test-function-used": 1, "mozilla/no-aArgs": 1, "mozilla/no-cpows-in-tests": 1, + // See bug 1224289. + "mozilla/reject-importGlobalProperties": 1, "mozilla/var-only-at-top-level": 1, // Disallow using variables outside the blocks they are defined (especially @@ -260,9 +262,8 @@ // Disallow trailing whitespace at the end of lines. "no-trailing-spaces": 2, // Disallow use of undeclared variables unless mentioned in a /*global */ - // block. - // This should really be a 2, but until we define all globals in comments - // and .eslintrc, keeping this as a 1. + // block. Note that globals from head.js are automatically imported in tests + // by the import-headjs-globals rule form the mozilla eslint plugin. "no-undef": 2, // Allow dangling underscores in identifiers (for privates). "no-underscore-dangle": 0, @@ -381,7 +382,7 @@ // disallow labels that share a name with a variable "no-label-var": 0, // disallow use of labeled statements - "no-labels": 0, + "no-labels": 2, // disallow unnecessary nested blocks "no-lone-blocks": 0, // disallow creation of functions within loops diff --git a/devtools/client/aboutdebugging/modules/worker.js b/devtools/client/aboutdebugging/modules/worker.js index 319432bb6a..a767d409b7 100644 --- a/devtools/client/aboutdebugging/modules/worker.js +++ b/devtools/client/aboutdebugging/modules/worker.js @@ -42,7 +42,7 @@ exports.debugWorker = function(client, workerActor) { * - {Array} workers * Array of WorkerActor forms */ -exports.getWorkerForms = Task.async(function*(client) { +exports.getWorkerForms = Task.async(function* (client) { let registrations = []; let workers = []; diff --git a/devtools/client/animationinspector/animation-controller.js b/devtools/client/animationinspector/animation-controller.js index 6346f82e01..3065388d51 100644 --- a/devtools/client/animationinspector/animation-controller.js +++ b/devtools/client/animationinspector/animation-controller.js @@ -35,7 +35,7 @@ var gToolbox, gInspector; * Startup the animationinspector controller and view, called by the sidebar * widget when loading/unloading the iframe into the tab. */ -var startup = Task.async(function*(inspector) { +var startup = Task.async(function* (inspector) { gInspector = inspector; gToolbox = inspector.toolbox; @@ -56,7 +56,7 @@ var startup = Task.async(function*(inspector) { * Shutdown the animationinspector controller and view, called by the sidebar * widget when loading/unloading the iframe into the tab. */ -var shutdown = Task.async(function*() { +var shutdown = Task.async(function* () { yield AnimationsController.destroy(); // Don't assume that AnimationsPanel is defined here, it's in another file. if (typeof AnimationsPanel !== "undefined") { @@ -79,7 +79,7 @@ function destroy() { * @param {Target} target The current toolbox target. * @return {Object} An object with boolean properties. */ -var getServerTraits = Task.async(function*(target) { +var getServerTraits = Task.async(function* (target) { let config = [ { name: "hasToggleAll", actor: "animations", method: "toggleAll" }, @@ -135,7 +135,7 @@ var AnimationsController = { PLAYERS_UPDATED_EVENT: "players-updated", ALL_ANIMATIONS_TOGGLED_EVENT: "all-animations-toggled", - initialize: Task.async(function*() { + initialize: Task.async(function* () { if (this.initialized) { yield this.initialized.promise; return; @@ -169,7 +169,7 @@ var AnimationsController = { this.initialized.resolve(); }), - destroy: Task.async(function*() { + destroy: Task.async(function* () { if (!this.initialized) { return; } @@ -215,13 +215,13 @@ var AnimationsController = { gInspector.sidebar.getCurrentTabID() == "animationinspector"; }, - onPanelVisibilityChange: Task.async(function*() { + onPanelVisibilityChange: Task.async(function* () { if (this.isPanelVisible()) { this.onNewNodeFront(); } }), - onNewNodeFront: Task.async(function*() { + onNewNodeFront: Task.async(function* () { // Ignore if the panel isn't visible or the node selection hasn't changed. if (!this.isPanelVisible() || this.nodeFront === gInspector.selection.nodeFront) { @@ -265,7 +265,7 @@ var AnimationsController = { * if they should be played. * @return {Promise} Resolves when the playState has been changed. */ - toggleCurrentAnimations: Task.async(function*(shouldPause) { + toggleCurrentAnimations: Task.async(function* (shouldPause) { if (this.traits.hasToggleSeveral) { yield this.animationsFront.toggleSeveral(this.animationPlayers, shouldPause); @@ -288,7 +288,7 @@ var AnimationsController = { * @param {Boolean} shouldPause Should the animations be paused too. * @return {Promise} Resolves when the current time has been set. */ - setCurrentTimeAll: Task.async(function*(time, shouldPause) { + setCurrentTimeAll: Task.async(function* (time, shouldPause) { if (this.traits.hasSetCurrentTimes) { yield this.animationsFront.setCurrentTimes(this.animationPlayers, time, shouldPause); @@ -309,7 +309,7 @@ var AnimationsController = { * @param {Number} rate. * @return {Promise} Resolves when the rate has been set. */ - setPlaybackRateAll: Task.async(function*(rate) { + setPlaybackRateAll: Task.async(function* (rate) { if (this.traits.hasSetPlaybackRates) { // If the backend can set all playback rates at the same time, use that. yield this.animationsFront.setPlaybackRates(this.animationPlayers, rate); @@ -327,7 +327,7 @@ var AnimationsController = { // called again. animationPlayers: [], - refreshAnimationPlayers: Task.async(function*(nodeFront) { + refreshAnimationPlayers: Task.async(function* (nodeFront) { this.destroyAnimationPlayers(); this.animationPlayers = yield this.animationsFront diff --git a/devtools/client/animationinspector/animation-panel.js b/devtools/client/animationinspector/animation-panel.js index 01a3c67f10..cb67864481 100644 --- a/devtools/client/animationinspector/animation-panel.js +++ b/devtools/client/animationinspector/animation-panel.js @@ -22,7 +22,7 @@ var AnimationsPanel = { UI_UPDATED_EVENT: "ui-updated", PANEL_INITIALIZED: "panel-initialized", - initialize: Task.async(function*() { + initialize: Task.async(function* () { if (AnimationsController.destroyed) { console.warn("Could not initialize the animation-panel, controller " + "was destroyed"); @@ -79,7 +79,7 @@ var AnimationsPanel = { this.emit(this.PANEL_INITIALIZED); }), - destroy: Task.async(function*() { + destroy: Task.async(function* () { if (!this.initialized) { return; } @@ -205,7 +205,7 @@ var AnimationsPanel = { * Toggle (pause/play) all animations in the current target * and update the UI the toggleAll button. */ - toggleAll: Task.async(function*() { + toggleAll: Task.async(function* () { this.toggleAllButtonEl.classList.toggle("paused"); yield AnimationsController.toggleAll(); }), @@ -280,7 +280,9 @@ var AnimationsPanel = { this.setCurrentTimeAllPromise = AnimationsController.setCurrentTimeAll(time, true) .catch(error => console.error(error)) - .then(() => this.setCurrentTimeAllPromise = null); + .then(() => { + this.setCurrentTimeAllPromise = null; + }); } this.displayTimelineCurrentTime(); @@ -296,7 +298,7 @@ var AnimationsPanel = { * useful after the playState or currentTime has been changed and in case the * animations aren't auto-refreshing), and then refresh the UI. */ - refreshAnimationsStateAndUI: Task.async(function*() { + refreshAnimationsStateAndUI: Task.async(function* () { for (let player of AnimationsController.animationPlayers) { yield player.refreshState(); } @@ -307,7 +309,7 @@ var AnimationsPanel = { * Refresh the list of animations UI. This will empty the panel and re-render * the various components again. */ - refreshAnimationsUI: Task.async(function*() { + refreshAnimationsUI: Task.async(function* () { // Empty the whole panel first. this.togglePlayers(true); diff --git a/devtools/client/animationinspector/components/animation-details.js b/devtools/client/animationinspector/components/animation-details.js index 0d3d797ec4..0558391433 100644 --- a/devtools/client/animationinspector/components/animation-details.js +++ b/devtools/client/animationinspector/components/animation-details.js @@ -62,7 +62,7 @@ AnimationDetails.prototype = { * @return {Object} A list of tracks, one per animated property, each * with a list of keyframes */ - getTracks: Task.async(function*() { + getTracks: Task.async(function* () { let tracks = {}; /* @@ -112,7 +112,7 @@ AnimationDetails.prototype = { return tracks; }), - render: Task.async(function*(animation) { + render: Task.async(function* (animation) { this.unrender(); if (!animation) { diff --git a/devtools/client/animationinspector/components/animation-target-node.js b/devtools/client/animationinspector/components/animation-target-node.js index ed97d0d17e..55e5a60343 100644 --- a/devtools/client/animationinspector/components/animation-target-node.js +++ b/devtools/client/animationinspector/components/animation-target-node.js @@ -41,7 +41,7 @@ AnimationTargetNode.prototype = { this.isDestroyed = true; }, - render: Task.async(function*(playerFront) { + render: Task.async(function* (playerFront) { // Get the nodeFront from the cache if it was stored previously. let nodeFront = nodeFronts.get(playerFront); diff --git a/devtools/client/animationinspector/test/browser_animation_animated_properties_displayed.js b/devtools/client/animationinspector/test/browser_animation_animated_properties_displayed.js index d77837e02a..4d0a64c2de 100644 --- a/devtools/client/animationinspector/test/browser_animation_animated_properties_displayed.js +++ b/devtools/client/animationinspector/test/browser_animation_animated_properties_displayed.js @@ -21,7 +21,7 @@ const EXPECTED_PROPERTIES = [ "width" ].sort(); -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_keyframes.html"); let {panel} = yield openAnimationInspector(); let timeline = panel.animationsTimelineComponent; diff --git a/devtools/client/animationinspector/test/browser_animation_click_selects_animation.js b/devtools/client/animationinspector/test/browser_animation_click_selects_animation.js index b35b95dffc..be0826ad7a 100644 --- a/devtools/client/animationinspector/test/browser_animation_click_selects_animation.js +++ b/devtools/client/animationinspector/test/browser_animation_click_selects_animation.js @@ -7,7 +7,7 @@ // Check that animations displayed in the timeline can be selected by clicking // them, and that this emits the right events and adds the right classes. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel} = yield openAnimationInspector(); let timeline = panel.animationsTimelineComponent; diff --git a/devtools/client/animationinspector/test/browser_animation_controller_exposes_document_currentTime.js b/devtools/client/animationinspector/test/browser_animation_controller_exposes_document_currentTime.js index ed992dccb8..f6f3ae8405 100644 --- a/devtools/client/animationinspector/test/browser_animation_controller_exposes_document_currentTime.js +++ b/devtools/client/animationinspector/test/browser_animation_controller_exposes_document_currentTime.js @@ -7,7 +7,7 @@ // Test that the controller provides the document.timeline currentTime (at least // the last known version since new animations were added). -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel, controller} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_empty_on_invalid_nodes.js b/devtools/client/animationinspector/test/browser_animation_empty_on_invalid_nodes.js index a34188dd3d..e68af7f5a3 100644 --- a/devtools/client/animationinspector/test/browser_animation_empty_on_invalid_nodes.js +++ b/devtools/client/animationinspector/test/browser_animation_empty_on_invalid_nodes.js @@ -12,7 +12,7 @@ const { LocalizationHelper } = require("devtools/client/shared/l10n"); const STRINGS_URI = "chrome://devtools/locale/animationinspector.properties"; const L10N = new LocalizationHelper(STRINGS_URI); -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel, window} = yield openAnimationInspector(); let {document} = window; diff --git a/devtools/client/animationinspector/test/browser_animation_keyframe_click_to_set_time.js b/devtools/client/animationinspector/test/browser_animation_keyframe_click_to_set_time.js index 73541fd704..9088d97af9 100644 --- a/devtools/client/animationinspector/test/browser_animation_keyframe_click_to_set_time.js +++ b/devtools/client/animationinspector/test/browser_animation_keyframe_click_to_set_time.js @@ -7,7 +7,7 @@ // Test that animated properties' keyframes can be clicked, and that doing so // sets the current time in the timeline. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_keyframes.html"); let {panel} = yield openAnimationInspector(); let timeline = panel.animationsTimelineComponent; diff --git a/devtools/client/animationinspector/test/browser_animation_keyframe_markers.js b/devtools/client/animationinspector/test/browser_animation_keyframe_markers.js index 2a51a4d91a..e8a7ed2860 100644 --- a/devtools/client/animationinspector/test/browser_animation_keyframe_markers.js +++ b/devtools/client/animationinspector/test/browser_animation_keyframe_markers.js @@ -21,7 +21,7 @@ const EXPECTED_PROPERTIES = [ "width" ]; -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_keyframes.html"); let {panel} = yield openAnimationInspector(); let timeline = panel.animationsTimelineComponent; diff --git a/devtools/client/animationinspector/test/browser_animation_mutations_with_same_names.js b/devtools/client/animationinspector/test/browser_animation_mutations_with_same_names.js index 920efc4ec7..c3d1dfe97f 100644 --- a/devtools/client/animationinspector/test/browser_animation_mutations_with_same_names.js +++ b/devtools/client/animationinspector/test/browser_animation_mutations_with_same_names.js @@ -9,7 +9,7 @@ // displayed (which should be true as long as these animations apply to // different nodes). -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_negative_animation.html"); let {controller, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_panel_exists.js b/devtools/client/animationinspector/test/browser_animation_panel_exists.js index e758e19993..1f12605a55 100644 --- a/devtools/client/animationinspector/test/browser_animation_panel_exists.js +++ b/devtools/client/animationinspector/test/browser_animation_panel_exists.js @@ -6,7 +6,7 @@ // Test that the animation panel sidebar exists -add_task(function*() { +add_task(function* () { yield addTab("data:text/html;charset=utf-8,welcome to the animation panel"); let {panel, controller} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_participate_in_inspector_update.js b/devtools/client/animationinspector/test/browser_animation_participate_in_inspector_update.js index f89ad17c35..94222cc037 100644 --- a/devtools/client/animationinspector/test/browser_animation_participate_in_inspector_update.js +++ b/devtools/client/animationinspector/test/browser_animation_participate_in_inspector_update.js @@ -8,7 +8,7 @@ // inspector-updated event. This means that the test verifies that the // inspector-updated event is emitted *after* the animation panel is ready. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel, controller} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_playerFronts_are_refreshed.js b/devtools/client/animationinspector/test/browser_animation_playerFronts_are_refreshed.js index f8c6079e1b..871cb5d81a 100644 --- a/devtools/client/animationinspector/test/browser_animation_playerFronts_are_refreshed.js +++ b/devtools/client/animationinspector/test/browser_animation_playerFronts_are_refreshed.js @@ -7,7 +7,7 @@ // Check that the AnimationPlayerFront objects lifecycle is managed by the // AnimationController. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {controller, inspector} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js b/devtools/client/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js index 3375706c4c..ceefd31947 100644 --- a/devtools/client/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js +++ b/devtools/client/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js @@ -9,7 +9,7 @@ const { ANIMATION_TYPES } = require("devtools/server/actors/animation"); -add_task(function*() { +add_task(function* () { yield new Promise(resolve => { SpecialPowers.pushPrefEnv({"set": [ ["dom.animations-api.core.enabled", true] diff --git a/devtools/client/animationinspector/test/browser_animation_playerWidgets_target_nodes.js b/devtools/client/animationinspector/test/browser_animation_playerWidgets_target_nodes.js index 80a4dae6a1..2ff517705d 100644 --- a/devtools/client/animationinspector/test/browser_animation_playerWidgets_target_nodes.js +++ b/devtools/client/animationinspector/test/browser_animation_playerWidgets_target_nodes.js @@ -6,7 +6,7 @@ // Test that player widgets display information about target nodes -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_pseudo_elements.js b/devtools/client/animationinspector/test/browser_animation_pseudo_elements.js index de02ee3d1f..c6cc3218c5 100644 --- a/devtools/client/animationinspector/test/browser_animation_pseudo_elements.js +++ b/devtools/client/animationinspector/test/browser_animation_pseudo_elements.js @@ -6,7 +6,7 @@ // Test that animated pseudo-elements do show in the timeline. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_pseudo_elements.html"); let {inspector, panel} = yield openAnimationInspector(); let timeline = panel.animationsTimelineComponent; diff --git a/devtools/client/animationinspector/test/browser_animation_refresh_on_added_animation.js b/devtools/client/animationinspector/test/browser_animation_refresh_on_added_animation.js index 24d773b93e..f5f20d4e75 100644 --- a/devtools/client/animationinspector/test/browser_animation_refresh_on_added_animation.js +++ b/devtools/client/animationinspector/test/browser_animation_refresh_on_added_animation.js @@ -6,7 +6,7 @@ // Test that the panel content refreshes when new animations are added. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_refresh_on_removed_animation.js b/devtools/client/animationinspector/test/browser_animation_refresh_on_removed_animation.js index c55cf06da8..a888cdd1f0 100644 --- a/devtools/client/animationinspector/test/browser_animation_refresh_on_removed_animation.js +++ b/devtools/client/animationinspector/test/browser_animation_refresh_on_removed_animation.js @@ -6,7 +6,7 @@ // Test that the panel content refreshes when animations are removed. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_refresh_when_active.js b/devtools/client/animationinspector/test/browser_animation_refresh_when_active.js index ac7fd6f694..a544ac0e44 100644 --- a/devtools/client/animationinspector/test/browser_animation_refresh_when_active.js +++ b/devtools/client/animationinspector/test/browser_animation_refresh_when_active.js @@ -6,7 +6,7 @@ // Test that the panel only refreshes when it is visible in the sidebar. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_running_on_compositor.js b/devtools/client/animationinspector/test/browser_animation_running_on_compositor.js index 91cfd03469..aeaf22a5ea 100644 --- a/devtools/client/animationinspector/test/browser_animation_running_on_compositor.js +++ b/devtools/client/animationinspector/test/browser_animation_running_on_compositor.js @@ -12,7 +12,7 @@ const { LocalizationHelper } = require("devtools/client/shared/l10n"); const STRINGS_URI = "chrome://devtools/locale/animationinspector.properties"; const L10N = new LocalizationHelper(STRINGS_URI); -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel} = yield openAnimationInspector(); let timeline = panel.animationsTimelineComponent; diff --git a/devtools/client/animationinspector/test/browser_animation_same_nb_of_playerWidgets_and_playerFronts.js b/devtools/client/animationinspector/test/browser_animation_same_nb_of_playerWidgets_and_playerFronts.js index 21846066e6..5554d4cbbe 100644 --- a/devtools/client/animationinspector/test/browser_animation_same_nb_of_playerWidgets_and_playerFronts.js +++ b/devtools/client/animationinspector/test/browser_animation_same_nb_of_playerWidgets_and_playerFronts.js @@ -7,7 +7,7 @@ // Check that when playerFronts are updated, the same number of playerWidgets // are created in the panel. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel, controller} = yield openAnimationInspector(); let timeline = panel.animationsTimelineComponent; diff --git a/devtools/client/animationinspector/test/browser_animation_shows_player_on_valid_node.js b/devtools/client/animationinspector/test/browser_animation_shows_player_on_valid_node.js index d6c860a991..795f93efc9 100644 --- a/devtools/client/animationinspector/test/browser_animation_shows_player_on_valid_node.js +++ b/devtools/client/animationinspector/test/browser_animation_shows_player_on_valid_node.js @@ -7,7 +7,7 @@ // Test that the panel shows an animation player when an animated node is // selected. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_spacebar_toggles_animations.js b/devtools/client/animationinspector/test/browser_animation_spacebar_toggles_animations.js index 12b08fc628..593dbe685c 100644 --- a/devtools/client/animationinspector/test/browser_animation_spacebar_toggles_animations.js +++ b/devtools/client/animationinspector/test/browser_animation_spacebar_toggles_animations.js @@ -10,7 +10,7 @@ // because there's an other test that does this : // browser_animation_toggle_button_toggles_animation.js -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel, inspector, window, controller} = yield openAnimationInspector(); let {toggleAllButtonEl} = panel; diff --git a/devtools/client/animationinspector/test/browser_animation_spacebar_toggles_node_animations.js b/devtools/client/animationinspector/test/browser_animation_spacebar_toggles_node_animations.js index 1e818c158d..d407070e01 100644 --- a/devtools/client/animationinspector/test/browser_animation_spacebar_toggles_node_animations.js +++ b/devtools/client/animationinspector/test/browser_animation_spacebar_toggles_node_animations.js @@ -10,7 +10,7 @@ // There are animations in the test page and since, by default, the
node // is selected, animations will be displayed in the timeline, so the timeline // play/resume button will be displayed -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel, window} = yield openAnimationInspector(); let {playTimelineButtonEl} = panel; diff --git a/devtools/client/animationinspector/test/browser_animation_target_highlight_select.js b/devtools/client/animationinspector/test/browser_animation_target_highlight_select.js index a8d3045ed9..ec08b73888 100644 --- a/devtools/client/animationinspector/test/browser_animation_target_highlight_select.js +++ b/devtools/client/animationinspector/test/browser_animation_target_highlight_select.js @@ -7,7 +7,7 @@ // Test that the DOM element targets displayed in animation player widgets can // be used to highlight elements in the DOM and select them in the inspector. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {toolbox, inspector, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_target_highlighter_lock.js b/devtools/client/animationinspector/test/browser_animation_target_highlighter_lock.js index 24c2ce9990..44cad002f9 100644 --- a/devtools/client/animationinspector/test/browser_animation_target_highlighter_lock.js +++ b/devtools/client/animationinspector/test/browser_animation_target_highlighter_lock.js @@ -7,7 +7,7 @@ // Test that the DOM element targets displayed in animation player widgets can // be used to highlight elements in the DOM and select them in the inspector. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js b/devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js index f972973013..a4d25ac37a 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js @@ -8,7 +8,7 @@ // changes when animations are playing, gets back to 0 when animations are // rewound, and stops when animations are paused. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_header.js b/devtools/client/animationinspector/test/browser_animation_timeline_header.js index 9e4720ae1c..f2e0a9c338 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_header.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_header.js @@ -12,7 +12,7 @@ const {findOptimalTimeInterval, TimeScale} = require("devtools/client/animationi // animation-timeline.js const TIME_GRADUATION_MIN_SPACING = 40; -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_iterationStart.js b/devtools/client/animationinspector/test/browser_animation_timeline_iterationStart.js index ffdde0c0e1..5116adff33 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_iterationStart.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_iterationStart.js @@ -6,7 +6,7 @@ // Check that the iteration start is displayed correctly in time blocks. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_script_animation.html"); let {panel} = yield openAnimationInspector(); let timelineComponent = panel.animationsTimelineComponent; diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_pause_button.js b/devtools/client/animationinspector/test/browser_animation_timeline_pause_button.js index 13da0edb9c..2114e614cd 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_pause_button.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_pause_button.js @@ -16,7 +16,7 @@ requestLongerTimeout(2); // And test that clicking the button once the scrubber has reached the end of // the timeline does the right thing. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel, inspector} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_rate_selector.js b/devtools/client/animationinspector/test/browser_animation_timeline_rate_selector.js index 5eeb68781d..aa04a6bc77 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_rate_selector.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_rate_selector.js @@ -10,7 +10,7 @@ // all have the same rate, or that it displays the empty value in case they // have mixed rates. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel, controller, inspector, toolbox} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_rewind_button.js b/devtools/client/animationinspector/test/browser_animation_timeline_rewind_button.js index 54869e5458..41139553d2 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_rewind_button.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_rewind_button.js @@ -10,7 +10,7 @@ // reset to 0, and that the scrubber stops moving and is positioned to the // start. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel, controller} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_exists.js b/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_exists.js index 633001fa95..36f633dcdd 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_exists.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_exists.js @@ -6,7 +6,7 @@ // Check that the timeline does have a scrubber element. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_movable.js b/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_movable.js index 01037b5663..ab7067ff51 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_movable.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_movable.js @@ -10,7 +10,7 @@ // state. // Finally, also check that the scrubber can be moved using the scrubber handle. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_moves.js b/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_moves.js index 85c718866f..3293c7c246 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_moves.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_scrubber_moves.js @@ -9,7 +9,7 @@ // measures the position of the scrubber once, then waits for some time to pass // and measures its position again. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_shows_delay.js b/devtools/client/animationinspector/test/browser_animation_timeline_shows_delay.js index 6680672c51..fe70e34b00 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_shows_delay.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_shows_delay.js @@ -9,7 +9,7 @@ // Also check that negative delays do not overflow the UI, and are shown like // positive delays. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_shows_endDelay.js b/devtools/client/animationinspector/test/browser_animation_timeline_shows_endDelay.js index fe10a9e8a0..2c9f60746e 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_shows_endDelay.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_shows_endDelay.js @@ -11,7 +11,7 @@ requestLongerTimeout(2); // Also check that negative endDelays do not overflow the UI, and are shown // like positive endDelays. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_end_delay.html"); let {inspector, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_shows_iterations.js b/devtools/client/animationinspector/test/browser_animation_timeline_shows_iterations.js index 470c83c780..b042106be4 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_shows_iterations.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_shows_iterations.js @@ -7,7 +7,7 @@ // Check that the timeline is displays as many iteration elements as there are // iterations in an animation. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_shows_time_info.js b/devtools/client/animationinspector/test/browser_animation_timeline_shows_time_info.js index ecb1caaff6..6927ab5f3f 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_shows_time_info.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_shows_time_info.js @@ -9,7 +9,7 @@ requestLongerTimeout(2); // Check that the timeline displays animations' duration, delay iteration // counts and iteration start in tooltips. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel, controller} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_takes_rate_into_account.js b/devtools/client/animationinspector/test/browser_animation_timeline_takes_rate_into_account.js index aa84984ff1..99efea9324 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_takes_rate_into_account.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_takes_rate_into_account.js @@ -11,7 +11,7 @@ // of which may have a different rate than others. Those that have had their // rate changed have a delay = delay/rate and a duration = duration/rate. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_modify_playbackRate.html"); let {panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_ui.js b/devtools/client/animationinspector/test/browser_animation_timeline_ui.js index 249d781cd2..f2d7bb7757 100644 --- a/devtools/client/animationinspector/test/browser_animation_timeline_ui.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_ui.js @@ -6,7 +6,7 @@ // Check that the timeline contains the right elements. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_toggle_button_resets_on_navigate.js b/devtools/client/animationinspector/test/browser_animation_toggle_button_resets_on_navigate.js index fad64105b5..d9a92b905d 100644 --- a/devtools/client/animationinspector/test/browser_animation_toggle_button_resets_on_navigate.js +++ b/devtools/client/animationinspector/test/browser_animation_toggle_button_resets_on_navigate.js @@ -8,7 +8,7 @@ requestLongerTimeout(2); // Test that a page navigation resets the state of the global toggle button. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_toggle_button_toggles_animations.js b/devtools/client/animationinspector/test/browser_animation_toggle_button_toggles_animations.js index a4647ebf4b..31896857ed 100644 --- a/devtools/client/animationinspector/test/browser_animation_toggle_button_toggles_animations.js +++ b/devtools/client/animationinspector/test/browser_animation_toggle_button_toggles_animations.js @@ -9,7 +9,7 @@ // animations have been paused (including inside iframes) because there's an // actor test in /devtools/server/tests/browser/ that does this. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/browser_animation_toolbar_exists.js b/devtools/client/animationinspector/test/browser_animation_toolbar_exists.js index 4a054004fc..5938a30a39 100644 --- a/devtools/client/animationinspector/test/browser_animation_toolbar_exists.js +++ b/devtools/client/animationinspector/test/browser_animation_toolbar_exists.js @@ -9,7 +9,7 @@ // Also test that this toolbar gets replaced by the timeline toolbar when there // are animations to be displayed. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {inspector, window} = yield openAnimationInspector(); let doc = window.document; diff --git a/devtools/client/animationinspector/test/browser_animation_ui_updates_when_animation_data_changes.js b/devtools/client/animationinspector/test/browser_animation_ui_updates_when_animation_data_changes.js index e13618c391..39e327f691 100644 --- a/devtools/client/animationinspector/test/browser_animation_ui_updates_when_animation_data_changes.js +++ b/devtools/client/animationinspector/test/browser_animation_ui_updates_when_animation_data_changes.js @@ -7,7 +7,7 @@ // Verify that if the animation's duration, iterations or delay change in // content, then the widget reflects the changes. -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel, controller, inspector} = yield openAnimationInspector(); diff --git a/devtools/client/animationinspector/test/head.js b/devtools/client/animationinspector/test/head.js index 8bbfe49645..c3d0043f5a 100644 --- a/devtools/client/animationinspector/test/head.js +++ b/devtools/client/animationinspector/test/head.js @@ -17,7 +17,7 @@ const COMMON_FRAME_SCRIPT_URL = "chrome://devtools/content/shared/frame-script-u const TAB_NAME = "animationinspector"; // Auto clean-up when a test ends -registerCleanupFunction(function*() { +registerCleanupFunction(function* () { yield closeAnimationInspector(); while (gBrowser.tabs.length > 1) { @@ -75,7 +75,7 @@ function* reloadTab(inspector) { and animations of its subtree are properly displayed. */ var selectNodeAndWaitForAnimations = Task.async( - function*(data, inspector, reason = "test") { + function* (data, inspector, reason = "test") { yield selectNode(data, inspector, reason); // We want to make sure the rest of the test waits for the animations to @@ -107,7 +107,7 @@ function assertAnimationsDisplayed(panel, nbAnimations, msg = "") { * @param {InspectorPanel} inspector * @return {Promise} */ -var waitForAnimationInspectorReady = Task.async(function*(inspector) { +var waitForAnimationInspectorReady = Task.async(function* (inspector) { let win = inspector.sidebar.getWindowForTab(TAB_NAME); let updated = inspector.once("inspector-updated"); @@ -127,7 +127,7 @@ var waitForAnimationInspectorReady = Task.async(function*(inspector) { * sidebar selected. * @return a promise that resolves when the inspector is ready. */ -var openAnimationInspector = Task.async(function*() { +var openAnimationInspector = Task.async(function* () { let {inspector, toolbox} = yield openInspectorSidebarTab(TAB_NAME); info("Waiting for the inspector and sidebar to be ready"); @@ -161,7 +161,7 @@ var openAnimationInspector = Task.async(function*() { * Close the toolbox. * @return a promise that resolves when the toolbox has closed. */ -var closeAnimationInspector = Task.async(function*() { +var closeAnimationInspector = Task.async(function* () { let target = TargetFactory.forTab(gBrowser.selectedTab); yield gDevTools.closeToolbox(target); }); @@ -214,8 +214,8 @@ function executeInContent(name, data = {}, objects = {}, /** * Get the current playState of an animation player on a given node. */ -var getAnimationPlayerState = Task.async(function*(selector, - animationIndex = 0) { +var getAnimationPlayerState = Task.async(function* (selector, + animationIndex = 0) { let playState = yield executeInContent("Test:GetAnimationPlayerState", {selector, animationIndex}); return playState; @@ -236,7 +236,7 @@ function isNodeVisible(node) { * @param {AnimationsPanel} panel * @return {Array} all AnimationTargetNode instances */ -var waitForAllAnimationTargets = Task.async(function*(panel) { +var waitForAllAnimationTargets = Task.async(function* (panel) { let targets = panel.animationsTimelineComponent.targetNodes; yield promise.all(targets.map(t => { if (!t.previewer.nodeFront) { @@ -265,7 +265,9 @@ function* assertScrubberMoving(panel, isMoving) { // If instead we expect the scrubber to remain at its position, just wait // for some time and make sure timeline-data-changed isn't emitted. let hasMoved = false; - timeline.once("timeline-data-changed", () => hasMoved = true); + timeline.once("timeline-data-changed", () => { + hasMoved = true; + }); yield new Promise(r => setTimeout(r, 500)); ok(!hasMoved, "The scrubber is not moving"); } diff --git a/devtools/client/definitions.js b/devtools/client/definitions.js index 2ce75a957c..60120f85fe 100644 --- a/devtools/client/definitions.js +++ b/devtools/client/definitions.js @@ -141,6 +141,7 @@ Tools.webConsole = { } panel.focusInput(); + return undefined; }, isTargetSupported: function() { diff --git a/devtools/client/inspector/computed/test/browser_computed_cycle_color.js b/devtools/client/inspector/computed/test/browser_computed_cycle_color.js index 485dccd369..0a25e7ed05 100644 --- a/devtools/client/inspector/computed/test/browser_computed_cycle_color.js +++ b/devtools/client/inspector/computed/test/browser_computed_cycle_color.js @@ -9,7 +9,7 @@ const TEST_URI = ` Some styled text @@ -26,11 +26,10 @@ add_task(function*() { info("Checking matched selectors"); container = yield getComputedViewMatchedRules(view, "color"); - checkColorCycling(container, view); + yield checkColorCycling(container, view); }); -function checkColorCycling(container, view) { - let swatch = container.querySelector(".computedview-colorswatch"); +function* checkColorCycling(container, view) { let valueNode = container.querySelector(".computedview-color"); let win = view.styleWindow; @@ -38,32 +37,34 @@ function checkColorCycling(container, view) { is(valueNode.textContent, "rgb(255, 0, 0)", "Color displayed as an RGB value."); - // Hex - EventUtils.synthesizeMouseAtCenter(swatch, - {type: "mousedown", shiftKey: true}, win); - is(valueNode.textContent, "#F00", "Color displayed as a hex value."); + let tests = [{ + value: "red", + comment: "Color displayed as a color name." + }, { + value: "#f00", + comment: "Color displayed as an authored value." + }, { + value: "hsl(0, 100%, 50%)", + comment: "Color displayed as an HSL value again." + }, { + value: "rgb(255, 0, 0)", + comment: "Color displayed as an RGB value again." + }]; - // HSL - EventUtils.synthesizeMouseAtCenter(swatch, - {type: "mousedown", shiftKey: true}, win); - is(valueNode.textContent, "hsl(0, 100%, 50%)", - "Color displayed as an HSL value."); - - // RGB - EventUtils.synthesizeMouseAtCenter(swatch, - {type: "mousedown", shiftKey: true}, win); - is(valueNode.textContent, "rgb(255, 0, 0)", - "Color displayed as an RGB value."); - - // Color name - EventUtils.synthesizeMouseAtCenter(swatch, - {type: "mousedown", shiftKey: true}, win); - is(valueNode.textContent, "red", - "Color displayed as a color name."); - - // Back to "Authored" - EventUtils.synthesizeMouseAtCenter(swatch, - {type: "mousedown", shiftKey: true}, win); - is(valueNode.textContent, "rgb(255, 0, 0)", - "Color displayed as an RGB value."); + for (let test of tests) { + yield checkSwatchShiftClick(container, win, test.value, test.comment); + } +} + +function* checkSwatchShiftClick(container, win, expectedValue, comment) { + let swatch = container.querySelector(".computedview-colorswatch"); + let valueNode = container.querySelector(".computedview-color"); + + let onUnitChange = swatch.once("unit-change"); + EventUtils.synthesizeMouseAtCenter(swatch, { + type: "mousedown", + shiftKey: true + }, win); + yield onUnitChange; + is(valueNode.textContent, expectedValue, comment); } diff --git a/devtools/client/inspector/inspector.css b/devtools/client/inspector/inspector.css index 2d99492fca..8735790cad 100644 --- a/devtools/client/inspector/inspector.css +++ b/devtools/client/inspector/inspector.css @@ -27,7 +27,7 @@ max-width: 150px; } -.inspector-tabpanel { +.inspector-tabpanel > * { /* * Override `-moz-user-focus:ignore;` from toolkit/content/minimal-xul.css */ diff --git a/devtools/client/inspector/layout/layout.js b/devtools/client/inspector/layout/layout.js index 228a4c8cde..494fa3943b 100644 --- a/devtools/client/inspector/layout/layout.js +++ b/devtools/client/inspector/layout/layout.js @@ -318,7 +318,10 @@ LayoutView.prototype = { let editor = new InplaceEditor({ element: element, initial: initialValue, - + contentType: InplaceEditor.CONTENT_TYPES.CSS_VALUE, + property: { + name: dimension.property + }, start: self => { self.elt.parentNode.classList.add("layout-editing"); }, @@ -601,6 +604,7 @@ LayoutView.prototype = { this.elementRules = styleEntries.map(e => e.rule); this.inspector.emit("layoutview-updated"); + return undefined; }).bind(this)).catch(console.error); this._lastRequest = lastRequest; diff --git a/devtools/client/inspector/layout/test/browser_layout.js b/devtools/client/inspector/layout/test/browser_layout.js index e7e797eb23..2daebd0127 100644 --- a/devtools/client/inspector/layout/test/browser_layout.js +++ b/devtools/client/inspector/layout/test/browser_layout.js @@ -126,7 +126,7 @@ var res2 = [ }, ]; -add_task(function*() { +add_task(function* () { let style = "div { position: absolute; top: 42px; left: 42px; " + "height: 100.111px; width: 100px; border: 10px solid black; " + "padding: 20px; margin: 30px auto;}"; diff --git a/devtools/client/inspector/layout/test/browser_layout_editablemodel.js b/devtools/client/inspector/layout/test/browser_layout_editablemodel.js index dae2ba3057..c143b7188f 100644 --- a/devtools/client/inspector/layout/test/browser_layout_editablemodel.js +++ b/devtools/client/inspector/layout/test/browser_layout_editablemodel.js @@ -19,7 +19,7 @@ const TEST_URI = "" + ""; -add_task(function*() { +add_task(function* () { yield addTab("data:text/html," + encodeURIComponent(TEST_URI)); let {inspector, view, testActor} = yield openLayoutView(); diff --git a/devtools/client/inspector/layout/test/browser_layout_editablemodel_border.js b/devtools/client/inspector/layout/test/browser_layout_editablemodel_border.js index e775bf5183..4a03865020 100644 --- a/devtools/client/inspector/layout/test/browser_layout_editablemodel_border.js +++ b/devtools/client/inspector/layout/test/browser_layout_editablemodel_border.js @@ -14,7 +14,7 @@ const TEST_URI = "" + ""; -add_task(function*() { +add_task(function* () { yield addTab("data:text/html," + encodeURIComponent(TEST_URI)); let {inspector, view, testActor} = yield openLayoutView(); diff --git a/devtools/client/inspector/layout/test/browser_layout_editablemodel_stylerules.js b/devtools/client/inspector/layout/test/browser_layout_editablemodel_stylerules.js index a65a2a351f..e27d91e91b 100644 --- a/devtools/client/inspector/layout/test/browser_layout_editablemodel_stylerules.js +++ b/devtools/client/inspector/layout/test/browser_layout_editablemodel_stylerules.js @@ -15,7 +15,7 @@ const TEST_URI = "" + ""; -add_task(function*() { +add_task(function* () { yield addTab("data:text/html," + encodeURIComponent(TEST_URI)); let {inspector, view, testActor} = yield openLayoutView(); diff --git a/devtools/client/inspector/layout/test/browser_layout_guides.js b/devtools/client/inspector/layout/test/browser_layout_guides.js index 94354e99aa..abad54df92 100644 --- a/devtools/client/inspector/layout/test/browser_layout_guides.js +++ b/devtools/client/inspector/layout/test/browser_layout_guides.js @@ -17,7 +17,7 @@ const TEST_URL = "data:text/html;charset=utf-8," + encodeURIComponent(HTML); var highlightedNodeFront, highlighterOptions; -add_task(function*() { +add_task(function* () { yield addTab(TEST_URL); let {toolbox, inspector, view} = yield openLayoutView(); yield selectNode("div", inspector); diff --git a/devtools/client/inspector/layout/test/browser_layout_rotate-labels-on-sides.js b/devtools/client/inspector/layout/test/browser_layout_rotate-labels-on-sides.js index ff47fd095d..5ec5bbff47 100644 --- a/devtools/client/inspector/layout/test/browser_layout_rotate-labels-on-sides.js +++ b/devtools/client/inspector/layout/test/browser_layout_rotate-labels-on-sides.js @@ -30,7 +30,7 @@ const TEST_URI = encodeURIComponent([ ].join("")); const LONG_TEXT_ROTATE_LIMIT = 3; -add_task(function*() { +add_task(function* () { yield addTab("data:text/html," + TEST_URI); let {inspector, view} = yield openLayoutView(); yield selectNode("div", inspector); diff --git a/devtools/client/inspector/layout/test/browser_layout_tooltips.js b/devtools/client/inspector/layout/test/browser_layout_tooltips.js index 3f8020af7d..69aef28e59 100644 --- a/devtools/client/inspector/layout/test/browser_layout_tooltips.js +++ b/devtools/client/inspector/layout/test/browser_layout_tooltips.js @@ -70,7 +70,7 @@ const VALUES_TEST_DATA = [{ }] }]; -add_task(function*() { +add_task(function* () { yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); let {inspector, view} = yield openLayoutView(); diff --git a/devtools/client/inspector/layout/test/browser_layout_update-after-navigation.js b/devtools/client/inspector/layout/test/browser_layout_update-after-navigation.js index da99e8aece..3d082cddab 100644 --- a/devtools/client/inspector/layout/test/browser_layout_update-after-navigation.js +++ b/devtools/client/inspector/layout/test/browser_layout_update-after-navigation.js @@ -10,7 +10,7 @@ const IFRAME1 = URL_ROOT + "doc_layout_iframe1.html"; const IFRAME2 = URL_ROOT + "doc_layout_iframe2.html"; -add_task(function*() { +add_task(function* () { yield addTab(IFRAME1); let {inspector, view, testActor} = yield openLayoutView(); diff --git a/devtools/client/inspector/layout/test/browser_layout_update-after-reload.js b/devtools/client/inspector/layout/test/browser_layout_update-after-reload.js index 8dda26c85f..1352445dbc 100644 --- a/devtools/client/inspector/layout/test/browser_layout_update-after-reload.js +++ b/devtools/client/inspector/layout/test/browser_layout_update-after-reload.js @@ -6,7 +6,7 @@ // Test that the layout-view continues to work after the page is reloaded -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_layout_iframe1.html"); let {inspector, view, testActor} = yield openLayoutView(); @@ -14,7 +14,7 @@ add_task(function*() { yield assertLayoutView(inspector, view, testActor); info("Reload the page"); - yield testActor.eval("content.location.reload();"); + yield testActor.reload(); yield inspector.once("markuploaded"); info("Test that the layout-view works on the reloaded page"); diff --git a/devtools/client/inspector/layout/test/browser_layout_update-in-iframes.js b/devtools/client/inspector/layout/test/browser_layout_update-in-iframes.js index 38730156a9..1847a38c2a 100644 --- a/devtools/client/inspector/layout/test/browser_layout_update-in-iframes.js +++ b/devtools/client/inspector/layout/test/browser_layout_update-in-iframes.js @@ -7,7 +7,7 @@ // Test that the layout-view for elements within iframes also updates when they // change -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_layout_iframe1.html"); let {inspector, view, testActor} = yield openLayoutView(); diff --git a/devtools/client/inspector/markup/markup.js b/devtools/client/inspector/markup/markup.js index 4988bb59c1..4cf8abeb76 100644 --- a/devtools/client/inspector/markup/markup.js +++ b/devtools/client/inspector/markup/markup.js @@ -468,6 +468,8 @@ MarkupView.prototype = { // and decision to show or not the tooltip return container.isImagePreviewTarget(target, this.tooltip); } + + return undefined; }, /** @@ -534,6 +536,7 @@ MarkupView.prototype = { // Make sure the new selection receives focus so the keyboard can be used. this.maybeFocusNewSelection(); + return undefined; }).catch(e => { if (!this._destroyer) { console.error(e); @@ -609,17 +612,19 @@ MarkupView.prototype = { return; } + // Ignore keystrokes with modifiers to allow native shortcuts (such as save: + // accel + S) to bubble up. + if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) { + return; + } + switch (event.keyCode) { case Ci.nsIDOMKeyEvent.DOM_VK_H: - if (event.metaKey || event.shiftKey) { - handled = false; + let node = this._selectedContainer.node; + if (node.hidden) { + this.walker.unhideNode(node); } else { - let node = this._selectedContainer.node; - if (node.hidden) { - this.walker.unhideNode(node); - } else { - this.walker.hideNode(node); - } + this.walker.hideNode(node); } break; case Ci.nsIDOMKeyEvent.DOM_VK_DELETE: @@ -705,6 +710,7 @@ MarkupView.prototype = { this.cancelDragging(); break; } + // falls through } default: handled = false; @@ -2007,7 +2013,7 @@ MarkupContainer.prototype = { /** * On mouse up, stop dragging. */ - _onMouseUp: Task.async(function*() { + _onMouseUp: Task.async(function* () { this._isPreDragging = false; if (this.isDragging) { @@ -2296,6 +2302,7 @@ MarkupElementContainer.prototype = Heritage.extend(MarkupContainer.prototype, { }); return true; } + return undefined; }, /** @@ -2325,7 +2332,7 @@ MarkupElementContainer.prototype = Heritage.extend(MarkupContainer.prototype, { Services.prefs.getIntPref("devtools.inspector.imagePreviewTooltipSize"); // Fetch the preview from the server. - this.tooltipDataPromise = Task.spawn(function*() { + this.tooltipDataPromise = Task.spawn(function* () { let preview = yield this.node.getImageData(maxDim); let data = yield preview.data.string(); @@ -2516,6 +2523,11 @@ function TextEditor(container, node, template) { stopOnReturn: true, trigger: "dblclick", multiline: true, + maxWidth: () => { + let elementRect = this.value.getBoundingClientRect(); + let containerRect = this.container.elt.getBoundingClientRect(); + return containerRect.right - elementRect.left - 2; + }, trimOutput: false, done: (val, commit) => { if (!commit) { diff --git a/devtools/client/inspector/markup/test/browser.ini b/devtools/client/inspector/markup/test/browser.ini index 9e77177803..1e7b1bd73d 100644 --- a/devtools/client/inspector/markup/test/browser.ini +++ b/devtools/client/inspector/markup/test/browser.ini @@ -14,6 +14,7 @@ support-files = doc_markup_flashing.html doc_markup_html_mixed_case.html doc_markup_image_and_canvas.html + doc_markup_image_and_canvas_2.html doc_markup_links.html doc_markup_mutation.html doc_markup_navigation.html @@ -104,6 +105,7 @@ skip-if = e10s # Bug 1040751 - CodeMirror editor.destroy() isn't e10s compatible [browser_markup_keybindings_03.js] [browser_markup_keybindings_04.js] [browser_markup_keybindings_delete_attributes.js] +[browser_markup_keybindings_scrolltonode.js] [browser_markup_mutation_01.js] [browser_markup_mutation_02.js] [browser_markup_node_names.js] @@ -129,6 +131,7 @@ skip-if = e10s # Bug 1036409 - The last selected node isn't reselected [browser_markup_tag_edit_12.js] [browser_markup_tag_edit_13-other.js] [browser_markup_textcontent_edit_01.js] +[browser_markup_textcontent_edit_02.js] [browser_markup_toggle_01.js] [browser_markup_toggle_02.js] [browser_markup_toggle_03.js] diff --git a/devtools/client/inspector/markup/test/browser_markup_anonymous_01.js b/devtools/client/inspector/markup/test/browser_markup_anonymous_01.js index dd5a2093ba..fd32251d0e 100644 --- a/devtools/client/inspector/markup/test/browser_markup_anonymous_01.js +++ b/devtools/client/inspector/markup/test/browser_markup_anonymous_01.js @@ -7,7 +7,7 @@ // Test native anonymous content in the markupview. const TEST_URL = URL_ROOT + "doc_markup_anonymous.html"; -add_task(function*() { +add_task(function* () { let {inspector} = yield openInspectorForURL(TEST_URL); let pseudo = yield getNodeFront("#pseudo", inspector); diff --git a/devtools/client/inspector/markup/test/browser_markup_anonymous_02.js b/devtools/client/inspector/markup/test/browser_markup_anonymous_02.js index 9ff4c7e752..2b5445e9ed 100644 --- a/devtools/client/inspector/markup/test/browser_markup_anonymous_02.js +++ b/devtools/client/inspector/markup/test/browser_markup_anonymous_02.js @@ -7,7 +7,7 @@ // Test XBL anonymous content in the markupview const TEST_URL = "chrome://devtools/content/scratchpad/scratchpad.xul"; -add_task(function*() { +add_task(function* () { let {inspector} = yield openInspectorForURL(TEST_URL); let toolbarbutton = yield getNodeFront("toolbarbutton", inspector); diff --git a/devtools/client/inspector/markup/test/browser_markup_anonymous_03.js b/devtools/client/inspector/markup/test/browser_markup_anonymous_03.js index 30ae57c3c3..010ce06e07 100644 --- a/devtools/client/inspector/markup/test/browser_markup_anonymous_03.js +++ b/devtools/client/inspector/markup/test/browser_markup_anonymous_03.js @@ -9,7 +9,7 @@ // of elements should be working. const TEST_URL = URL_ROOT + "doc_markup_anonymous.html"; -add_task(function*() { +add_task(function* () { Services.prefs.setBoolPref("dom.webcomponents.enabled", true); let {inspector} = yield openInspectorForURL(TEST_URL); diff --git a/devtools/client/inspector/markup/test/browser_markup_anonymous_04.js b/devtools/client/inspector/markup/test/browser_markup_anonymous_04.js index e91ba216fa..da5e4567d2 100644 --- a/devtools/client/inspector/markup/test/browser_markup_anonymous_04.js +++ b/devtools/client/inspector/markup/test/browser_markup_anonymous_04.js @@ -9,7 +9,7 @@ const TEST_URL = URL_ROOT + "doc_markup_anonymous.html"; const PREF = "devtools.inspector.showAllAnonymousContent"; -add_task(function*() { +add_task(function* () { Services.prefs.setBoolPref(PREF, true); let {inspector} = yield openInspectorForURL(TEST_URL); diff --git a/devtools/client/inspector/markup/test/browser_markup_copy_image_data.js b/devtools/client/inspector/markup/test/browser_markup_copy_image_data.js index eaca463117..4c98cff26d 100644 --- a/devtools/client/inspector/markup/test/browser_markup_copy_image_data.js +++ b/devtools/client/inspector/markup/test/browser_markup_copy_image_data.js @@ -7,7 +7,7 @@ // Test that image nodes have the "copy data-uri" contextual menu item enabled // and that clicking it puts the image data into the clipboard -add_task(function*() { +add_task(function* () { yield addTab(URL_ROOT + "doc_markup_image_and_canvas.html"); let {inspector, testActor} = yield openInspector(); diff --git a/devtools/client/inspector/markup/test/browser_markup_css_completion_style_attribute_01.js b/devtools/client/inspector/markup/test/browser_markup_css_completion_style_attribute_01.js index 62e29fe606..4dc049ee92 100644 --- a/devtools/client/inspector/markup/test/browser_markup_css_completion_style_attribute_01.js +++ b/devtools/client/inspector/markup/test/browser_markup_css_completion_style_attribute_01.js @@ -69,7 +69,7 @@ const TEST_DATA = [ -1, -1, false] ]; -add_task(function*() { +add_task(function* () { info("Opening the inspector on the test URL"); let {inspector} = yield openInspectorForURL(TEST_URL); diff --git a/devtools/client/inspector/markup/test/browser_markup_css_completion_style_attribute_02.js b/devtools/client/inspector/markup/test/browser_markup_css_completion_style_attribute_02.js index 42c460c289..51a1d4796b 100644 --- a/devtools/client/inspector/markup/test/browser_markup_css_completion_style_attribute_02.js +++ b/devtools/client/inspector/markup/test/browser_markup_css_completion_style_attribute_02.js @@ -96,7 +96,7 @@ const TEST_DATA_INNER = [ ["VK_RETURN", "style=\"background:url('1'); color:beige\"", -1, -1, false] ]; -add_task(function*() { +add_task(function* () { info("Opening the inspector on the test URL"); let {inspector} = yield openInspectorForURL(TEST_URL); diff --git a/devtools/client/inspector/markup/test/browser_markup_dragdrop_autoscroll.js b/devtools/client/inspector/markup/test/browser_markup_dragdrop_autoscroll.js index 492cd842bf..a5f3c57de1 100644 --- a/devtools/client/inspector/markup/test/browser_markup_dragdrop_autoscroll.js +++ b/devtools/client/inspector/markup/test/browser_markup_dragdrop_autoscroll.js @@ -9,7 +9,7 @@ const TEST_URL = URL_ROOT + "doc_markup_dragdrop_autoscroll.html"; -add_task(function*() { +add_task(function* () { let {inspector} = yield openInspectorForURL(TEST_URL); let markup = inspector.markup; let viewHeight = markup.doc.documentElement.clientHeight; diff --git a/devtools/client/inspector/markup/test/browser_markup_dragdrop_distance.js b/devtools/client/inspector/markup/test/browser_markup_dragdrop_distance.js index 9b230092ec..3c52936387 100644 --- a/devtools/client/inspector/markup/test/browser_markup_dragdrop_distance.js +++ b/devtools/client/inspector/markup/test/browser_markup_dragdrop_distance.js @@ -14,7 +14,7 @@ const TEST_NODE = "#test"; // Keep this in sync with DRAG_DROP_MIN_INITIAL_DISTANCE in markup-view.js const MIN_DISTANCE = 10; -add_task(function*() { +add_task(function* () { let {inspector} = yield openInspectorForURL(TEST_URL); info("Drag the test node by half of the minimum distance"); diff --git a/devtools/client/inspector/markup/test/browser_markup_dragdrop_dragRootNode.js b/devtools/client/inspector/markup/test/browser_markup_dragdrop_dragRootNode.js index 17e4992083..8bb4779d5d 100644 --- a/devtools/client/inspector/markup/test/browser_markup_dragdrop_dragRootNode.js +++ b/devtools/client/inspector/markup/test/browser_markup_dragdrop_dragRootNode.js @@ -9,7 +9,7 @@ const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html"; const TEST_DATA = ["html", "head", "body"]; -add_task(function*() { +add_task(function* () { let {inspector} = yield openInspectorForURL(TEST_URL); for (let selector of TEST_DATA) { diff --git a/devtools/client/inspector/markup/test/browser_markup_dragdrop_draggable.js b/devtools/client/inspector/markup/test/browser_markup_dragdrop_draggable.js index b43efd4221..f878964ad8 100644 --- a/devtools/client/inspector/markup/test/browser_markup_dragdrop_draggable.js +++ b/devtools/client/inspector/markup/test/browser_markup_dragdrop_draggable.js @@ -22,7 +22,7 @@ const TEST_DATA = [ { node: "input", draggable: true }, { node: "div", draggable: true }, { - node: function*(inspector) { + node: function* (inspector) { let parentFront = yield getNodeFront("#before", inspector); let {nodes} = yield inspector.walker.children(parentFront); // Getting the comment node. @@ -31,7 +31,7 @@ const TEST_DATA = [ draggable: true }, { - node: function*(inspector) { + node: function* (inspector) { let parentFront = yield getNodeFront("#test", inspector); let {nodes} = yield inspector.walker.children(parentFront); // Getting the ::before pseudo element. @@ -41,7 +41,7 @@ const TEST_DATA = [ } ]; -add_task(function*() { +add_task(function* () { let {inspector} = yield openInspectorForURL(TEST_URL); yield inspector.markup.expandAll(); diff --git a/devtools/client/inspector/markup/test/browser_markup_dragdrop_escapeKeyPress.js b/devtools/client/inspector/markup/test/browser_markup_dragdrop_escapeKeyPress.js index fad442ae73..075d143521 100644 --- a/devtools/client/inspector/markup/test/browser_markup_dragdrop_escapeKeyPress.js +++ b/devtools/client/inspector/markup/test/browser_markup_dragdrop_escapeKeyPress.js @@ -8,7 +8,7 @@ const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html"; -add_task(function*() { +add_task(function* () { let {inspector} = yield openInspectorForURL(TEST_URL); let {markup} = inspector; diff --git a/devtools/client/inspector/markup/test/browser_markup_dragdrop_invalidNodes.js b/devtools/client/inspector/markup/test/browser_markup_dragdrop_invalidNodes.js index f5fc9f5167..9eea6a1027 100644 --- a/devtools/client/inspector/markup/test/browser_markup_dragdrop_invalidNodes.js +++ b/devtools/client/inspector/markup/test/browser_markup_dragdrop_invalidNodes.js @@ -9,7 +9,7 @@ const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html"; const PREF = "devtools.inspector.showAllAnonymousContent"; -add_task(function*() { +add_task(function* () { Services.prefs.setBoolPref(PREF, true); let {inspector} = yield openInspectorForURL(TEST_URL); diff --git a/devtools/client/inspector/markup/test/browser_markup_dragdrop_reorder.js b/devtools/client/inspector/markup/test/browser_markup_dragdrop_reorder.js index 32387fc2b5..0da0084649 100644 --- a/devtools/client/inspector/markup/test/browser_markup_dragdrop_reorder.js +++ b/devtools/client/inspector/markup/test/browser_markup_dragdrop_reorder.js @@ -8,7 +8,7 @@ const TEST_URL = URL_ROOT + "doc_markup_dragdrop.html"; -add_task(function*() { +add_task(function* () { let {inspector} = yield openInspectorForURL(TEST_URL); let ids; diff --git a/devtools/client/inspector/markup/test/browser_markup_dragdrop_tooltip.js b/devtools/client/inspector/markup/test/browser_markup_dragdrop_tooltip.js index 94a4a204d8..13cc2e0cd3 100644 --- a/devtools/client/inspector/markup/test/browser_markup_dragdrop_tooltip.js +++ b/devtools/client/inspector/markup/test/browser_markup_dragdrop_tooltip.js @@ -7,7 +7,7 @@ const TEST_URL = "data:text/html;charset=utf8,changedTag
' - }, - { - selector: "#siblings", - oldHTML: 'changedTag
' +}, { + selector: "#siblings", + oldHTML: '