diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index a43a1d9d0d07..ac3725a2c33d 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 7ba94bddcd75..7592415f568d 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 757d3c4ba36f..b0408d7ad5f8 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 9c639c99e9f4..4982117f2180 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 0040947a0c6a..2aa4ba808e89 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index c5b4722aadca..4dc1ae9eddda 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 757d3c4ba36f..b0408d7ad5f8 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index d732ef24ae75..343d1e6070e2 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 66309292fd93..66a63ec42c45 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "2f093462969d2c5f65dced3908a7abff6b1913e8", + "git_revision": "d069027f9af6f835ef869f1f01b52339e5a3f423", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "f0575fd3300ea98629d27aaa4ea0a11139867033", + "revision": "87642662c7721f18575be17ae42c81782e5f040a", "repo_path": "integration/gaia-central" } diff --git a/b2g/config/nexus-4-kk/sources.xml b/b2g/config/nexus-4-kk/sources.xml index a662858fd6a2..c9358dbdda55 100644 --- a/b2g/config/nexus-4-kk/sources.xml +++ b/b2g/config/nexus-4-kk/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index c12f1c5312c5..807a7a604460 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 96785476c5cb..91fd526f623c 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 72101a1d0084..a89041e9b046 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -5197,8 +5197,10 @@ var TabletModeUpdater = { }; var gTabletModePageCounter = { + enabled: false, inc() { - if (!AppConstants.isPlatformAndVersionAtLeast("win", "10.0")) { + this.enabled = AppConstants.isPlatformAndVersionAtLeast("win", "10.0"); + if (!this.enabled) { this.inc = () => {}; return; } @@ -5214,8 +5216,11 @@ var gTabletModePageCounter = { }, finish() { - Services.telemetry.getKeyedHistogramById("FX_TABLETMODE_PAGE_LOAD").add("tablet", this._tabletCount); - Services.telemetry.getKeyedHistogramById("FX_TABLETMODE_PAGE_LOAD").add("desktop", this._desktopCount); + if (this.enabled) { + let histogram = Services.telemetry.getKeyedHistogramById("FX_TABLETMODE_PAGE_LOAD"); + histogram.add("tablet", this._tabletCount); + histogram.add("desktop", this._desktopCount); + } }, }; diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index e1ce5adf6bd7..98017e91752c 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -4691,6 +4691,9 @@ let hoveredTab = this._hoveredTab; if (hoveredTab) { hoveredTab._mouseleave(); + } + hoveredTab = this.querySelector("tab:hover"); + if (hoveredTab) { hoveredTab._mouseenter(); } ]]> diff --git a/browser/experiments/Experiments.jsm b/browser/experiments/Experiments.jsm index 2a467eb9d309..3c783a85d292 100644 --- a/browser/experiments/Experiments.jsm +++ b/browser/experiments/Experiments.jsm @@ -30,6 +30,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "TelemetryEnvironment", "resource://gre/modules/TelemetryEnvironment.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "TelemetryLog", "resource://gre/modules/TelemetryLog.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "TelemetryUtils", + "resource://gre/modules/TelemetryUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils", "resource://services-common/utils.js"); XPCOMUtils.defineLazyModuleGetter(this, "Metrics", @@ -160,10 +162,6 @@ function loadJSONAsync(file, options) { }); } -function telemetryEnabled() { - return gPrefsTelemetry.get(PREF_TELEMETRY_ENABLED, false); -} - // Returns a promise that is resolved with the AddonInstall for that URL. function addonInstallForURL(url, hash) { let deferred = Promise.defer(); @@ -389,7 +387,7 @@ Experiments.Experiments.prototype = { this._shutdown = false; configureLogging(); - gExperimentsEnabled = gPrefs.get(PREF_ENABLED, false); + gExperimentsEnabled = gPrefs.get(PREF_ENABLED, false) && TelemetryUtils.isTelemetryEnabled; this._log.trace("enabled=" + gExperimentsEnabled + ", " + this.enabled); gPrefs.observe(PREF_LOGGING, configureLogging); @@ -580,7 +578,7 @@ Experiments.Experiments.prototype = { _toggleExperimentsEnabled: Task.async(function* (enabled) { this._log.trace("_toggleExperimentsEnabled(" + enabled + ")"); let wasEnabled = gExperimentsEnabled; - gExperimentsEnabled = enabled && telemetryEnabled(); + gExperimentsEnabled = enabled && TelemetryUtils.isTelemetryEnabled; if (wasEnabled == gExperimentsEnabled) { return; diff --git a/browser/experiments/test/xpcshell/head.js b/browser/experiments/test/xpcshell/head.js index 40eb9aa01a9f..436d9345d3b1 100644 --- a/browser/experiments/test/xpcshell/head.js +++ b/browser/experiments/test/xpcshell/head.js @@ -233,3 +233,7 @@ function replaceExperiments(experiment, list) { }, }); } + +// Experiments require Telemetry to be enabled, and that's not true for debug +// builds. Let's just enable it here instead of going through each test. +Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, true); diff --git a/browser/experiments/test/xpcshell/test_telemetry_disabled.js b/browser/experiments/test/xpcshell/test_telemetry_disabled.js new file mode 100644 index 000000000000..74f85ccfc7e8 --- /dev/null +++ b/browser/experiments/test/xpcshell/test_telemetry_disabled.js @@ -0,0 +1,21 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +Cu.import("resource:///modules/experiments/Experiments.jsm"); + +add_test(function test_experiments_activation() { + do_get_profile(); + loadAddonManager(); + + Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true); + Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, false); + + let experiments = Experiments.instance(); + Assert.ok(!experiments.enabled, "Experiments must be disabled if Telemetry is disabled."); + + // TODO: Test that Experiments are turned back on when bug 1232648 lands. + + run_next_test(); +}); diff --git a/browser/experiments/test/xpcshell/xpcshell.ini b/browser/experiments/test/xpcshell/xpcshell.ini index cf716b9cbd8d..a2d40d3f6be1 100644 --- a/browser/experiments/test/xpcshell/xpcshell.ini +++ b/browser/experiments/test/xpcshell/xpcshell.ini @@ -24,6 +24,7 @@ generated-files = [test_disableExperiments.js] [test_fetch.js] [test_telemetry.js] +[test_telemetry_disabled.js] [test_healthreport.js] [test_previous_provider.js] [test_upgrade.js] diff --git a/browser/themes/windows/pageInfo.css b/browser/themes/windows/pageInfo.css index d125fd93ce92..e7f311f45eac 100644 --- a/browser/themes/windows/pageInfo.css +++ b/browser/themes/windows/pageInfo.css @@ -123,7 +123,7 @@ groupbox.collapsable caption .caption-icon { background-position: center; -moz-margin-start: 2px; -moz-margin-end: 2px; - background-image: url("chrome://global/skin/tree/twisty-open.png"); + background-image: url("chrome://global/skin/tree/twisty.svg#open"); } groupbox.collapsable[closed="true"] { @@ -133,7 +133,7 @@ groupbox.collapsable[closed="true"] { } groupbox.collapsable[closed="true"] caption .caption-icon { - background-image: url("chrome://global/skin/tree/twisty-clsd.png"); + background-image: url("chrome://global/skin/tree/twisty.svg#clsd"); } groupbox tree { diff --git a/devtools/client/framework/test/browser_toolbox_theme_registration.js b/devtools/client/framework/test/browser_toolbox_theme_registration.js index 7612c641a4f0..1afa8434884a 100644 --- a/devtools/client/framework/test/browser_toolbox_theme_registration.js +++ b/devtools/client/framework/test/browser_toolbox_theme_registration.js @@ -2,60 +2,45 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +// Test for dynamically registering and unregistering themes const CHROME_URL = "chrome://mochitests/content/browser/devtools/client/framework/test/"; var toolbox; -function test() -{ - gBrowser.selectedTab = gBrowser.addTab(); - let target = TargetFactory.forTab(gBrowser.selectedTab); +add_task(function* themeRegistration() { + let tab = yield addTab("data:text/html,test"); + let target = TargetFactory.forTab(tab); + toolbox = yield gDevTools.showToolbox(target); - gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) { - gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true); - gDevTools.showToolbox(target).then(testRegister); - }, true); + let themeId = yield new Promise(resolve => { + gDevTools.once("theme-registered", (e, themeId) => { + resolve(themeId); + }); - content.location = "data:text/html,test for dynamically registering and unregistering themes"; -} - -function testRegister(aToolbox) -{ - toolbox = aToolbox - gDevTools.once("theme-registered", themeRegistered); - - gDevTools.registerTheme({ - id: "test-theme", - label: "Test theme", - stylesheets: [CHROME_URL + "doc_theme.css"], - classList: ["theme-test"], + gDevTools.registerTheme({ + id: "test-theme", + label: "Test theme", + stylesheets: [CHROME_URL + "doc_theme.css"], + classList: ["theme-test"], + }); }); -} -function themeRegistered(event, themeId) -{ is(themeId, "test-theme", "theme-registered event handler sent theme id"); ok(gDevTools.getThemeDefinitionMap().has(themeId), "theme added to map"); +}); - // Test that new theme appears in the Options panel - let target = TargetFactory.forTab(gBrowser.selectedTab); - gDevTools.showToolbox(target, "options").then(() => { - let panel = toolbox.getCurrentPanel(); - let doc = panel.panelWin.frameElement.contentDocument; - let themeOption = doc.querySelector("#devtools-theme-box > radio[value=test-theme]"); +add_task(function* themeInOptionsPanel() { - ok(themeOption, "new theme exists in the Options panel"); + yield toolbox.selectTool("options"); - // Apply the new theme. - applyTheme(); - }); -} - -function applyTheme() -{ + let panel = toolbox.getCurrentPanel(); let panelWin = toolbox.getCurrentPanel().panelWin; let doc = panelWin.frameElement.contentDocument; + let themeOption = doc.querySelector("#devtools-theme-box > radio[value=test-theme]"); + + ok(themeOption, "new theme exists in the Options panel"); + let testThemeOption = doc.querySelector("#devtools-theme-box > radio[value=test-theme]"); let lightThemeOption = doc.querySelector("#devtools-theme-box > radio[value=light]"); @@ -65,24 +50,26 @@ function applyTheme() // Select test theme. testThemeOption.click(); + info("Waiting for theme to finish loading"); + yield once(panelWin, "theme-switch-complete"); + color = panelWin.getComputedStyle(testThemeOption).color; is(color, "rgb(255, 0, 0)", "style applied"); // Select light theme lightThemeOption.click(); + info("Waiting for theme to finish loading"); + yield once(panelWin, "theme-switch-complete"); + color = panelWin.getComputedStyle(testThemeOption).color; isnot(color, "rgb(255, 0, 0)", "style unapplied"); // Select test theme again. testThemeOption.click(); +}); - // Then unregister the test theme. - testUnregister(); -} - -function testUnregister() -{ +add_task(function* themeUnregistration() { gDevTools.unregisterTheme("test-theme"); ok(!gDevTools.getThemeDefinitionMap().has("test-theme"), "theme removed from map"); @@ -94,20 +81,9 @@ function testUnregister() // The default light theme must be selected now. is(themeBox.selectedItem, themeBox.querySelector("[value=light]"), "theme light must be selected"); +}); - // Make sure the tab-attaching process is done before we destroy the toolbox. - let target = TargetFactory.forTab(gBrowser.selectedTab); - let actor = target.activeTab.actor; - target.client.attachTab(actor, (response) => { - cleanup(); - }); -} - -function cleanup() -{ - toolbox.destroy().then(function() { - toolbox = null; - gBrowser.removeCurrentTab(); - finish(); - }); -} +add_task(function* cleanup() { + yield toolbox.destroy(); + toolbox = null; +}); diff --git a/devtools/client/jar.mn b/devtools/client/jar.mn index a4f60e52db64..118fb2143a67 100644 --- a/devtools/client/jar.mn +++ b/devtools/client/jar.mn @@ -39,24 +39,24 @@ devtools.jar: content/animationinspector/animation-controller.js (animationinspector/animation-controller.js) content/animationinspector/animation-panel.js (animationinspector/animation-panel.js) content/animationinspector/animation-inspector.xhtml (animationinspector/animation-inspector.xhtml) - content/sourceeditor/codemirror/comment/comment.js (sourceeditor/codemirror/addon/comment/comment.js) - content/sourceeditor/codemirror/edit/trailingspace.js (sourceeditor/codemirror/addon/edit/trailingspace.js) - content/sourceeditor/codemirror/edit/matchbrackets.js (sourceeditor/codemirror/addon/edit/matchbrackets.js) - content/sourceeditor/codemirror/edit/closebrackets.js (sourceeditor/codemirror/addon/edit/closebrackets.js) - content/sourceeditor/codemirror/dialog/dialog.js (sourceeditor/codemirror/addon/dialog/dialog.js) - content/sourceeditor/codemirror/dialog/dialog.css (sourceeditor/codemirror/addon/dialog/dialog.css) - content/sourceeditor/codemirror/fold/foldcode.js (sourceeditor/codemirror/addon/fold/foldcode.js) - content/sourceeditor/codemirror/fold/brace-fold.js (sourceeditor/codemirror/addon/fold/brace-fold.js) - content/sourceeditor/codemirror/fold/comment-fold.js (sourceeditor/codemirror/addon/fold/comment-fold.js) - content/sourceeditor/codemirror/fold/xml-fold.js (sourceeditor/codemirror/addon/fold/xml-fold.js) - content/sourceeditor/codemirror/fold/foldgutter.js (sourceeditor/codemirror/addon/fold/foldgutter.js) - content/sourceeditor/codemirror/hint/show-hint.js (sourceeditor/codemirror/addon/hint/show-hint.js) - content/sourceeditor/codemirror/search/search.js (sourceeditor/codemirror/addon/search/search.js) - content/sourceeditor/codemirror/search/searchcursor.js (sourceeditor/codemirror/addon/search/searchcursor.js) - content/sourceeditor/codemirror/selection/active-line.js (sourceeditor/codemirror/addon/selection/active-line.js) - content/sourceeditor/codemirror/tern/tern.js (sourceeditor/codemirror/addon/tern/tern.js) - content/sourceeditor/codemirror/codemirror.js (sourceeditor/codemirror/lib/codemirror.js) - content/sourceeditor/codemirror/codemirror.css (sourceeditor/codemirror/lib/codemirror.css) + content/sourceeditor/codemirror/addon/comment/comment.js (sourceeditor/codemirror/addon/comment/comment.js) + content/sourceeditor/codemirror/addon/edit/trailingspace.js (sourceeditor/codemirror/addon/edit/trailingspace.js) + content/sourceeditor/codemirror/addon/edit/matchbrackets.js (sourceeditor/codemirror/addon/edit/matchbrackets.js) + content/sourceeditor/codemirror/addon/edit/closebrackets.js (sourceeditor/codemirror/addon/edit/closebrackets.js) + content/sourceeditor/codemirror/addon/dialog/dialog.js (sourceeditor/codemirror/addon/dialog/dialog.js) + content/sourceeditor/codemirror/addon/dialog/dialog.css (sourceeditor/codemirror/addon/dialog/dialog.css) + content/sourceeditor/codemirror/addon/fold/foldcode.js (sourceeditor/codemirror/addon/fold/foldcode.js) + content/sourceeditor/codemirror/addon/fold/brace-fold.js (sourceeditor/codemirror/addon/fold/brace-fold.js) + content/sourceeditor/codemirror/addon/fold/comment-fold.js (sourceeditor/codemirror/addon/fold/comment-fold.js) + content/sourceeditor/codemirror/addon/fold/xml-fold.js (sourceeditor/codemirror/addon/fold/xml-fold.js) + content/sourceeditor/codemirror/addon/fold/foldgutter.js (sourceeditor/codemirror/addon/fold/foldgutter.js) + content/sourceeditor/codemirror/addon/hint/show-hint.js (sourceeditor/codemirror/addon/hint/show-hint.js) + content/sourceeditor/codemirror/addon/search/search.js (sourceeditor/codemirror/addon/search/search.js) + content/sourceeditor/codemirror/addon/search/searchcursor.js (sourceeditor/codemirror/addon/search/searchcursor.js) + content/sourceeditor/codemirror/addon/selection/active-line.js (sourceeditor/codemirror/addon/selection/active-line.js) + content/sourceeditor/codemirror/addon/tern/tern.js (sourceeditor/codemirror/addon/tern/tern.js) + content/sourceeditor/codemirror/lib/codemirror.js (sourceeditor/codemirror/lib/codemirror.js) + content/sourceeditor/codemirror/lib/codemirror.css (sourceeditor/codemirror/lib/codemirror.css) content/sourceeditor/codemirror/mode/javascript.js (sourceeditor/codemirror/mode/javascript.js) content/sourceeditor/codemirror/mode/xml.js (sourceeditor/codemirror/mode/xml.js) content/sourceeditor/codemirror/mode/css.js (sourceeditor/codemirror/mode/css.js) diff --git a/devtools/client/shared/test/browser_theme_switching.js b/devtools/client/shared/test/browser_theme_switching.js index a90569a21ea9..8188e815b370 100644 --- a/devtools/client/shared/test/browser_theme_switching.js +++ b/devtools/client/shared/test/browser_theme_switching.js @@ -7,7 +7,8 @@ var toolbox; add_task(function*() { let target = TargetFactory.forTab(gBrowser.selectedTab); let toolbox = yield gDevTools.showToolbox(target); - let root = toolbox.frame.contentDocument.documentElement; + let doc = toolbox.frame.contentDocument; + let root = doc.documentElement; let platform = root.getAttribute("platform"); let expectedPlatform = getPlatform(); @@ -15,7 +16,24 @@ add_task(function*() { let theme = Services.prefs.getCharPref("devtools.theme"); let className = "theme-" + theme; - ok(root.classList.contains(className), ":root has " + className + " class (current theme)"); + ok(root.classList.contains(className), + ":root has " + className + " class (current theme)"); + + // Convert the xpath result into an array of strings + // like `href="{URL}" type="text/css"` + let sheetsIterator = doc.evaluate("processing-instruction('xml-stylesheet')", + doc, null, XPathResult.ANY_TYPE, null); + let sheetsInDOM = []; + let sheet; + while (sheet = sheetsIterator.iterateNext()) { + sheetsInDOM.push(sheet.data); + } + + let sheetsFromTheme = gDevTools.getThemeDefinition(theme).stylesheets; + info ("Checking for existence of " + sheetsInDOM.length + " sheets"); + for (let sheet of sheetsFromTheme) { + ok(sheetsInDOM.some(s=>s.includes(sheet)), "There is a stylesheet for " + sheet); + } yield toolbox.destroy(); }); diff --git a/devtools/client/shared/theme-switching.js b/devtools/client/shared/theme-switching.js index 00ae124577c9..eee1e09df955 100644 --- a/devtools/client/shared/theme-switching.js +++ b/devtools/client/shared/theme-switching.js @@ -3,8 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ (function() { - const DEVTOOLS_SKIN_URL = "chrome://devtools/skin/"; + const SCROLLBARS_URL = "chrome://devtools/skin/floating-scrollbars-light.css"; let documentElement = document.documentElement; + let devtoolsStyleSheets = new WeakMap(); function forceStyle() { let computedStyle = window.getComputedStyle(documentElement); @@ -19,6 +20,45 @@ documentElement.style.display = display; // Restore } + /* + * Append a new processing instruction and return an object with + * - styleSheet: DOMNode + * - loadPromise: Promise that resolves once the sheets loads or errors + */ + function appendStyleSheet(url) { + let styleSheetAttr = `href="${url}" type="text/css"`; + let styleSheet = document.createProcessingInstruction( + "xml-stylesheet", styleSheetAttr); + let loadPromise = new Promise((resolve, reject) => { + function onload() { + styleSheet.removeEventListener("load", onload); + styleSheet.removeEventListener("error", onerror); + resolve(); + } + function onerror() { + styleSheet.removeEventListener("load", onload); + styleSheet.removeEventListener("error", onerror); + reject("Failed to load theme file " + url); + } + + styleSheet.addEventListener("load", onload); + styleSheet.addEventListener("error", onerror); + }); + document.insertBefore(styleSheet, documentElement); + return {styleSheet, loadPromise}; + } + + /* + * Notify the window that a theme switch finished so tests can check the DOM + */ + function notifyWindow() { + window.dispatchEvent(new CustomEvent("theme-switch-complete", {})); + } + + /* + * Apply all the sheets from `newTheme` and remove all of the sheets + * from `oldTheme` + */ function switchTheme(newTheme, oldTheme) { if (newTheme === oldTheme) { return; @@ -28,8 +68,8 @@ // Unload all theme stylesheets related to the old theme. if (oldThemeDef) { - for (let url of oldThemeDef.stylesheets) { - StylesheetUtils.removeSheet(window, url, "author"); + for (let sheet of devtoolsStyleSheets.get(oldThemeDef) || []) { + sheet.remove(); } } @@ -42,8 +82,17 @@ newThemeDef = gDevTools.getThemeDefinition("light"); } + // Store the sheets in a WeakMap for access later when the theme gets + // unapplied. It's hard to query for processing instructions so this + // is an easy way to access them later without storing a property on + // the window + devtoolsStyleSheets.set(newThemeDef, []); + + let loadEvents = []; for (let url of newThemeDef.stylesheets) { - StylesheetUtils.loadSheet(window, url, "author"); + let {styleSheet,loadPromise} = appendStyleSheet(url); + devtoolsStyleSheets.get(newThemeDef).push(styleSheet); + loadEvents.push(loadPromise); } // Floating scroll-bars like in OSX @@ -53,21 +102,10 @@ // TODO: extensions might want to customize scrollbar styles too. if (!hiddenDOMWindow.matchMedia("(-moz-overlay-scrollbars)").matches) { - let scrollbarsUrl = Services.io.newURI( - DEVTOOLS_SKIN_URL + "floating-scrollbars-light.css", null, null); - if (newTheme == "dark") { - StylesheetUtils.loadSheet( - window, - scrollbarsUrl, - "agent" - ); + StylesheetUtils.loadSheet(window, SCROLLBARS_URL, "agent"); } else if (oldTheme == "dark") { - StylesheetUtils.removeSheet( - window, - scrollbarsUrl, - "agent" - ); + StylesheetUtils.removeSheet(window, SCROLLBARS_URL, "agent"); } forceStyle(); } @@ -92,6 +130,8 @@ // Final notification for further theme-switching related logic. gDevTools.emit("theme-switched", window, newTheme, oldTheme); + + Promise.all(loadEvents).then(notifyWindow, console.error.bind(console)); } function handlePrefChange(event, data) { @@ -101,7 +141,6 @@ } const { classes: Cc, interfaces: Ci, utils: Cu } = Components; - Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://devtools/client/framework/gDevTools.jsm"); const {require} = Components.utils.import("resource://devtools/shared/Loader.jsm", {}); diff --git a/devtools/client/sourceeditor/autocomplete.js b/devtools/client/sourceeditor/autocomplete.js index 4827268c65c9..cebc9372e1b7 100644 --- a/devtools/client/sourceeditor/autocomplete.js +++ b/devtools/client/sourceeditor/autocomplete.js @@ -8,8 +8,8 @@ const cssAutoCompleter = require("devtools/client/sourceeditor/css-autocompleter const { AutocompletePopup } = require("devtools/client/shared/autocomplete-popup"); const CM_TERN_SCRIPTS = [ - "chrome://devtools/content/sourceeditor/codemirror/tern/tern.js", - "chrome://devtools/content/sourceeditor/codemirror/hint/show-hint.js" + "chrome://devtools/content/sourceeditor/codemirror/addon/tern/tern.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/hint/show-hint.js" ]; const autocompleteMap = new WeakMap(); diff --git a/devtools/client/sourceeditor/editor.js b/devtools/client/sourceeditor/editor.js index c3274891b708..592fc003a069 100644 --- a/devtools/client/sourceeditor/editor.js +++ b/devtools/client/sourceeditor/editor.js @@ -47,35 +47,35 @@ const { OS } = Services.appinfo; const CM_STYLES = [ "chrome://devtools/skin/common.css", - "chrome://devtools/content/sourceeditor/codemirror/codemirror.css", - "chrome://devtools/content/sourceeditor/codemirror/dialog/dialog.css", + "chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.css", + "chrome://devtools/content/sourceeditor/codemirror/addon/dialog/dialog.css", "chrome://devtools/content/sourceeditor/codemirror/mozilla.css" ]; const CM_SCRIPTS = [ "chrome://devtools/content/shared/theme-switching.js", - "chrome://devtools/content/sourceeditor/codemirror/codemirror.js", - "chrome://devtools/content/sourceeditor/codemirror/dialog/dialog.js", - "chrome://devtools/content/sourceeditor/codemirror/search/searchcursor.js", - "chrome://devtools/content/sourceeditor/codemirror/search/search.js", - "chrome://devtools/content/sourceeditor/codemirror/edit/matchbrackets.js", - "chrome://devtools/content/sourceeditor/codemirror/edit/closebrackets.js", - "chrome://devtools/content/sourceeditor/codemirror/comment/comment.js", + "chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/dialog/dialog.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/search/searchcursor.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/search/search.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/edit/matchbrackets.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/edit/closebrackets.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/comment/comment.js", "chrome://devtools/content/sourceeditor/codemirror/mode/javascript.js", "chrome://devtools/content/sourceeditor/codemirror/mode/xml.js", "chrome://devtools/content/sourceeditor/codemirror/mode/css.js", "chrome://devtools/content/sourceeditor/codemirror/mode/htmlmixed.js", "chrome://devtools/content/sourceeditor/codemirror/mode/clike.js", - "chrome://devtools/content/sourceeditor/codemirror/selection/active-line.js", - "chrome://devtools/content/sourceeditor/codemirror/edit/trailingspace.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/selection/active-line.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/edit/trailingspace.js", "chrome://devtools/content/sourceeditor/codemirror/keymap/emacs.js", "chrome://devtools/content/sourceeditor/codemirror/keymap/vim.js", "chrome://devtools/content/sourceeditor/codemirror/keymap/sublime.js", - "chrome://devtools/content/sourceeditor/codemirror/fold/foldcode.js", - "chrome://devtools/content/sourceeditor/codemirror/fold/brace-fold.js", - "chrome://devtools/content/sourceeditor/codemirror/fold/comment-fold.js", - "chrome://devtools/content/sourceeditor/codemirror/fold/xml-fold.js", - "chrome://devtools/content/sourceeditor/codemirror/fold/foldgutter.js" + "chrome://devtools/content/sourceeditor/codemirror/addon/fold/foldcode.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/fold/brace-fold.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/fold/comment-fold.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/fold/xml-fold.js", + "chrome://devtools/content/sourceeditor/codemirror/addon/fold/foldgutter.js" ]; const CM_IFRAME = diff --git a/devtools/client/sourceeditor/test/codemirror/codemirror.html b/devtools/client/sourceeditor/test/codemirror/codemirror.html index a8bdebd8dd62..7449f1ce524c 100644 --- a/devtools/client/sourceeditor/test/codemirror/codemirror.html +++ b/devtools/client/sourceeditor/test/codemirror/codemirror.html @@ -3,15 +3,15 @@ CodeMirror: Basic Tests - + - - - - - + + + + + diff --git a/devtools/client/sourceeditor/test/codemirror/vimemacs.html b/devtools/client/sourceeditor/test/codemirror/vimemacs.html index 0c39d90bc794..e3d9ff393107 100644 --- a/devtools/client/sourceeditor/test/codemirror/vimemacs.html +++ b/devtools/client/sourceeditor/test/codemirror/vimemacs.html @@ -3,15 +3,15 @@ CodeMirror: VIM/Emacs tests - + - - - - - + + + + + diff --git a/devtools/client/themes/animationinspector.css b/devtools/client/themes/animationinspector.css index 8ceeda7da406..9d6248336cd1 100644 --- a/devtools/client/themes/animationinspector.css +++ b/devtools/client/themes/animationinspector.css @@ -290,7 +290,7 @@ body { height: 100%; box-sizing: border-box; - --timelime-border-color: var(--theme-body-color); + --timeline-border-color: var(--theme-body-color); --timeline-background-color: var(--theme-splitter-color); /* Iterations of the animation are displayed with a repeating linear-gradient @@ -299,25 +299,25 @@ body { the border of this element */ background-image: linear-gradient(to right, - var(--timelime-border-color) 0, - var(--timelime-border-color) 1px, + var(--timeline-border-color) 0, + var(--timeline-border-color) 1px, transparent 1px, transparent 2px); background-repeat: repeat-x; background-position: -1px 0; - border: 1px solid var(--timelime-border-color); + border: 1px solid var(--timeline-border-color); /* The background color is set independently */ background-color: var(--timeline-background-color); } .animation-timeline .animation .cssanimation { - --timelime-border-color: var(--theme-highlight-lightorange); + --timeline-border-color: var(--theme-highlight-lightorange); --timeline-background-color: var(--theme-contrast-background); } .animation-timeline .animation .csstransition { - --timelime-border-color: var(--theme-highlight-bluegrey); + --timeline-border-color: var(--theme-highlight-bluegrey); --timeline-background-color: var(--theme-highlight-blue); } @@ -369,14 +369,14 @@ body { box-sizing: border-box; height: calc(100% + 2px); - border: 1px solid var(--timelime-border-color); + border: 1px solid var(--timeline-border-color); border-width: 1px 0 1px 1px; background-image: repeating-linear-gradient(45deg, transparent, transparent 1px, var(--theme-selection-color) 1px, var(--theme-selection-color) 4px); - background-color: var(--timelime-border-color); + background-color: var(--timeline-border-color); } .animation-timeline .animation .delay.negative { diff --git a/devtools/client/themes/layoutview.css b/devtools/client/themes/layoutview.css index 125d7f247242..8cef3b4b8e19 100644 --- a/devtools/client/themes/layoutview.css +++ b/devtools/client/themes/layoutview.css @@ -6,7 +6,7 @@ box-sizing: border-box; } -.theme-sidebar body { +body.theme-sidebar { /* The view will grow bigger as the window gets resized, until 400px */ max-width: 400px; margin: 0px auto; diff --git a/devtools/client/webconsole/webconsole.js b/devtools/client/webconsole/webconsole.js index 0641bc7cb9d0..b81e461dde5b 100644 --- a/devtools/client/webconsole/webconsole.js +++ b/devtools/client/webconsole/webconsole.js @@ -194,12 +194,12 @@ const PREF_INPUT_HISTORY_COUNT = "devtools.webconsole.inputHistoryCount"; * implementation. * * @constructor - * @param object aWebConsoleOwner + * @param object webConsoleOwner * The WebConsole owner object. */ -function WebConsoleFrame(aWebConsoleOwner) +function WebConsoleFrame(webConsoleOwner) { - this.owner = aWebConsoleOwner; + this.owner = webConsoleOwner; this.hudId = this.owner.hudId; this.window = this.owner.iframeWindow; @@ -390,13 +390,13 @@ WebConsoleFrame.prototype = { ]; // Make sure the web console client connection is established first. - this.webConsoleClient.getPreferences(toGet, aResponse => { - if (!aResponse.error) { - this._saveRequestAndResponseBodies = aResponse.preferences[toGet[0]]; + this.webConsoleClient.getPreferences(toGet, response => { + if (!response.error) { + this._saveRequestAndResponseBodies = response.preferences[toGet[0]]; deferred.resolve(this._saveRequestAndResponseBodies); } else { - deferred.reject(aResponse.error); + deferred.reject(response.error); } }); @@ -406,30 +406,30 @@ WebConsoleFrame.prototype = { /** * Setter for saving of network request and response bodies. * - * @param boolean aValue + * @param boolean value * The new value you want to set. */ setSaveRequestAndResponseBodies: - function WCF_setSaveRequestAndResponseBodies(aValue) { + function WCF_setSaveRequestAndResponseBodies(value) { if (!this.webConsoleClient) { // Don't continue if the webconsole disconnected. return promise.resolve(null); } let deferred = promise.defer(); - let newValue = !!aValue; + let newValue = !!value; let toSet = { "NetworkMonitor.saveRequestAndResponseBodies": newValue, }; // Make sure the web console client connection is established first. - this.webConsoleClient.setPreferences(toSet, aResponse => { - if (!aResponse.error) { + this.webConsoleClient.setPreferences(toSet, response => { + if (!response.error) { this._saveRequestAndResponseBodies = newValue; - deferred.resolve(aResponse); + deferred.resolve(response); } else { - deferred.reject(aResponse.error); + deferred.reject(response.error); } }); @@ -495,11 +495,11 @@ WebConsoleFrame.prototype = { this.proxy.connect().then(() => { // on success this._initDefer.resolve(this); - }, (aReason) => { // on failure + }, (reason) => { // on failure let node = this.createMessageNode(CATEGORY_JS, SEVERITY_ERROR, - aReason.error + ": " + aReason.message); - this.outputMessage(CATEGORY_JS, node, [aReason]); - this._initDefer.reject(aReason); + reason.error + ": " + reason.message); + this.outputMessage(CATEGORY_JS, node, [reason]); + this._initDefer.reject(reason); }); return this._initDefer.promise; @@ -560,17 +560,17 @@ WebConsoleFrame.prototype = { // calculations. this._updateCharSize(); - let updateSaveBodiesPrefUI = (aElement) => { - this.getSaveRequestAndResponseBodies().then(aValue => { - aElement.setAttribute("checked", aValue); + let updateSaveBodiesPrefUI = (element) => { + this.getSaveRequestAndResponseBodies().then(value => { + element.setAttribute("checked", value); this.emit("save-bodies-ui-toggled"); }); } - let reverseSaveBodiesPref = ({ target: aElement }) => { - this.getSaveRequestAndResponseBodies().then(aValue => { - this.setSaveRequestAndResponseBodies(!aValue); - aElement.setAttribute("checked", aValue); + let reverseSaveBodiesPref = ({ target: element }) => { + this.getSaveRequestAndResponseBodies().then(value => { + this.setSaveRequestAndResponseBodies(!value); + element.setAttribute("checked", value); this.emit("save-bodies-pref-reversed"); }); } @@ -670,19 +670,19 @@ WebConsoleFrame.prototype = { * Attach / detach reflow listeners depending on the checked status * of the `CSS > Log` menuitem. * - * @param function [aCallback=null] + * @param function [callback=null] * Optional function to invoke when the listener has been * added/removed. */ _updateReflowActivityListener: - function WCF__updateReflowActivityListener(aCallback) + function WCF__updateReflowActivityListener(callback) { if (this.webConsoleClient) { let pref = this._filterPrefsPrefix + "csslog"; if (Services.prefs.getBoolPref(pref)) { - this.webConsoleClient.startListeners(["ReflowActivity"], aCallback); + this.webConsoleClient.startListeners(["ReflowActivity"], callback); } else { - this.webConsoleClient.stopListeners(["ReflowActivity"], aCallback); + this.webConsoleClient.stopListeners(["ReflowActivity"], callback); } } }, @@ -692,12 +692,12 @@ WebConsoleFrame.prototype = { * preferences. If the user isn't interested in the server logs at * all the listener is not registered. * - * @param function [aCallback=null] + * @param function [callback=null] * Optional function to invoke when the listener has been * added/removed. */ _updateServerLoggingListener: - function WCF__updateServerLoggingListener(aCallback) + function WCF__updateServerLoggingListener(callback) { if (!this.webConsoleClient) { return; @@ -713,9 +713,9 @@ WebConsoleFrame.prototype = { } if (startListener) { - this.webConsoleClient.startListeners(["ServerLogging"], aCallback); + this.webConsoleClient.startListeners(["ServerLogging"], callback); } else { - this.webConsoleClient.stopListeners(["ServerLogging"], aCallback); + this.webConsoleClient.stopListeners(["ServerLogging"], callback); } }, @@ -755,25 +755,25 @@ WebConsoleFrame.prototype = { { let categories = this.document .querySelectorAll(".webconsole-filter-button[category]"); - Array.forEach(categories, function(aButton) { - aButton.addEventListener("contextmenu", (aEvent) => { - aButton.open = true; + Array.forEach(categories, function(button) { + button.addEventListener("contextmenu", (event) => { + button.open = true; }, false); - aButton.addEventListener("click", this._toggleFilter, false); + button.addEventListener("click", this._toggleFilter, false); let someChecked = false; - let severities = aButton.querySelectorAll("menuitem[prefKey]"); - Array.forEach(severities, function(aMenuItem) { - aMenuItem.addEventListener("command", this._toggleFilter, false); + let severities = button.querySelectorAll("menuitem[prefKey]"); + Array.forEach(severities, function(menuItem) { + menuItem.addEventListener("command", this._toggleFilter, false); - let prefKey = aMenuItem.getAttribute("prefKey"); + let prefKey = menuItem.getAttribute("prefKey"); let checked = this.filterPrefs[prefKey]; - aMenuItem.setAttribute("checked", checked); + menuItem.setAttribute("checked", checked); someChecked = someChecked || checked; }, this); - aButton.setAttribute("checked", someChecked); - aButton.setAttribute("aria-pressed", someChecked); + button.setAttribute("checked", someChecked); + button.setAttribute("aria-pressed", someChecked); }, this); if (!this.owner._browserConsole) { @@ -804,7 +804,7 @@ WebConsoleFrame.prototype = { * The size of the font change. Accepted values are "+" and "-". * An unmatched size assumes a font reset. */ - changeFontSize: function WCF_changeFontSize(aSize) + changeFontSize: function WCF_changeFontSize(size) { let fontSize = this.window .getComputedStyle(this.outputNode, null) @@ -814,10 +814,10 @@ WebConsoleFrame.prototype = { fontSize = this.outputNode.style.fontSize.replace("px", ""); } - if (aSize == "+" || aSize == "-") { + if (size == "+" || size == "-") { fontSize = parseInt(fontSize, 10); - if (aSize == "+") { + if (size == "+") { fontSize += 1; } else { @@ -876,22 +876,22 @@ WebConsoleFrame.prototype = { * off. * * @private - * @param nsIDOMEvent aEvent + * @param nsIDOMEvent event * The event that triggered the filter change. */ - _toggleFilter: function WCF__toggleFilter(aEvent) + _toggleFilter: function WCF__toggleFilter(event) { - let target = aEvent.target; + let target = event.target; let tagName = target.tagName; // Prevent toggle if generated from a contextmenu event (right click) - let isRightClick = (aEvent.button === 2); // right click is button 2; - if (tagName != aEvent.currentTarget.tagName || isRightClick) { + let isRightClick = (event.button === 2); // right click is button 2; + if (tagName != event.currentTarget.tagName || isRightClick) { return; } switch (tagName) { case "toolbarbutton": { - let originalTarget = aEvent.originalTarget; + let originalTarget = event.originalTarget; let classes = originalTarget.classList; if (originalTarget.localName !== "toolbarbutton") { @@ -912,7 +912,7 @@ WebConsoleFrame.prototype = { // Toggle on the targeted filter button, and if the user alt clicked, // toggle off all other filter buttons and their associated filters. let state = target.getAttribute("checked") !== "true"; - if (aEvent.getModifierState("Alt")) { + if (event.getModifierState("Alt")) { let buttons = this.document .querySelectorAll(".webconsole-filter-button"); Array.forEach(buttons, (button) => { @@ -985,34 +985,34 @@ WebConsoleFrame.prototype = { * Set the menu attributes for a specific toggle button. * * @private - * @param XULElement aTarget + * @param XULElement target * Button with drop down items to be toggled. - * @param boolean aState + * @param boolean state * True if the menu item is being toggled on, and false otherwise. */ - _setMenuState: function WCF__setMenuState(aTarget, aState) + _setMenuState: function WCF__setMenuState(target, state) { - let menuItems = aTarget.querySelectorAll("menuitem"); + let menuItems = target.querySelectorAll("menuitem"); Array.forEach(menuItems, (item) => { - item.setAttribute("checked", aState); + item.setAttribute("checked", state); let prefKey = item.getAttribute("prefKey"); - this.setFilterState(prefKey, aState); + this.setFilterState(prefKey, state); }); }, /** * Set the filter state for a specific toggle button. * - * @param string aToggleType - * @param boolean aState + * @param string toggleType + * @param boolean state * @returns void */ - setFilterState: function WCF_setFilterState(aToggleType, aState) + setFilterState: function WCF_setFilterState(toggleType, state) { - this.filterPrefs[aToggleType] = aState; - this.adjustVisibilityForMessageType(aToggleType, aState); + this.filterPrefs[toggleType] = state; + this.adjustVisibilityForMessageType(toggleType, state); - Services.prefs.setBoolPref(this._filterPrefsPrefix + aToggleType, aState); + Services.prefs.setBoolPref(this._filterPrefsPrefix + toggleType, state); if (this._updateListenersTimeout) { Timers.clearTimeout(this._updateListenersTimeout); @@ -1025,12 +1025,12 @@ WebConsoleFrame.prototype = { /** * Get the filter state for a specific toggle button. * - * @param string aToggleType + * @param string toggleType * @returns boolean */ - getFilterState: function WCF_getFilterState(aToggleType) + getFilterState: function WCF_getFilterState(toggleType) { - return this.filterPrefs[aToggleType]; + return this.filterPrefs[toggleType]; }, /** @@ -1045,20 +1045,20 @@ WebConsoleFrame.prototype = { /** * Check that the passed string matches the filter arguments. * - * @param String aString + * @param String str * to search for filter words in. - * @param String aFilter + * @param String filter * is a string containing all of the words to filter on. * @returns boolean */ - stringMatchesFilters: function WCF_stringMatchesFilters(aString, aFilter) + stringMatchesFilters: function WCF_stringMatchesFilters(str, filter) { - if (!aFilter || !aString) { + if (!filter || !str) { return true; } - let searchStr = aString.toLowerCase(); - let filterStrings = aFilter.toLowerCase().split(/\s+/); + let searchStr = str.toLowerCase(); + let filterStrings = filter.toLowerCase().split(/\s+/); return !filterStrings.some(function (f) { return searchStr.indexOf(f) == -1; }); @@ -1066,18 +1066,18 @@ WebConsoleFrame.prototype = { /** * Turns the display of log nodes on and off appropriately to reflect the - * adjustment of the message type filter named by @aPrefKey. + * adjustment of the message type filter named by @prefKey. * - * @param string aPrefKey + * @param string prefKey * The preference key for the message type being filtered: one of the * values in the MESSAGE_PREFERENCE_KEYS table. - * @param boolean aState - * True if the filter named by @aMessageType is being turned on; false + * @param boolean state + * True if the filter named by @messageType is being turned on; false * otherwise. * @returns void */ adjustVisibilityForMessageType: - function WCF_adjustVisibilityForMessageType(aPrefKey, aState) + function WCF_adjustVisibilityForMessageType(prefKey, state) { let outputNode = this.outputNode; let doc = this.document; @@ -1086,16 +1086,16 @@ WebConsoleFrame.prototype = { // (filter="error", filter="cssparser", etc.) and add or remove the // "filtered-by-type" class, which turns on or off the display. - let attribute = WORKERTYPES_PREFKEYS.indexOf(aPrefKey) == -1 + let attribute = WORKERTYPES_PREFKEYS.indexOf(prefKey) == -1 ? 'filter' : 'workerType'; let xpath = ".//*[contains(@class, 'message') and " + - "@" + attribute + "='" + aPrefKey + "']"; + "@" + attribute + "='" + prefKey + "']"; let result = doc.evaluate(xpath, outputNode, null, Ci.nsIDOMXPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (let i = 0; i < result.snapshotLength; i++) { let node = result.snapshotItem(i); - if (aState) { + if (state) { node.classList.remove("filtered-by-type"); } else { @@ -1134,41 +1134,41 @@ WebConsoleFrame.prototype = { * Applies the user's filters to a newly-created message node via CSS * classes. * - * @param nsIDOMNode aNode + * @param nsIDOMNode node * The newly-created message node. * @return boolean * True if the message was filtered or false otherwise. */ - filterMessageNode: function WCF_filterMessageNode(aNode) + filterMessageNode: function WCF_filterMessageNode(node) { let isFiltered = false; // Filter by the message type. - let prefKey = MESSAGE_PREFERENCE_KEYS[aNode.category][aNode.severity]; + let prefKey = MESSAGE_PREFERENCE_KEYS[node.category][node.severity]; if (prefKey && !this.getFilterState(prefKey)) { // The node is filtered by type. - aNode.classList.add("filtered-by-type"); + node.classList.add("filtered-by-type"); isFiltered = true; } // Filter by worker type - if ("workerType" in aNode && !this.getFilterState(aNode.workerType)) { - aNode.classList.add("filtered-by-type"); + if ("workerType" in node && !this.getFilterState(node.workerType)) { + node.classList.add("filtered-by-type"); isFiltered = true; } // Filter on the search string. let search = this.filterBox.value; - let text = aNode.clipboardText; + let text = node.clipboardText; // if string matches the filter text if (!this.stringMatchesFilters(text, search)) { - aNode.classList.add("filtered-by-string"); + node.classList.add("filtered-by-string"); isFiltered = true; } - if (isFiltered && aNode.classList.contains("inlined-variables-view")) { - aNode.classList.add("hidden-message"); + if (isFiltered && node.classList.contains("inlined-variables-view")) { + node.classList.add("hidden-message"); } return isFiltered; @@ -1176,17 +1176,17 @@ WebConsoleFrame.prototype = { /** * Merge the attributes of the two nodes that are about to be filtered. - * Increment the number of repeats of aOriginal. + * Increment the number of repeats of original. * - * @param nsIDOMNode aOriginal + * @param nsIDOMNode original * The Original Node. The one being merged into. - * @param nsIDOMNode aFiltered + * @param nsIDOMNode filtered * The node being filtered out because it is repeated. */ mergeFilteredMessageNode: - function WCF_mergeFilteredMessageNode(aOriginal, aFiltered) + function WCF_mergeFilteredMessageNode(original, filtered) { - let repeatNode = aOriginal.getElementsByClassName("message-repeats")[0]; + let repeatNode = original.getElementsByClassName("message-repeats")[0]; if (!repeatNode) { return; // no repeat node, return early. } @@ -1203,15 +1203,15 @@ WebConsoleFrame.prototype = { * Filter the message node from the output if it is a repeat. * * @private - * @param nsIDOMNode aNode + * @param nsIDOMNode node * The message node to be filtered or not. * @returns nsIDOMNode|null * Returns the duplicate node if the message was filtered, null * otherwise. */ - _filterRepeatedMessage: function WCF__filterRepeatedMessage(aNode) + _filterRepeatedMessage: function WCF__filterRepeatedMessage(node) { - let repeatNode = aNode.getElementsByClassName("message-repeats")[0]; + let repeatNode = node.getElementsByClassName("message-repeats")[0]; if (!repeatNode) { return null; } @@ -1219,17 +1219,17 @@ WebConsoleFrame.prototype = { let uid = repeatNode._uid; let dupeNode = null; - if (aNode.category == CATEGORY_CSS || - aNode.category == CATEGORY_SECURITY) { + if (node.category == CATEGORY_CSS || + node.category == CATEGORY_SECURITY) { dupeNode = this._repeatNodes[uid]; if (!dupeNode) { - this._repeatNodes[uid] = aNode; + this._repeatNodes[uid] = node; } } - else if ((aNode.category == CATEGORY_WEBDEV || - aNode.category == CATEGORY_JS) && - aNode.category != CATEGORY_NETWORK && - !aNode.classList.contains("inlined-variables-view")) { + else if ((node.category == CATEGORY_WEBDEV || + node.category == CATEGORY_JS) && + node.category != CATEGORY_NETWORK && + !node.classList.contains("inlined-variables-view")) { let lastMessage = this.outputNode.lastChild; if (!lastMessage) { return null; @@ -1242,7 +1242,7 @@ WebConsoleFrame.prototype = { } if (dupeNode) { - this.mergeFilteredMessageNode(dupeNode, aNode); + this.mergeFilteredMessageNode(dupeNode, node); return dupeNode; } @@ -1253,33 +1253,33 @@ WebConsoleFrame.prototype = { * Display cached messages that may have been collected before the UI is * displayed. * - * @param array aRemoteMessages + * @param array remoteMessages * Array of cached messages coming from the remote Web Console * content instance. */ - displayCachedMessages: function WCF_displayCachedMessages(aRemoteMessages) + displayCachedMessages: function WCF_displayCachedMessages(remoteMessages) { - if (!aRemoteMessages.length) { + if (!remoteMessages.length) { return; } - aRemoteMessages.forEach(function(aMessage) { - switch (aMessage._type) { + remoteMessages.forEach(function(message) { + switch (message._type) { case "PageError": { - let category = Utils.categoryForScriptError(aMessage); + let category = Utils.categoryForScriptError(message); this.outputMessage(category, this.reportPageError, - [category, aMessage]); + [category, message]); break; } case "LogMessage": - this.handleLogMessage(aMessage); + this.handleLogMessage(message); break; case "ConsoleAPI": this.outputMessage(CATEGORY_WEBDEV, this.logConsoleAPIMessage, - [aMessage]); + [message]); break; case "NetworkEvent": - this.outputMessage(CATEGORY_NETWORK, this.logNetEvent, [aMessage]); + this.outputMessage(CATEGORY_NETWORK, this.logNetEvent, [message]); break; } }, this); @@ -1289,26 +1289,26 @@ WebConsoleFrame.prototype = { * Logs a message to the Web Console that originates from the Web Console * server. * - * @param object aMessage + * @param object message * The message received from the server. * @return nsIDOMElement|null * The message element to display in the Web Console output. */ - logConsoleAPIMessage: function WCF_logConsoleAPIMessage(aMessage) + logConsoleAPIMessage: function WCF_logConsoleAPIMessage(message) { let body = null; let clipboardText = null; - let sourceURL = aMessage.filename; - let sourceLine = aMessage.lineNumber; - let level = aMessage.level; - let args = aMessage.arguments; + let sourceURL = message.filename; + let sourceLine = message.lineNumber; + let level = message.level; + let args = message.arguments; let objectActors = new Set(); let node = null; // Gather the actor IDs. - args.forEach((aValue) => { - if (WebConsoleUtils.isActorGrip(aValue)) { - objectActors.add(aValue.actor); + args.forEach((value) => { + if (WebConsoleUtils.isActorGrip(value)) { + objectActors.add(value.actor); } }); @@ -1320,37 +1320,37 @@ WebConsoleFrame.prototype = { case "exception": case "assert": case "debug": { - let msg = new Messages.ConsoleGeneric(aMessage); + let msg = new Messages.ConsoleGeneric(message); node = msg.init(this.output).render().element; break; } case "table": { - let msg = new Messages.ConsoleTable(aMessage); + let msg = new Messages.ConsoleTable(message); node = msg.init(this.output).render().element; break; } case "trace": { - let msg = new Messages.ConsoleTrace(aMessage); + let msg = new Messages.ConsoleTrace(message); node = msg.init(this.output).render().element; break; } case "dir": { body = { arguments: args }; let clipboardArray = []; - args.forEach((aValue) => { - clipboardArray.push(VariablesView.getString(aValue)); + args.forEach((value) => { + clipboardArray.push(VariablesView.getString(value)); }); clipboardText = clipboardArray.join(" "); break; } case "dirxml": { // We just alias console.dirxml() with console.log(). - aMessage.level = "log"; - return WCF_logConsoleAPIMessage.call(this, aMessage); + message.level = "log"; + return WCF_logConsoleAPIMessage.call(this, message); } case "group": case "groupCollapsed": - clipboardText = body = aMessage.groupName; + clipboardText = body = message.groupName; this.groupDepth++; break; @@ -1361,7 +1361,7 @@ WebConsoleFrame.prototype = { break; case "time": { - let timer = aMessage.timer; + let timer = message.timer; if (!timer) { return null; } @@ -1375,7 +1375,7 @@ WebConsoleFrame.prototype = { } case "timeEnd": { - let timer = aMessage.timer; + let timer = message.timer; if (!timer) { return null; } @@ -1386,7 +1386,7 @@ WebConsoleFrame.prototype = { } case "count": { - let counter = aMessage.counter; + let counter = message.counter; if (!counter) { return null; } @@ -1394,7 +1394,7 @@ WebConsoleFrame.prototype = { Cu.reportError(l10n.getStr(counter.error)); return null; } - let msg = new Messages.ConsoleGeneric(aMessage); + let msg = new Messages.ConsoleGeneric(message); node = msg.init(this.output).render().element; break; } @@ -1431,8 +1431,8 @@ WebConsoleFrame.prototype = { if (!node) { node = this.createMessageNode(CATEGORY_WEBDEV, LEVELS[level], body, sourceURL, sourceLine, clipboardText, - level, aMessage.timeStamp); - if (aMessage.private) { + level, message.timeStamp); + if (message.private) { node.setAttribute("private", true); } } @@ -1446,7 +1446,7 @@ WebConsoleFrame.prototype = { } } - let workerTypeID = CONSOLE_WORKER_IDS.indexOf(aMessage.workerType); + let workerTypeID = CONSOLE_WORKER_IDS.indexOf(message.workerType); if (workerTypeID != -1) { node.workerType = WORKERTYPES_PREFKEYS[workerTypeID]; node.setAttribute('workerType', WORKERTYPES_PREFKEYS[workerTypeID]); @@ -1459,65 +1459,67 @@ WebConsoleFrame.prototype = { * Handle ConsoleAPICall objects received from the server. This method outputs * the window.console API call. * - * @param object aMessage + * @param object message * The console API message received from the server. */ - handleConsoleAPICall: function WCF_handleConsoleAPICall(aMessage) + handleConsoleAPICall: function WCF_handleConsoleAPICall(message) { - this.outputMessage(CATEGORY_WEBDEV, this.logConsoleAPIMessage, [aMessage]); + this.outputMessage(CATEGORY_WEBDEV, this.logConsoleAPIMessage, [message]); }, /** * Reports an error in the page source, either JavaScript or CSS. * - * @param nsIScriptError aScriptError + * @param nsIScriptError scriptError * The error message to report. * @return nsIDOMElement|undefined * The message element to display in the Web Console output. */ - reportPageError: function WCF_reportPageError(aCategory, aScriptError) + reportPageError: function WCF_reportPageError(category, scriptError) { // Warnings and legacy strict errors become warnings; other types become // errors. let severity = 'error'; - if (aScriptError.warning || aScriptError.strict) { + if (scriptError.warning || scriptError.strict) { severity = 'warning'; - } else if (aScriptError.info) { + } else if (scriptError.info) { severity = 'log'; } - let category = 'js'; - switch(aCategory) { + switch(category) { case CATEGORY_CSS: category = 'css'; break; case CATEGORY_SECURITY: category = 'security'; break; + default: + category = "js"; + break; } let objectActors = new Set(); // Gather the actor IDs. for (let prop of ["errorMessage", "lineText"]) { - let grip = aScriptError[prop]; + let grip = scriptError[prop]; if (WebConsoleUtils.isActorGrip(grip)) { objectActors.add(grip.actor); } } - let errorMessage = aScriptError.errorMessage; + let errorMessage = scriptError.errorMessage; if (errorMessage.type && errorMessage.type == "longString") { errorMessage = errorMessage.initial; } - let displayOrigin = aScriptError.sourceName; + let displayOrigin = scriptError.sourceName; // TLS errors are related to the connection and not the resource; therefore // it makes sense to only display the protcol, host and port (prePath). // This also means messages are grouped for a single origin. - if (aScriptError.category && aScriptError.category == "SHA-1 Signature") { - let sourceURI = Services.io.newURI(aScriptError.sourceName, null, null).QueryInterface(Ci.nsIURL); + if (scriptError.category && scriptError.category == "SHA-1 Signature") { + let sourceURI = Services.io.newURI(scriptError.sourceName, null, null).QueryInterface(Ci.nsIURL); displayOrigin = sourceURI.prePath; } @@ -1525,14 +1527,14 @@ WebConsoleFrame.prototype = { let msg = new Messages.Simple(errorMessage, { location: { url: displayOrigin, - line: aScriptError.lineNumber, - column: aScriptError.columnNumber + line: scriptError.lineNumber, + column: scriptError.columnNumber }, - stack: aScriptError.stacktrace, + stack: scriptError.stacktrace, category: category, severity: severity, - timestamp: aScriptError.timeStamp, - private: aScriptError.private, + timestamp: scriptError.timeStamp, + private: scriptError.private, filterDuplicates: true }); @@ -1541,7 +1543,7 @@ WebConsoleFrame.prototype = { // Select the body of the message node that is displayed in the console let msgBody = node.getElementsByClassName("message-body")[0]; // Add the more info link node to messages that belong to certain categories - this.addMoreInfoLink(msgBody, aScriptError); + this.addMoreInfoLink(msgBody, scriptError); if (objectActors.size > 0) { node._objectActors = objectActors; @@ -1554,26 +1556,26 @@ WebConsoleFrame.prototype = { * Handle PageError objects received from the server. This method outputs the * given error. * - * @param nsIScriptError aPageError + * @param nsIScriptError pageError * The error received from the server. */ - handlePageError: function WCF_handlePageError(aPageError) + handlePageError: function WCF_handlePageError(pageError) { - let category = Utils.categoryForScriptError(aPageError); - this.outputMessage(category, this.reportPageError, [category, aPageError]); + let category = Utils.categoryForScriptError(pageError); + this.outputMessage(category, this.reportPageError, [category, pageError]); }, /** * Handle log messages received from the server. This method outputs the given * message. * - * @param object aPacket + * @param object packet * The message packet received from the server. */ - handleLogMessage: function WCF_handleLogMessage(aPacket) + handleLogMessage: function WCF_handleLogMessage(packet) { - if (aPacket.message) { - this.outputMessage(CATEGORY_JS, this._reportLogMessage, [aPacket]); + if (packet.message) { + this.outputMessage(CATEGORY_JS, this._reportLogMessage, [packet]); } }, @@ -1581,21 +1583,21 @@ WebConsoleFrame.prototype = { * Display log messages received from the server. * * @private - * @param object aPacket + * @param object packet * The message packet received from the server. * @return nsIDOMElement * The message element to render for the given log message. */ - _reportLogMessage: function WCF__reportLogMessage(aPacket) + _reportLogMessage: function WCF__reportLogMessage(packet) { - let msg = aPacket.message; + let msg = packet.message; if (msg.type && msg.type == "longString") { msg = msg.initial; } let node = this.createMessageNode(CATEGORY_JS, SEVERITY_LOG, msg, null, - null, null, null, aPacket.timeStamp); - if (WebConsoleUtils.isActorGrip(aPacket.message)) { - node._objectActors = new Set([aPacket.message.actor]); + null, null, null, packet.timeStamp); + if (WebConsoleUtils.isActorGrip(packet.message)) { + node._objectActors = new Set([packet.message.actor]); } return node; }, @@ -1688,10 +1690,10 @@ WebConsoleFrame.prototype = { /** * Create a mixed content warning Node. * - * @param aLinkNode + * @param linkNode * Parent to the requested urlNode. */ - makeMixedContentNode: function WCF_makeMixedContentNode(aLinkNode) + makeMixedContentNode: function WCF_makeMixedContentNode(linkNode) { let mixedContentWarning = "[" + l10n.getStr("webConsoleMixedContentWarning") + "]"; @@ -1703,10 +1705,10 @@ WebConsoleFrame.prototype = { mixedContentWarningNode.textContent = mixedContentWarning; mixedContentWarningNode.draggable = false; - aLinkNode.appendChild(mixedContentWarningNode); + linkNode.appendChild(mixedContentWarningNode); - this._addMessageLinkCallback(mixedContentWarningNode, (aEvent) => { - aEvent.stopPropagation(); + this._addMessageLinkCallback(mixedContentWarningNode, (event) => { + event.stopPropagation(); this.owner.openLink(MIXED_CONTENT_LEARN_MORE); }); }, @@ -1715,15 +1717,15 @@ WebConsoleFrame.prototype = { * Adds a more info link node to messages based on the nsIScriptError object * that we need to report to the console * - * @param aNode + * @param node * The node to which we will be adding the more info link node - * @param aScriptError + * @param scriptError * The script error object that we are reporting to the console */ - addMoreInfoLink: function WCF_addMoreInfoLink(aNode, aScriptError) + addMoreInfoLink: function WCF_addMoreInfoLink(node, scriptError) { let url; - switch (aScriptError.category) { + switch (scriptError.category) { case "Insecure Password Field": url = INSECURE_PASSWORDS_LEARN_MORE; break; @@ -1748,7 +1750,7 @@ WebConsoleFrame.prototype = { return; } - this.addLearnMoreWarningNode(aNode, url); + this.addLearnMoreWarningNode(node, url); }, /* @@ -1756,55 +1758,55 @@ WebConsoleFrame.prototype = { * as a parameter to the function. When a user clicks on the appended * warning node, the browser navigates to the provided url. * - * @param aNode + * @param node * The node to which we will be adding a clickable warning node. - * @param aURL + * @param url * The url which points to the page where the user can learn more * about security issues associated with the specific message that's * being logged. */ addLearnMoreWarningNode: - function WCF_addLearnMoreWarningNode(aNode, aURL) + function WCF_addLearnMoreWarningNode(node, url) { let moreInfoLabel = "[" + l10n.getStr("webConsoleMoreInfoLabel") + "]"; let warningNode = this.document.createElementNS(XHTML_NS, "a"); - warningNode.title = aURL; - warningNode.href = aURL; + warningNode.title = url; + warningNode.href = url; warningNode.draggable = false; warningNode.textContent = moreInfoLabel; warningNode.className = "learn-more-link"; - this._addMessageLinkCallback(warningNode, (aEvent) => { - aEvent.stopPropagation(); - this.owner.openLink(aURL); + this._addMessageLinkCallback(warningNode, (event) => { + event.stopPropagation(); + this.owner.openLink(url); }); - aNode.appendChild(warningNode); + node.appendChild(warningNode); }, /** * Log file activity. * - * @param string aFileURI + * @param string fileURI * The file URI that was loaded. * @return nsIDOMElement|undefined * The message element to display in the Web Console output. */ - logFileActivity: function WCF_logFileActivity(aFileURI) + logFileActivity: function WCF_logFileActivity(fileURI) { let urlNode = this.document.createElementNS(XHTML_NS, "a"); - urlNode.setAttribute("title", aFileURI); + urlNode.setAttribute("title", fileURI); urlNode.className = "url"; - urlNode.textContent = aFileURI; + urlNode.textContent = fileURI; urlNode.draggable = false; - urlNode.href = aFileURI; + urlNode.href = fileURI; let outputNode = this.createMessageNode(CATEGORY_NETWORK, SEVERITY_LOG, - urlNode, null, null, aFileURI); + urlNode, null, null, fileURI); this._addMessageLinkCallback(urlNode, () => { - this.owner.viewSource(aFileURI); + this.owner.viewSource(fileURI); }); return outputNode; @@ -1813,23 +1815,23 @@ WebConsoleFrame.prototype = { /** * Handle the file activity messages coming from the remote Web Console. * - * @param string aFileURI + * @param string fileURI * The file URI that was requested. */ - handleFileActivity: function WCF_handleFileActivity(aFileURI) + handleFileActivity: function WCF_handleFileActivity(fileURI) { - this.outputMessage(CATEGORY_NETWORK, this.logFileActivity, [aFileURI]); + this.outputMessage(CATEGORY_NETWORK, this.logFileActivity, [fileURI]); }, /** * Handle the reflow activity messages coming from the remote Web Console. * - * @param object aMessage + * @param object msg * An object holding information about a reflow batch. */ - logReflowActivity: function WCF_logReflowActivity(aMessage) + logReflowActivity: function WCF_logReflowActivity(message) { - let {start, end, sourceURL, sourceLine} = aMessage; + let {start, end, sourceURL, sourceLine} = message; let duration = Math.round((end - start) * 100) / 100; let node = this.document.createElementNS(XHTML_NS, "span"); if (sourceURL) { @@ -1838,7 +1840,7 @@ WebConsoleFrame.prototype = { a.href = "#"; a.draggable = "false"; let filename = WebConsoleUtils.abbreviateSourceURL(sourceURL); - let functionName = aMessage.functionName || l10n.getStr("stacktrace.anonymousFunction"); + let functionName = message.functionName || l10n.getStr("stacktrace.anonymousFunction"); a.textContent = l10n.getFormatStr("reflow.messageLinkText", [functionName, filename, sourceLine]); this._addMessageLinkCallback(a, () => { @@ -1852,9 +1854,9 @@ WebConsoleFrame.prototype = { }, - handleReflowActivity: function WCF_handleReflowActivity(aMessage) + handleReflowActivity: function WCF_handleReflowActivity(message) { - this.outputMessage(CATEGORY_CSS, this.logReflowActivity, [aMessage]); + this.outputMessage(CATEGORY_CSS, this.logReflowActivity, [message]); }, /** @@ -1911,14 +1913,14 @@ WebConsoleFrame.prototype = { * given a network event actor ID. * * @private - * @param string aActorId + * @param string actorId * The network event actor ID for which you want to update the message. * @return boolean * |true| if the message node was updated, or |false| otherwise. */ - _updateNetMessage: function WCF__updateNetMessage(aActorId) + _updateNetMessage: function WCF__updateNetMessage(actorId) { - let networkInfo = this.webConsoleClient.getNetworkRequest(aActorId); + let networkInfo = this.webConsoleClient.getNetworkRequest(actorId); if (!networkInfo || !networkInfo.node) { return; } @@ -1985,32 +1987,32 @@ WebConsoleFrame.prototype = { /** * Handler for page location changes. * - * @param string aURI + * @param string uri * New page location. - * @param string aTitle + * @param string title * New page title. */ - onLocationChange: function WCF_onLocationChange(aURI, aTitle) + onLocationChange: function WCF_onLocationChange(uri, title) { - this.contentLocation = aURI; + this.contentLocation = uri; if (this.owner.onLocationChange) { - this.owner.onLocationChange(aURI, aTitle); + this.owner.onLocationChange(uri, title); } }, /** * Handler for the tabNavigated notification. * - * @param string aEvent + * @param string event * Event name. - * @param object aPacket + * @param object packet * Notification packet received from the server. */ - handleTabNavigated: function WCF_handleTabNavigated(aEvent, aPacket) + handleTabNavigated: function WCF_handleTabNavigated(event, packet) { - if (aEvent == "will-navigate") { + if (event == "will-navigate") { if (this.persistLog) { - let marker = new Messages.NavigationMarker(aPacket, Date.now()); + let marker = new Messages.NavigationMarker(packet, Date.now()); this.output.addMessage(marker); } else { @@ -2018,11 +2020,11 @@ WebConsoleFrame.prototype = { } } - if (aPacket.url) { - this.onLocationChange(aPacket.url, aPacket.title); + if (packet.url) { + this.onLocationChange(packet.url, packet.title); } - if (aEvent == "navigate" && !aPacket.nativeConsoleAPI) { + if (event == "navigate" && !packet.nativeConsoleAPI) { this.logWarningAboutReplacedAPI(); } }, @@ -2034,20 +2036,20 @@ WebConsoleFrame.prototype = { * Note: this call is async - the given message node may not be displayed when * you call this method. * - * @param integer aCategory + * @param integer category * The category of the message you want to output. See the CATEGORY_* * constants. - * @param function|nsIDOMElement aMethodOrNode + * @param function|nsIDOMElement methodOrNode * The method that creates the message element to send to the output or * the actual element. If a method is given it will be bound to the HUD - * object and the arguments will be |aArguments|. - * @param array [aArguments] + * object and the arguments will be |args|. + * @param array [args] * If a method is given to output the message element then the method * will be invoked with the list of arguments given here. The last * object in this array should be the packet received from the * back end. */ - outputMessage: function WCF_outputMessage(aCategory, aMethodOrNode, aArguments) + outputMessage: function WCF_outputMessage(category, methodOrNode, args) { if (!this._outputQueue.length) { // If the queue is empty we consider that now was the last output flush. @@ -2055,7 +2057,7 @@ WebConsoleFrame.prototype = { this._lastOutputFlush = Date.now(); } - this._outputQueue.push([aCategory, aMethodOrNode, aArguments]); + this._outputQueue.push([category, methodOrNode, args]); this._initOutputTimer(); }, @@ -2146,8 +2148,8 @@ WebConsoleFrame.prototype = { } let categories = Object.keys(this._pruneCategoriesQueue); - categories.forEach(function _pruneOutput(aCategory) { - removedNodes += this.pruneOutputIfNecessary(aCategory); + categories.forEach(function _pruneOutput(category) { + removedNodes += this.pruneOutputIfNecessary(category); }, this); this._pruneCategoriesQueue = {}; } @@ -2211,9 +2213,9 @@ WebConsoleFrame.prototype = { * Output a message from the queue. * * @private - * @param nsISupportsString aHudIdSupportsString + * @param nsISupportsString hudIdSupportsString * The HUD ID as an nsISupportsString. - * @param array aItem + * @param array item * An item from the output queue - this item represents a message. * @return object * An object that holds the following properties: @@ -2223,9 +2225,9 @@ WebConsoleFrame.prototype = { * - visible: boolean that tells if the message is visible. */ _outputMessageFromQueue: - function WCF__outputMessageFromQueue(aHudIdSupportsString, aItem) + function WCF__outputMessageFromQueue(hudIdSupportsString, item) { - let [category, methodOrNode, args] = aItem; + let [category, methodOrNode, args] = item; // The last object in the args array should be message // object or response packet received from the server. @@ -2254,7 +2256,7 @@ WebConsoleFrame.prototype = { this._pruneCategoriesQueue[node.category] = true; let nodeID = node.getAttribute("id"); - Services.obs.notifyObservers(aHudIdSupportsString, + Services.obs.notifyObservers(hudIdSupportsString, "web-console-message-created", nodeID); } @@ -2282,12 +2284,12 @@ WebConsoleFrame.prototype = { let nodes = {}; // Group the messages per category. - this._outputQueue.forEach(function(aItem, aIndex) { - let [category] = aItem; + this._outputQueue.forEach(function(item, index) { + let [category] = item; if (!(category in nodes)) { nodes[category] = []; } - nodes[category].push(aIndex); + nodes[category].push(index); }, this); let pruned = 0; @@ -2314,15 +2316,15 @@ WebConsoleFrame.prototype = { * after all. * * @private - * @param array aItem + * @param array item * The item you want to destroy. Does not remove it from the output * queue. */ - _destroyItem: function WCF__destroyItem(aItem) + _destroyItem: function WCF__destroyItem(item) { // TODO: handle object releasing in a more elegant way once all console // messages use the new API - bug 778766. - let [category, methodOrNode, args] = aItem; + let [category, methodOrNode, args] = item; if (typeof methodOrNode != "function" && methodOrNode._objectActors) { for (let actor of methodOrNode._objectActors) { this._releaseObject(actor); @@ -2358,9 +2360,9 @@ WebConsoleFrame.prototype = { } else if (category == CATEGORY_WEBDEV && methodOrNode == this.logConsoleAPIMessage) { - args[0].arguments.forEach((aValue) => { - if (WebConsoleUtils.isActorGrip(aValue)) { - this._releaseObject(aValue.actor); + args[0].arguments.forEach((value) => { + if (WebConsoleUtils.isActorGrip(value)) { + this._releaseObject(value.actor); } }); } @@ -2383,19 +2385,19 @@ WebConsoleFrame.prototype = { }, /** - * Ensures that the number of message nodes of type aCategory don't exceed that + * Ensures that the number of message nodes of type category don't exceed that * category's line limit by removing old messages as needed. * - * @param integer aCategory + * @param integer category * The category of message nodes to prune if needed. * @return number * The number of removed nodes. */ - pruneOutputIfNecessary: function WCF_pruneOutputIfNecessary(aCategory) + pruneOutputIfNecessary: function WCF_pruneOutputIfNecessary(category) { - let logLimit = Utils.logLimitForCategory(aCategory); + let logLimit = Utils.logLimitForCategory(category); let messageNodes = this.outputNode.querySelectorAll(".message[category=" + - CATEGORY_CLASS_FRAGMENTS[aCategory] + "]"); + CATEGORY_CLASS_FRAGMENTS[category] + "]"); let n = Math.max(0, messageNodes.length - logLimit); [...messageNodes].slice(0, n).forEach(this.removeOutputMessage, this); return n; @@ -2404,67 +2406,67 @@ WebConsoleFrame.prototype = { /** * Remove a given message from the output. * - * @param nsIDOMNode aNode + * @param nsIDOMNode node * The message node you want to remove. */ - removeOutputMessage: function WCF_removeOutputMessage(aNode) + removeOutputMessage: function WCF_removeOutputMessage(node) { - if (aNode._messageObject) { - aNode._messageObject.destroy(); + if (node._messageObject) { + node._messageObject.destroy(); } - if (aNode._objectActors) { - for (let actor of aNode._objectActors) { + if (node._objectActors) { + for (let actor of node._objectActors) { this._releaseObject(actor); } - aNode._objectActors.clear(); + node._objectActors.clear(); } - if (aNode.category == CATEGORY_CSS || - aNode.category == CATEGORY_SECURITY) { - let repeatNode = aNode.getElementsByClassName("message-repeats")[0]; + if (node.category == CATEGORY_CSS || + node.category == CATEGORY_SECURITY) { + let repeatNode = node.getElementsByClassName("message-repeats")[0]; if (repeatNode && repeatNode._uid) { delete this._repeatNodes[repeatNode._uid]; } } - else if (aNode._connectionId && - aNode.category == CATEGORY_NETWORK) { - this.webConsoleClient.removeNetworkRequest(aNode._connectionId); - this._releaseObject(aNode._connectionId); + else if (node._connectionId && + node.category == CATEGORY_NETWORK) { + this.webConsoleClient.removeNetworkRequest(node._connectionId); + this._releaseObject(node._connectionId); } - else if (aNode.classList.contains("inlined-variables-view")) { - let view = aNode._variablesView; + else if (node.classList.contains("inlined-variables-view")) { + let view = node._variablesView; if (view) { view.controller.releaseActors(); } - aNode._variablesView = null; + node._variablesView = null; } - aNode.remove(); + node.remove(); }, /** * Given a category and message body, creates a DOM node to represent an * incoming message. The timestamp is automatically added. * - * @param number aCategory + * @param number category * The category of the message: one of the CATEGORY_* constants. - * @param number aSeverity + * @param number severity * The severity of the message: one of the SEVERITY_* constants; - * @param string|nsIDOMNode aBody + * @param string|nsIDOMNode body * The body of the message, either a simple string or a DOM node. - * @param string aSourceURL [optional] + * @param string sourceURL [optional] * The URL of the source file that emitted the error. - * @param number aSourceLine [optional] + * @param number sourceLine [optional] * The line number on which the error occurred. If zero or omitted, * there is no line number associated with this message. - * @param string aClipboardText [optional] + * @param string clipboardText [optional] * The text that should be copied to the clipboard when this node is - * copied. If omitted, defaults to the body text. If `aBody` is not + * copied. If omitted, defaults to the body text. If `body` is not * a string, then the clipboard text must be supplied. - * @param number aLevel [optional] + * @param number level [optional] * The level of the console API message. - * @param number aTimeStamp [optional] + * @param number timestamp [optional] * The timestamp to use for this message node. If omitted, the current * date and time is used. * @return nsIDOMNode @@ -2472,11 +2474,11 @@ WebConsoleFrame.prototype = { * output node. */ createMessageNode: - function WCF_createMessageNode(aCategory, aSeverity, aBody, aSourceURL, - aSourceLine, aClipboardText, aLevel, aTimeStamp) + function WCF_createMessageNode(category, severity, body, sourceURL, + sourceLine, clipboardText, level, timestamp) { - if (typeof aBody != "string" && aClipboardText == null && aBody.innerText) { - aClipboardText = aBody.innerText; + if (typeof body != "string" && clipboardText == null && body.innerText) { + clipboardText = body.innerText; } let indentNode = this.document.createElementNS(XHTML_NS, "span"); @@ -2497,53 +2499,53 @@ WebConsoleFrame.prototype = { bodyNode.className = "message-body-wrapper message-body devtools-monospace"; // Store the body text, since it is needed later for the variables view. - let body = aBody; + let storedBody = body; // If a string was supplied for the body, turn it into a DOM node and an // associated clipboard string now. - aClipboardText = aClipboardText || - (aBody + (aSourceURL ? " @ " + aSourceURL : "") + - (aSourceLine ? ":" + aSourceLine : "")); + clipboardText = clipboardText || + (body + (sourceURL ? " @ " + sourceURL : "") + + (sourceLine ? ":" + sourceLine : "")); - let timestamp = aTimeStamp || Date.now(); + timestamp = timestamp || Date.now(); // Create the containing node and append all its elements to it. let node = this.document.createElementNS(XHTML_NS, "div"); node.id = "console-msg-" + gSequenceId(); node.className = "message"; - node.clipboardText = aClipboardText; + node.clipboardText = clipboardText; node.timestamp = timestamp; - this.setMessageType(node, aCategory, aSeverity); + this.setMessageType(node, category, severity); - if (aBody instanceof Ci.nsIDOMNode) { - bodyNode.appendChild(aBody); + if (body instanceof Ci.nsIDOMNode) { + bodyNode.appendChild(body); } else { let str = undefined; - if (aLevel == "dir") { - str = VariablesView.getString(aBody.arguments[0]); + if (level == "dir") { + str = VariablesView.getString(body.arguments[0]); } else { - str = aBody; + str = body; } if (str !== undefined) { - aBody = this.document.createTextNode(str); - bodyNode.appendChild(aBody); + body = this.document.createTextNode(str); + bodyNode.appendChild(body); } } // Add the message repeats node only when needed. let repeatNode = null; - if (aCategory != CATEGORY_INPUT && - aCategory != CATEGORY_OUTPUT && - aCategory != CATEGORY_NETWORK && - !(aCategory == CATEGORY_CSS && aSeverity == SEVERITY_LOG)) { + if (category != CATEGORY_INPUT && + category != CATEGORY_OUTPUT && + category != CATEGORY_NETWORK && + !(category == CATEGORY_CSS && severity == SEVERITY_LOG)) { repeatNode = this.document.createElementNS(XHTML_NS, "span"); repeatNode.setAttribute("value", "1"); repeatNode.className = "message-repeats"; repeatNode.textContent = 1; - repeatNode._uid = [bodyNode.textContent, aCategory, aSeverity, aLevel, - aSourceURL, aSourceLine].join(":"); + repeatNode._uid = [bodyNode.textContent, category, severity, level, + sourceURL, sourceLine].join(":"); } // Create the timestamp. @@ -2556,9 +2558,9 @@ WebConsoleFrame.prototype = { // Create the source location (e.g. www.example.com:6) that sits on the // right side of the message, if applicable. let locationNode; - if (aSourceURL && IGNORED_SOURCE_URLS.indexOf(aSourceURL) == -1) { - locationNode = this.createLocationNode({url: aSourceURL, - line: aSourceLine}); + if (sourceURL && IGNORED_SOURCE_URLS.indexOf(sourceURL) == -1) { + locationNode = this.createLocationNode({url: sourceURL, + line: sourceLine}); } node.appendChild(timestampNode); @@ -2566,14 +2568,14 @@ WebConsoleFrame.prototype = { node.appendChild(iconContainer); // Display the variables view after the message node. - if (aLevel == "dir") { + if (level == "dir") { let options = { - objectActor: body.arguments[0], + objectActor: storedBody.arguments[0], targetElement: bodyNode, hideFilterInput: true, }; - this.jsterm.openVariablesView(options).then((aView) => { - node._variablesView = aView; + this.jsterm.openVariablesView(options).then((view) => { + node._variablesView = view; if (node.classList.contains("hidden-message")) { node.classList.remove("hidden-message"); } @@ -2600,14 +2602,14 @@ WebConsoleFrame.prototype = { * * @param object aLocation * An object containing url, line and column number of the message source (destructured). - * @param string aTarget [optional] + * @param string target [optional] * Tells which tool to open the link with, on click. Supported tools: * jsdebugger, styleeditor, scratchpad. * @return nsIDOMNode * The new anchor element, ready to be added to the message node. */ createLocationNode: - function WCF_createLocationNode({url, line, column}, aTarget) + function WCF_createLocationNode({url, line, column}, target) { if (!url) { url = ""; @@ -2637,8 +2639,8 @@ WebConsoleFrame.prototype = { locationNode.href = isScratchpad || !fullURL ? "#" : fullURL; locationNode.draggable = false; - if (aTarget) { - locationNode.target = aTarget; + if (target) { + locationNode.target = target; } locationNode.setAttribute("title", url); locationNode.className = "message-location theme-link devtools-monospace"; @@ -2682,57 +2684,57 @@ WebConsoleFrame.prototype = { /** * Adjusts the category and severity of the given message. * - * @param nsIDOMNode aMessageNode + * @param nsIDOMNode messageNode * The message node to alter. - * @param number aCategory + * @param number category * The category for the message; one of the CATEGORY_ constants. - * @param number aSeverity + * @param number severity * The severity for the message; one of the SEVERITY_ constants. * @return void */ setMessageType: - function WCF_setMessageType(aMessageNode, aCategory, aSeverity) + function WCF_setMessageType(messageNode, category, severity) { - aMessageNode.category = aCategory; - aMessageNode.severity = aSeverity; - aMessageNode.setAttribute("category", CATEGORY_CLASS_FRAGMENTS[aCategory]); - aMessageNode.setAttribute("severity", SEVERITY_CLASS_FRAGMENTS[aSeverity]); - aMessageNode.setAttribute("filter", MESSAGE_PREFERENCE_KEYS[aCategory][aSeverity]); + messageNode.category = category; + messageNode.severity = severity; + messageNode.setAttribute("category", CATEGORY_CLASS_FRAGMENTS[category]); + messageNode.setAttribute("severity", SEVERITY_CLASS_FRAGMENTS[severity]); + messageNode.setAttribute("filter", MESSAGE_PREFERENCE_KEYS[category][severity]); }, /** * Add the mouse event handlers needed to make a link. * * @private - * @param nsIDOMNode aNode + * @param nsIDOMNode node * The node for which you want to add the event handlers. - * @param function aCallback + * @param function callback * The function you want to invoke on click. */ - _addMessageLinkCallback: function WCF__addMessageLinkCallback(aNode, aCallback) + _addMessageLinkCallback: function WCF__addMessageLinkCallback(node, callback) { - aNode.addEventListener("mousedown", (aEvent) => { + node.addEventListener("mousedown", (event) => { this._mousedown = true; - this._startX = aEvent.clientX; - this._startY = aEvent.clientY; + this._startX = event.clientX; + this._startY = event.clientY; }, false); - aNode.addEventListener("click", (aEvent) => { + node.addEventListener("click", (event) => { let mousedown = this._mousedown; this._mousedown = false; - aEvent.preventDefault(); + event.preventDefault(); // Do not allow middle/right-click or 2+ clicks. - if (aEvent.detail != 1 || aEvent.button != 0) { + if (event.detail != 1 || event.button != 0) { return; } // If this event started with a mousedown event and it ends at a different // location, we consider this text selection. if (mousedown && - (this._startX != aEvent.clientX) && - (this._startY != aEvent.clientY)) + (this._startX != event.clientX) && + (this._startY != event.clientY)) { this._startX = this._startY = undefined; return; @@ -2740,24 +2742,24 @@ WebConsoleFrame.prototype = { this._startX = this._startY = undefined; - aCallback.call(this, aEvent); + callback.call(this, event); }, false); }, - _addFocusCallback: function WCF__addFocusCallback(aNode, aCallback) + _addFocusCallback: function WCF__addFocusCallback(node, callback) { - aNode.addEventListener("mousedown", (aEvent) => { + node.addEventListener("mousedown", (event) => { this._mousedown = true; - this._startX = aEvent.clientX; - this._startY = aEvent.clientY; + this._startX = event.clientX; + this._startY = event.clientY; }, false); - aNode.addEventListener("click", (aEvent) => { + node.addEventListener("click", (event) => { let mousedown = this._mousedown; this._mousedown = false; // Do not allow middle/right-click or 2+ clicks. - if (aEvent.detail != 1 || aEvent.button != 0) { + if (event.detail != 1 || event.button != 0) { return; } @@ -2766,8 +2768,8 @@ WebConsoleFrame.prototype = { // Add a fuzz modifier of two pixels in any direction to account for sloppy // clicking. if (mousedown && - (Math.abs(aEvent.clientX - this._startX) >= 2) && - (Math.abs(aEvent.clientY - this._startY) >= 1)) + (Math.abs(event.clientX - this._startX) >= 2) && + (Math.abs(event.clientY - this._startY) >= 1)) { this._startX = this._startY = undefined; return; @@ -2775,7 +2777,7 @@ WebConsoleFrame.prototype = { this._startX = this._startY = undefined; - aCallback.call(this, aEvent); + callback.call(this, event); }, false); }, @@ -2784,16 +2786,16 @@ WebConsoleFrame.prototype = { * Currently this function only handles the timestamps preferences. * * @private - * @param object aEvent + * @param object event * This parameter is a string that holds the event name * pref-changed in this case. - * @param object aData + * @param object data * This is the pref-changed data object. */ - _onToolboxPrefChanged: function WCF__onToolboxPrefChanged(aEvent, aData) + _onToolboxPrefChanged: function WCF__onToolboxPrefChanged(event, data) { - if (aData.pref == PREF_MESSAGE_TIMESTAMP) { - if (aData.newValue) { + if (data.pref == PREF_MESSAGE_TIMESTAMP) { + if (data.newValue) { this.outputNode.classList.remove("hideTimestamps"); } else { @@ -2805,7 +2807,7 @@ WebConsoleFrame.prototype = { /** * Copies the selected items to the system clipboard. * - * @param object aOptions + * @param object options * - linkOnly: * An optional flag to copy only URL without timestamp and * other meta-information. Default is false. @@ -2813,15 +2815,15 @@ WebConsoleFrame.prototype = { * An optional flag to copy the last clicked item which brought * up the context menu if nothing is selected. Default is false. */ - copySelectedItems: function WCF_copySelectedItems(aOptions) + copySelectedItems: function WCF_copySelectedItems(options) { - aOptions = aOptions || { linkOnly: false, contextmenu: false }; + options = options || { linkOnly: false, contextmenu: false }; // Gather up the selected items and concatenate their clipboard text. let strings = []; let children = this.output.getSelectedMessages(); - if (!children.length && aOptions.contextmenu) { + if (!children.length && options.contextmenu) { children = [this._contextMenuHandler.lastClickedMessage]; } @@ -2830,7 +2832,7 @@ WebConsoleFrame.prototype = { if (!item.classList.contains("filtered-by-type") && !item.classList.contains("filtered-by-string")) { let timestampString = l10n.timestampString(item.timestamp); - if (aOptions.linkOnly) { + if (options.linkOnly) { strings.push(item.url); } else { @@ -2846,22 +2848,22 @@ WebConsoleFrame.prototype = { * Object properties provider. This function gives you the properties of the * remote object you want. * - * @param string aActor + * @param string actor * The object actor ID from which you want the properties. - * @param function aCallback + * @param function callback * Function you want invoked once the properties are received. */ objectPropertiesProvider: - function WCF_objectPropertiesProvider(aActor, aCallback) + function WCF_objectPropertiesProvider(actor, callback) { - this.webConsoleClient.inspectObjectProperties(aActor, - function(aResponse) { - if (aResponse.error) { + this.webConsoleClient.inspectObjectProperties(actor, + function(response) { + if (response.error) { Cu.reportError("Failed to retrieve the object properties from the " + - "server. Error: " + aResponse.error); + "server. Error: " + response.error); return; } - aCallback(aResponse.properties); + callback(response.properties); }); }, @@ -2869,13 +2871,13 @@ WebConsoleFrame.prototype = { * Release an actor. * * @private - * @param string aActor + * @param string actor * The actor ID you want to release. */ - _releaseObject: function WCF__releaseObject(aActor) + _releaseObject: function WCF__releaseObject(actor) { if (this.proxy) { - this.proxy.releaseActor(aActor); + this.proxy.releaseActor(actor); } }, @@ -2964,27 +2966,27 @@ WebConsoleFrame.prototype = { /** * @see VariablesView.simpleValueEvalMacro */ -function simpleValueEvalMacro(aItem, aCurrentString) +function simpleValueEvalMacro(item, currentString) { - return VariablesView.simpleValueEvalMacro(aItem, aCurrentString, "_self"); + return VariablesView.simpleValueEvalMacro(item, currentString, "_self"); }; /** * @see VariablesView.overrideValueEvalMacro */ -function overrideValueEvalMacro(aItem, aCurrentString) +function overrideValueEvalMacro(item, currentString) { - return VariablesView.overrideValueEvalMacro(aItem, aCurrentString, "_self"); + return VariablesView.overrideValueEvalMacro(item, currentString, "_self"); }; /** * @see VariablesView.getterOrSetterEvalMacro */ -function getterOrSetterEvalMacro(aItem, aCurrentString) +function getterOrSetterEvalMacro(item, currentString) { - return VariablesView.getterOrSetterEvalMacro(aItem, aCurrentString, "_self"); + return VariablesView.getterOrSetterEvalMacro(item, currentString, "_self"); } @@ -2995,12 +2997,12 @@ function getterOrSetterEvalMacro(aItem, aCurrentString) * with handling command line input, code evaluation and result output. * * @constructor - * @param object aWebConsoleFrame + * @param object webConsoleFrame * The WebConsoleFrame object that owns this JSTerm instance. */ -function JSTerm(aWebConsoleFrame) +function JSTerm(webConsoleFrame) { - this.hud = aWebConsoleFrame; + this.hud = webConsoleFrame; this.hudId = this.hud.hudId; this.inputHistoryCount = Services.prefs.getIntPref(PREF_INPUT_HISTORY_COUNT); @@ -3241,29 +3243,29 @@ JSTerm.prototype = { * The JavaScript evaluation response handler. * * @private - * @param object [aAfterMessage] + * @param object [afterMessage] * Optional message after which the evaluation result will be * inserted. - * @param function [aCallback] + * @param function [callback] * Optional function to invoke when the evaluation result is added to * the output. - * @param object aResponse + * @param object response * The message received from the server. */ _executeResultCallback: - function JST__executeResultCallback(aAfterMessage, aCallback, aResponse) + function JST__executeResultCallback(afterMessage, callback, response) { if (!this.hud) { return; } - if (aResponse.error) { - Cu.reportError("Evaluation error " + aResponse.error + ": " + - aResponse.message); + if (response.error) { + Cu.reportError("Evaluation error " + response.error + ": " + + response.message); return; } - let errorMessage = aResponse.exceptionMessage; - let result = aResponse.result; - let helperResult = aResponse.helperResult; + let errorMessage = response.exceptionMessage; + let result = response.result; + let helperResult = response.helperResult; let helperHasRawOutput = !!(helperResult || {}).rawOutput; if (helperResult && helperResult.type) { @@ -3275,11 +3277,11 @@ JSTerm.prototype = { this.clearHistory(); break; case "inspectObject": - if (aAfterMessage) { - if (!aAfterMessage._objectActors) { - aAfterMessage._objectActors = new Set(); + if (afterMessage) { + if (!afterMessage._objectActors) { + afterMessage._objectActors = new Set(); } - aAfterMessage._objectActors.add(helperResult.object.actor); + afterMessage._objectActors.add(helperResult.object.actor); } this.openVariablesView({ label: VariablesView.getString(helperResult.object, { concise: true }), @@ -3307,17 +3309,17 @@ JSTerm.prototype = { if (!errorMessage && result && typeof result == "object" && result.type == "undefined" && helperResult && !helperHasRawOutput) { - aCallback && aCallback(); + callback && callback(); return; } - let msg = new Messages.JavaScriptEvalOutput(aResponse, errorMessage); + let msg = new Messages.JavaScriptEvalOutput(response, errorMessage); this.hud.output.addMessage(msg); - if (aCallback) { + if (callback) { let oldFlushCallback = this.hud._flushCallback; this.hud._flushCallback = () => { - aCallback(msg.element); + callback(msg.element); if (oldFlushCallback) { oldFlushCallback(); this.hud._flushCallback = oldFlushCallback; @@ -3328,11 +3330,11 @@ JSTerm.prototype = { }; } - msg._afterMessage = aAfterMessage; + msg._afterMessage = afterMessage; msg._objectActors = new Set(); - if (WebConsoleUtils.isActorGrip(aResponse.exception)) { - msg._objectActors.add(aResponse.exception.actor); + if (WebConsoleUtils.isActorGrip(response.exception)) { + msg._objectActors.add(response.exception.actor); } if (WebConsoleUtils.isActorGrip(result)) { @@ -3343,28 +3345,28 @@ JSTerm.prototype = { /** * Execute a string. Execution happens asynchronously in the content process. * - * @param string [aExecuteString] + * @param string [executeString] * The string you want to execute. If this is not provided, the current * user input is used - taken from |this.inputNode.value|. - * @param function [aCallback] + * @param function [callback] * Optional function to invoke when the result is displayed. * This is deprecated - please use the promise return value instead. * @returns Promise * Resolves with the message once the result is displayed. */ - execute: function JST_execute(aExecuteString, aCallback) + execute: function JST_execute(executeString, callback) { let deferred = promise.defer(); - let callback = function(msg) { + let resultCallback = function(msg) { deferred.resolve(msg); - if (aCallback) { - aCallback(msg); + if (callback) { + callback(msg); } } // attempt to execute the content of the inputNode - aExecuteString = aExecuteString || this.inputNode.value; - if (!aExecuteString) { + executeString = executeString || this.inputNode.value; + if (!executeString) { return; } @@ -3374,24 +3376,24 @@ JSTerm.prototype = { selectedNodeActor = inspectorSelection.nodeFront.actorID; } - let message = new Messages.Simple(aExecuteString, { + let message = new Messages.Simple(executeString, { category: "input", severity: "log", }); this.hud.output.addMessage(message); - let onResult = this._executeResultCallback.bind(this, message, callback); + let onResult = this._executeResultCallback.bind(this, message, resultCallback); let options = { frame: this.SELECTED_FRAME, selectedNodeActor: selectedNodeActor, }; - this.requestEvaluation(aExecuteString, options).then(onResult, onResult); + this.requestEvaluation(executeString, options).then(onResult, onResult); // Append a new value in the history of executed code, or overwrite the most // recent entry. The most recent entry may contain the last edited input // value that was not evaluated yet. - this.history[this.historyIndex++] = aExecuteString; + this.history[this.historyIndex++] = executeString; this.historyPlaceHolder = this.history.length; if (this.history.length > this.inputHistoryCount) { @@ -3408,9 +3410,9 @@ JSTerm.prototype = { /** * Request a JavaScript string evaluation from the server. * - * @param string aString + * @param string str * String to execute. - * @param object [aOptions] + * @param object [options] * Options for evaluation: * - bindObjectActor: tells the ObjectActor ID for which you want to do * the evaluation. The Debugger.Object of the OA will be bound to @@ -3429,44 +3431,44 @@ JSTerm.prototype = { * A promise object that is resolved when the server response is * received. */ - requestEvaluation: function JST_requestEvaluation(aString, aOptions = {}) + requestEvaluation: function JST_requestEvaluation(str, options = {}) { let deferred = promise.defer(); - function onResult(aResponse) { - if (!aResponse.error) { - deferred.resolve(aResponse); + function onResult(response) { + if (!response.error) { + deferred.resolve(response); } else { - deferred.reject(aResponse); + deferred.reject(response); } } let frameActor = null; - if ("frame" in aOptions) { - frameActor = this.getFrameActor(aOptions.frame); + if ("frame" in options) { + frameActor = this.getFrameActor(options.frame); } let evalOptions = { - bindObjectActor: aOptions.bindObjectActor, + bindObjectActor: options.bindObjectActor, frameActor: frameActor, - selectedNodeActor: aOptions.selectedNodeActor, - selectedObjectActor: aOptions.selectedObjectActor, + selectedNodeActor: options.selectedNodeActor, + selectedObjectActor: options.selectedObjectActor, }; - this.webConsoleClient.evaluateJSAsync(aString, onResult, evalOptions); + this.webConsoleClient.evaluateJSAsync(str, onResult, evalOptions); return deferred.promise; }, /** * Retrieve the FrameActor ID given a frame depth. * - * @param number aFrame + * @param number frame * Frame depth. * @return string|null * The FrameActor ID for the given frame depth. */ - getFrameActor: function JST_getFrameActor(aFrame) + getFrameActor: function JST_getFrameActor(frame) { let state = this.hud.owner.getDebuggerFrames(); if (!state) { @@ -3474,11 +3476,11 @@ JSTerm.prototype = { } let grip; - if (aFrame == this.SELECTED_FRAME) { + if (frame == this.SELECTED_FRAME) { grip = state.frames[state.selected]; } else { - grip = state.frames[aFrame]; + grip = state.frames[frame]; } return grip ? grip.actor : null; @@ -3487,7 +3489,7 @@ JSTerm.prototype = { /** * Opens a new variables view that allows the inspection of the given object. * - * @param object aOptions + * @param object options * Options for the variables view: * - objectActor: grip of the ObjectActor you want to show in the * variables view. @@ -3505,41 +3507,41 @@ JSTerm.prototype = { * A promise object that is resolved when the variables view has * opened. The new variables view instance is given to the callbacks. */ - openVariablesView: function JST_openVariablesView(aOptions) + openVariablesView: function JST_openVariablesView(options) { - let onContainerReady = (aWindow) => { - let container = aWindow.document.querySelector("#variables"); + let onContainerReady = (window) => { + let container = window.document.querySelector("#variables"); let view = this._variablesView; - if (!view || aOptions.targetElement) { + if (!view || options.targetElement) { let viewOptions = { container: container, - hideFilterInput: aOptions.hideFilterInput, + hideFilterInput: options.hideFilterInput, }; view = this._createVariablesView(viewOptions); - if (!aOptions.targetElement) { + if (!options.targetElement) { this._variablesView = view; - aWindow.addEventListener("keypress", this._onKeypressInVariablesView); + window.addEventListener("keypress", this._onKeypressInVariablesView); } } - aOptions.view = view; - this._updateVariablesView(aOptions); + options.view = view; + this._updateVariablesView(options); - if (!aOptions.targetElement && aOptions.autofocus) { - aWindow.focus(); + if (!options.targetElement && options.autofocus) { + window.focus(); } - this.emit("variablesview-open", view, aOptions); + this.emit("variablesview-open", view, options); return view; }; let openPromise; - if (aOptions.targetElement) { + if (options.targetElement) { let deferred = promise.defer(); openPromise = deferred.promise; - let document = aOptions.targetElement.ownerDocument; + let document = options.targetElement.ownerDocument; let iframe = document.createElementNS(XHTML_NS, "iframe"); - iframe.addEventListener("load", function onIframeLoad(aEvent) { + iframe.addEventListener("load", function onIframeLoad(event) { iframe.removeEventListener("load", onIframeLoad, true); iframe.style.visibility = "visible"; deferred.resolve(iframe.contentWindow); @@ -3548,7 +3550,7 @@ JSTerm.prototype = { iframe.flex = 1; iframe.style.visibility = "hidden"; iframe.setAttribute("src", VARIABLES_VIEW_URL); - aOptions.targetElement.appendChild(iframe); + options.targetElement.appendChild(iframe); } else { if (!this.sidebar) { @@ -3612,28 +3614,28 @@ JSTerm.prototype = { * is used for removing the sidebar when Escape is pressed. * * @private - * @param nsIDOMEvent aEvent + * @param nsIDOMEvent event * The keypress DOM event object. */ - _onKeypressInVariablesView: function JST__onKeypressInVariablesView(aEvent) + _onKeypressInVariablesView: function JST__onKeypressInVariablesView(event) { - let tag = aEvent.target.nodeName; - if (aEvent.keyCode != Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE || aEvent.shiftKey || - aEvent.altKey || aEvent.ctrlKey || aEvent.metaKey || + let tag = event.target.nodeName; + if (event.keyCode != Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE || event.shiftKey || + event.altKey || event.ctrlKey || event.metaKey || ["input", "textarea", "select", "textbox"].indexOf(tag) > -1) { return; } this._sidebarDestroy(); this.inputNode.focus(); - aEvent.stopPropagation(); + event.stopPropagation(); }, /** * Create a variables view instance. * * @private - * @param object aOptions + * @param object options * Options for the new Variables View instance: * - container: the DOM element where the variables view is inserted. * - hideFilterInput: boolean, if true the variables filter input is @@ -3641,27 +3643,27 @@ JSTerm.prototype = { * @return object * The new Variables View instance. */ - _createVariablesView: function JST__createVariablesView(aOptions) + _createVariablesView: function JST__createVariablesView(options) { - let view = new VariablesView(aOptions.container); + let view = new VariablesView(options.container); view.toolbox = gDevTools.getToolbox(this.hud.owner.target); view.searchPlaceholder = l10n.getStr("propertiesFilterPlaceholder"); view.emptyText = l10n.getStr("emptyPropertiesList"); - view.searchEnabled = !aOptions.hideFilterInput; + view.searchEnabled = !options.hideFilterInput; view.lazyEmpty = this._lazyVariablesView; VariablesViewController.attach(view, { - getEnvironmentClient: aGrip => { - return new EnvironmentClient(this.hud.proxy.client, aGrip); + getEnvironmentClient: grip => { + return new EnvironmentClient(this.hud.proxy.client, grip); }, - getObjectClient: aGrip => { - return new ObjectClient(this.hud.proxy.client, aGrip); + getObjectClient: grip => { + return new ObjectClient(this.hud.proxy.client, grip); }, - getLongStringClient: aGrip => { - return this.webConsoleClient.longString(aGrip); + getLongStringClient: grip => { + return this.webConsoleClient.longString(grip); }, - releaseActor: aActor => { - this.hud._releaseObject(aActor); + releaseActor: actor => { + this.hud._releaseObject(actor); }, simpleValueEvalMacro: simpleValueEvalMacro, overrideValueEvalMacro: overrideValueEvalMacro, @@ -3669,8 +3671,8 @@ JSTerm.prototype = { }); // Relay events from the VariablesView. - view.on("fetched", (aEvent, aType, aVar) => { - this.emit("variablesview-fetched", aVar); + view.on("fetched", (event, type, variableObject) => { + this.emit("variablesview-fetched", variableObject); }); return view; @@ -3680,7 +3682,7 @@ JSTerm.prototype = { * Update the variables view. * * @private - * @param object aOptions + * @param object options * Options for updating the variables view: * - view: the view you want to update. * - objectActor: the grip of the new ObjectActor you want to show in @@ -3688,24 +3690,24 @@ JSTerm.prototype = { * - rawObject: the new raw object you want to show. * - label: the new label for the inspected object. */ - _updateVariablesView: function JST__updateVariablesView(aOptions) + _updateVariablesView: function JST__updateVariablesView(options) { - let view = aOptions.view; + let view = options.view; view.empty(); // We need to avoid pruning the object inspection starting point. // That one is pruned when the console message is removed. - view.controller.releaseActors(aActor => { - return view._consoleLastObjectActor != aActor; + view.controller.releaseActors(actor => { + return view._consoleLastObjectActor != actor; }); - if (aOptions.objectActor && + if (options.objectActor && (!this.hud.owner._browserConsole || Services.prefs.getBoolPref("devtools.chrome.enabled"))) { // Make sure eval works in the correct context. - view.eval = this._variablesViewEvaluate.bind(this, aOptions); - view.switch = this._variablesViewSwitch.bind(this, aOptions); - view.delete = this._variablesViewDelete.bind(this, aOptions); + view.eval = this._variablesViewEvaluate.bind(this, options); + view.switch = this._variablesViewSwitch.bind(this, options); + view.delete = this._variablesViewDelete.bind(this, options); } else { view.eval = null; @@ -3713,13 +3715,13 @@ JSTerm.prototype = { view.delete = null; } - let { variable, expanded } = view.controller.setSingleVariable(aOptions); + let { variable, expanded } = view.controller.setSingleVariable(options); variable.evaluationMacro = simpleValueEvalMacro; - if (aOptions.objectActor) { - view._consoleLastObjectActor = aOptions.objectActor.actor; + if (options.objectActor) { + view._consoleLastObjectActor = options.objectActor.actor; } - else if (aOptions.rawObject) { + else if (options.rawObject) { view._consoleLastObjectActor = null; } else { @@ -3728,7 +3730,7 @@ JSTerm.prototype = { } expanded.then(() => { - this.emit("variablesview-updated", view, aOptions); + this.emit("variablesview-updated", view, options); }); }, @@ -3737,23 +3739,23 @@ JSTerm.prototype = { * value. * * @private - * @param object aOptions + * @param object options * The options used for |this._updateVariablesView()|. - * @param object aVar + * @param object variableObject * The Variable object instance for the edited property. - * @param string aValue + * @param string value * The value the edited property was changed to. */ _variablesViewEvaluate: - function JST__variablesViewEvaluate(aOptions, aVar, aValue) + function JST__variablesViewEvaluate(options, variableObject, value) { - let updater = this._updateVariablesView.bind(this, aOptions); + let updater = this._updateVariablesView.bind(this, options); let onEval = this._silentEvalCallback.bind(this, updater); - let string = aVar.evaluationMacro(aVar, aValue); + let string = variableObject.evaluationMacro(variableObject, value); let evalOptions = { frame: this.SELECTED_FRAME, - bindObjectActor: aOptions.objectActor.actor, + bindObjectActor: options.objectActor.actor, }; this.requestEvaluation(string, evalOptions).then(onEval, onEval); @@ -3764,21 +3766,21 @@ JSTerm.prototype = { * is deleted. * * @private - * @param object aOptions + * @param object options * The options used for |this._updateVariablesView()|. - * @param object aVar + * @param object variableObject * The Variable object instance for the deleted property. */ - _variablesViewDelete: function JST__variablesViewDelete(aOptions, aVar) + _variablesViewDelete: function JST__variablesViewDelete(options, variableObject) { let onEval = this._silentEvalCallback.bind(this, null); let evalOptions = { frame: this.SELECTED_FRAME, - bindObjectActor: aOptions.objectActor.actor, + bindObjectActor: options.objectActor.actor, }; - this.requestEvaluation("delete _self" + aVar.symbolicName, evalOptions) + this.requestEvaluation("delete _self" + variableObject.symbolicName, evalOptions) .then(onEval, onEval); }, @@ -3787,31 +3789,31 @@ JSTerm.prototype = { * is renamed. * * @private - * @param object aOptions + * @param object options * The options used for |this._updateVariablesView()|. - * @param object aVar + * @param object variableObject * The Variable object instance for the renamed property. - * @param string aNewName + * @param string newName * The new name for the property. */ _variablesViewSwitch: - function JST__variablesViewSwitch(aOptions, aVar, aNewName) + function JST__variablesViewSwitch(options, variableObject, newName) { - let updater = this._updateVariablesView.bind(this, aOptions); + let updater = this._updateVariablesView.bind(this, options); let onEval = this._silentEvalCallback.bind(this, updater); let evalOptions = { frame: this.SELECTED_FRAME, - bindObjectActor: aOptions.objectActor.actor, + bindObjectActor: options.objectActor.actor, }; - let newSymbolicName = aVar.ownerView.symbolicName + '["' + aNewName + '"]'; - if (newSymbolicName == aVar.symbolicName) { + let newSymbolicName = variableObject.ownerView.symbolicName + '["' + newName + '"]'; + if (newSymbolicName == variableObject.symbolicName) { return; } - let code = "_self" + newSymbolicName + " = _self" + aVar.symbolicName + ";" + - "delete _self" + aVar.symbolicName; + let code = "_self" + newSymbolicName + " = _self" + variableObject.symbolicName + ";" + + "delete _self" + variableObject.symbolicName; this.requestEvaluation(code, evalOptions).then(onEval, onEval); }, @@ -3825,48 +3827,48 @@ JSTerm.prototype = { * Exceptions are displayed in the output. * * @private - * @param function aCallback + * @param function callback * Function to invoke once the response is received. - * @param object aResponse + * @param object response * The response packet received from the server. */ - _silentEvalCallback: function JST__silentEvalCallback(aCallback, aResponse) + _silentEvalCallback: function JST__silentEvalCallback(callback, response) { - if (aResponse.error) { - Cu.reportError("Web Console evaluation failed. " + aResponse.error + ":" + - aResponse.message); + if (response.error) { + Cu.reportError("Web Console evaluation failed. " + response.error + ":" + + response.message); - aCallback && aCallback(aResponse); + callback && callback(response); return; } - if (aResponse.exceptionMessage) { - let message = new Messages.Simple(aResponse.exceptionMessage, { + if (response.exceptionMessage) { + let message = new Messages.Simple(response.exceptionMessage, { category: "output", severity: "error", - timestamp: aResponse.timestamp, + timestamp: response.timestamp, }); this.hud.output.addMessage(message); message._objectActors = new Set(); - if (WebConsoleUtils.isActorGrip(aResponse.exception)) { - message._objectActors.add(aResponse.exception.actor); + if (WebConsoleUtils.isActorGrip(response.exception)) { + message._objectActors.add(response.exception.actor); } } - let helper = aResponse.helperResult || { type: null }; + let helper = response.helperResult || { type: null }; let helperGrip = null; if (helper.type == "inspectObject") { helperGrip = helper.object; } - let grips = [aResponse.result, helperGrip]; + let grips = [response.result, helperGrip]; for (let grip of grips) { if (WebConsoleUtils.isActorGrip(grip)) { this.hud._releaseObject(grip.actor); } } - aCallback && aCallback(aResponse); + callback && callback(response); }, @@ -3875,11 +3877,11 @@ JSTerm.prototype = { * * This method emits the "messages-cleared" notification. * - * @param boolean aClearStorage + * @param boolean clearStorage * True if you want to clear the console messages storage associated to * this Web Console. */ - clearOutput: function JST_clearOutput(aClearStorage) + clearOutput: function JST_clearOutput(clearStorage) { let hud = this.hud; let outputNode = hud.outputNode; @@ -3894,7 +3896,7 @@ JSTerm.prototype = { this.webConsoleClient.clearNetworkRequests(); hud._repeatNodes = {}; - if (aClearStorage) { + if (clearStorage) { this.webConsoleClient.clearMessagesCache(); } @@ -3942,14 +3944,14 @@ JSTerm.prototype = { * fit its contents. This method is preferred over setting "inputNode.value" * directly, because it correctly resizes the field. * - * @param string aNewValue + * @param string newValue * The new value to set. * @returns void */ - setInputValue: function JST_setInputValue(aNewValue) + setInputValue: function JST_setInputValue(newValue) { - this.inputNode.value = aNewValue; - this.lastInputValue = aNewValue; + this.inputNode.value = newValue; + this.lastInputValue = newValue; this.completeNode.value = ""; this.resizeInput(); this._inputChanged = true; @@ -3985,15 +3987,15 @@ JSTerm.prototype = { * The inputNode "keypress" event handler. * * @private - * @param nsIDOMEvent aEvent + * @param nsIDOMEvent event */ - _keyPress: function JST__keyPress(aEvent) + _keyPress: function JST__keyPress(event) { let inputNode = this.inputNode; let inputUpdated = false; - if (aEvent.ctrlKey) { - switch (aEvent.charCode) { + if (event.ctrlKey) { + switch (event.charCode) { case 101: // control-e if (Services.appinfo.OS == "WINNT") { @@ -4011,7 +4013,7 @@ JSTerm.prototype = { } } inputNode.setSelectionRange(lineEndPos, lineEndPos); - aEvent.preventDefault(); + event.preventDefault(); this.clearCompletion(); break; @@ -4022,7 +4024,7 @@ JSTerm.prototype = { if (Services.appinfo.OS == "Darwin" && this.canCaretGoNext() && this.historyPeruse(HISTORY_FORWARD)) { - aEvent.preventDefault(); + event.preventDefault(); // Ctrl-N is also used to focus the Network category button on MacOSX. // The preventDefault() call doesn't prevent the focus from moving // away from the input. @@ -4038,7 +4040,7 @@ JSTerm.prototype = { if (Services.appinfo.OS == "Darwin" && this.canCaretGoPrevious() && this.historyPeruse(HISTORY_BACK)) { - aEvent.preventDefault(); + event.preventDefault(); // Ctrl-P may also be used to focus some category button on MacOSX. // The preventDefault() call doesn't prevent the focus from moving // away from the input. @@ -4051,24 +4053,24 @@ JSTerm.prototype = { } return; } - else if (aEvent.shiftKey && - aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_RETURN) { + else if (event.shiftKey && + event.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_RETURN) { // shift return // TODO: expand the inputNode height by one line return; } - switch (aEvent.keyCode) { + switch (event.keyCode) { case Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE: if (this.autocompletePopup.isOpen) { this.clearCompletion(); - aEvent.preventDefault(); - aEvent.stopPropagation(); + event.preventDefault(); + event.stopPropagation(); } else if (this.sidebar) { this._sidebarDestroy(); - aEvent.preventDefault(); - aEvent.stopPropagation(); + event.preventDefault(); + event.stopPropagation(); } break; @@ -4082,7 +4084,7 @@ JSTerm.prototype = { this.execute(); this._inputChanged = false; } - aEvent.preventDefault(); + event.preventDefault(); break; case Ci.nsIDOMKeyEvent.DOM_VK_UP: @@ -4096,7 +4098,7 @@ JSTerm.prototype = { inputUpdated = this.historyPeruse(HISTORY_BACK); } if (inputUpdated) { - aEvent.preventDefault(); + event.preventDefault(); } break; @@ -4111,7 +4113,7 @@ JSTerm.prototype = { inputUpdated = this.historyPeruse(HISTORY_FORWARD); } if (inputUpdated) { - aEvent.preventDefault(); + event.preventDefault(); } break; @@ -4129,7 +4131,7 @@ JSTerm.prototype = { this.hud.outputNode.parentNode.clientHeight ); } - aEvent.preventDefault(); + event.preventDefault(); break; case Ci.nsIDOMKeyEvent.DOM_VK_PAGE_DOWN: @@ -4146,26 +4148,26 @@ JSTerm.prototype = { this.hud.outputNode.parentNode.clientHeight ); } - aEvent.preventDefault(); + event.preventDefault(); break; case Ci.nsIDOMKeyEvent.DOM_VK_HOME: if (this.autocompletePopup.isOpen) { this.autocompletePopup.selectedIndex = 0; - aEvent.preventDefault(); + event.preventDefault(); } else if (this.inputNode.value.length <= 0) { this.hud.outputNode.parentNode.scrollTop = 0; - aEvent.preventDefault(); + event.preventDefault(); } break; case Ci.nsIDOMKeyEvent.DOM_VK_END: if (this.autocompletePopup.isOpen) { this.autocompletePopup.selectedIndex = this.autocompletePopup.itemCount - 1; - aEvent.preventDefault(); + event.preventDefault(); } else if (this.inputNode.value.length <= 0) { this.hud.outputNode.parentNode.scrollTop = this.hud.outputNode.parentNode.scrollHeight; - aEvent.preventDefault(); + event.preventDefault(); } break; @@ -4187,7 +4189,7 @@ JSTerm.prototype = { this.complete(this.COMPLETE_HINT_ONLY) && this.lastCompletion.value && this.acceptProposedCompletion()) { - aEvent.preventDefault(); + event.preventDefault(); } if (this.autocompletePopup.isOpen) { this.clearCompletion(); @@ -4199,11 +4201,11 @@ JSTerm.prototype = { if (this.complete(this.COMPLETE_HINT_ONLY) && this.lastCompletion && this.acceptProposedCompletion()) { - aEvent.preventDefault(); + event.preventDefault(); } else if (this._inputChanged) { this.updateCompleteNode(l10n.getStr("Autocomplete.blank")); - aEvent.preventDefault(); + event.preventDefault(); } break; default: @@ -4223,20 +4225,20 @@ JSTerm.prototype = { /** * Go up/down the history stack of input values. * - * @param number aDirection + * @param number direction * History navigation direction: HISTORY_BACK or HISTORY_FORWARD. * * @returns boolean * True if the input value changed, false otherwise. */ - historyPeruse: function JST_historyPeruse(aDirection) + historyPeruse: function JST_historyPeruse(direction) { if (!this.history.length) { return false; } // Up Arrow key - if (aDirection == HISTORY_BACK) { + if (direction == HISTORY_BACK) { if (this.historyPlaceHolder <= 0) { return false; } @@ -4253,7 +4255,7 @@ JSTerm.prototype = { this.setInputValue(inputVal); } // Down Arrow key - else if (aDirection == HISTORY_FORWARD) { + else if (direction == HISTORY_FORWARD) { if (this.historyPlaceHolder >= (this.history.length-1)) { return false; } @@ -4326,7 +4328,7 @@ JSTerm.prototype = { * only if the selection/cursor is at the end of the string. If no completion * is found, the current inputNode value and cursor/selection stay. * - * @param int aType possible values are + * @param int type possible values are * - this.COMPLETE_FORWARD: If there is more than one possible completion * and the input value stayed the same compared to the last time this * function was called, then the next completion of all possible @@ -4348,13 +4350,13 @@ JSTerm.prototype = { * used again. If there is only one possible completion, then * the inputNode.value is set to this value and the selection is set * from the current cursor position to the end of the completed text. - * @param function aCallback + * @param function callback * Optional function invoked when the autocomplete properties are * updated. * @returns boolean true if there existed a completion for the current input, * or false otherwise. */ - complete: function JSTF_complete(aType, aCallback) + complete: function JSTF_complete(type, callback) { let inputNode = this.inputNode; let inputValue = inputNode.value; @@ -4363,7 +4365,7 @@ JSTerm.prototype = { // If the inputNode has no value, then don't try to complete on it. if (!inputValue) { this.clearCompletion(); - aCallback && aCallback(this); + callback && callback(this); this.emit("autocomplete-updated"); return false; } @@ -4371,38 +4373,38 @@ JSTerm.prototype = { // Only complete if the selection is empty. if (inputNode.selectionStart != inputNode.selectionEnd) { this.clearCompletion(); - aCallback && aCallback(this); + callback && callback(this); this.emit("autocomplete-updated"); return false; } // Update the completion results. if (this.lastCompletion.value != inputValue || frameActor != this._lastFrameActorId) { - this._updateCompletionResult(aType, aCallback); + this._updateCompletionResult(type, callback); return false; } let popup = this.autocompletePopup; let accepted = false; - if (aType != this.COMPLETE_HINT_ONLY && popup.itemCount == 1) { + if (type != this.COMPLETE_HINT_ONLY && popup.itemCount == 1) { this.acceptProposedCompletion(); accepted = true; } - else if (aType == this.COMPLETE_BACKWARD) { + else if (type == this.COMPLETE_BACKWARD) { popup.selectPreviousItem(); } - else if (aType == this.COMPLETE_FORWARD) { + else if (type == this.COMPLETE_FORWARD) { popup.selectNextItem(); } - else if (aType == this.COMPLETE_PAGEUP) { + else if (type == this.COMPLETE_PAGEUP) { popup.selectPreviousPageItem(); } - else if (aType == this.COMPLETE_PAGEDOWN) { + else if (type == this.COMPLETE_PAGEDOWN) { popup.selectNextPageItem(); } - aCallback && aCallback(this); + callback && callback(this); this.emit("autocomplete-updated"); return accepted || popup.itemCount > 0; }, @@ -4412,13 +4414,13 @@ JSTerm.prototype = { * fetching updated results from the content process. * * @private - * @param int aType + * @param int type * Completion type. See this.complete() for details. - * @param function [aCallback] + * @param function [callback] * Optional, function to invoke when completion results are received. */ _updateCompletionResult: - function JST__updateCompletionResult(aType, aCallback) + function JST__updateCompletionResult(type, callback) { let frameActor = this.getFrameActor(this.SELECTED_FRAME); if (this.lastCompletion.value == this.inputNode.value && frameActor == this._lastFrameActorId) { @@ -4457,12 +4459,12 @@ JSTerm.prototype = { this.lastCompletion = { requestId: null, - completionType: aType, + completionType: type, value: null, }; let response = { matches: newList, matchProp: filterBy }; - this._receiveAutocompleteProperties(null, aCallback, response); + this._receiveAutocompleteProperties(null, callback, response); return; } @@ -4470,14 +4472,14 @@ JSTerm.prototype = { this.lastCompletion = { requestId: requestId, - completionType: aType, + completionType: type, value: null, }; - let callback = this._receiveAutocompleteProperties.bind(this, requestId, - aCallback); + let autocompleteCallback = this._receiveAutocompleteProperties.bind(this, requestId, + callback); - this.webConsoleClient.autocomplete(input, cursor, callback, frameActor); + this.webConsoleClient.autocomplete(input, cursor, autocompleteCallback, frameActor); }, /** @@ -4485,43 +4487,43 @@ JSTerm.prototype = { * the completion result received from the server and updates the UI * accordingly. * - * @param number aRequestId + * @param number requestId * Request ID. - * @param function [aCallback=null] + * @param function [callback=null] * Optional, function to invoke when the completion result is received. - * @param object aMessage + * @param object message * The JSON message which holds the completion results received from * the content process. */ _receiveAutocompleteProperties: - function JST__receiveAutocompleteProperties(aRequestId, aCallback, aMessage) + function JST__receiveAutocompleteProperties(requestId, callback, message) { let inputNode = this.inputNode; let inputValue = inputNode.value; if (this.lastCompletion.value == inputValue || - aRequestId != this.lastCompletion.requestId) { + requestId != this.lastCompletion.requestId) { return; } // Cache whatever came from the server if the last char is alphanumeric or '.' let cursor = inputNode.selectionStart; let inputUntilCursor = inputValue.substring(0, cursor); - if (aRequestId != null && /[a-zA-Z0-9.]$/.test(inputUntilCursor)) { - this._autocompleteCache = aMessage.matches; + if (requestId != null && /[a-zA-Z0-9.]$/.test(inputUntilCursor)) { + this._autocompleteCache = message.matches; this._autocompleteQuery = inputUntilCursor; } - let matches = aMessage.matches; - let lastPart = aMessage.matchProp; + let matches = message.matches; + let lastPart = message.matchProp; if (!matches.length) { this.clearCompletion(); - aCallback && aCallback(this); + callback && callback(this); this.emit("autocomplete-updated"); return; } - let items = matches.reverse().map(function(aMatch) { - return { preLabel: lastPart, label: aMatch }; + let items = matches.reverse().map(function(match) { + return { preLabel: lastPart, label: match }; }); let popup = this.autocompletePopup; @@ -4561,7 +4563,7 @@ JSTerm.prototype = { popup.selectNextItem(); } - aCallback && aCallback(this); + callback && callback(this); this.emit("autocomplete-updated"); }, @@ -4629,14 +4631,14 @@ JSTerm.prototype = { /** * Update the node that displays the currently selected autocomplete proposal. * - * @param string aSuffix + * @param string suffix * The proposed suffix for the inputNode value. */ - updateCompleteNode: function JSTF_updateCompleteNode(aSuffix) + updateCompleteNode: function JSTF_updateCompleteNode(suffix) { // completion prefix = input, with non-control chars replaced by spaces - let prefix = aSuffix ? this.inputNode.value.replace(/[\S]/g, " ") : ""; - this.completeNode.value = prefix + aSuffix; + let prefix = suffix ? this.inputNode.value.replace(/[\S]/g, " ") : ""; + this.completeNode.value = prefix + suffix; }, @@ -4702,28 +4704,28 @@ var Utils = { /** * Scrolls a node so that it's visible in its containing element. * - * @param nsIDOMNode aNode + * @param nsIDOMNode node * The node to make visible. * @returns void */ - scrollToVisible: function Utils_scrollToVisible(aNode) + scrollToVisible: function Utils_scrollToVisible(node) { - aNode.scrollIntoView(false); + node.scrollIntoView(false); }, /** * Check if the given output node is scrolled to the bottom. * - * @param nsIDOMNode aOutputNode + * @param nsIDOMNode outputNode * @return boolean * True if the output node is scrolled to the bottom, or false * otherwise. */ - isOutputScrolledToBottom: function Utils_isOutputScrolledToBottom(aOutputNode) + isOutputScrolledToBottom: function Utils_isOutputScrolledToBottom(outputNode) { - let lastNodeHeight = aOutputNode.lastChild ? - aOutputNode.lastChild.clientHeight : 0; - let scrollNode = aOutputNode.parentNode; + let lastNodeHeight = outputNode.lastChild ? + outputNode.lastChild.clientHeight : 0; + let scrollNode = outputNode.parentNode; return scrollNode.scrollTop + scrollNode.clientHeight >= scrollNode.scrollHeight - lastNodeHeight / 2; }, @@ -4731,15 +4733,15 @@ var Utils = { /** * Determine the category of a given nsIScriptError. * - * @param nsIScriptError aScriptError + * @param nsIScriptError scriptError * The script error you want to determine the category for. * @return CATEGORY_JS|CATEGORY_CSS|CATEGORY_SECURITY * Depending on the script error CATEGORY_JS, CATEGORY_CSS, or * CATEGORY_SECURITY can be returned. */ - categoryForScriptError: function Utils_categoryForScriptError(aScriptError) + categoryForScriptError: function Utils_categoryForScriptError(scriptError) { - let category = aScriptError.category; + let category = scriptError.category; if (/^(?:CSS|Layout)\b/.test(category)) { return CATEGORY_CSS; @@ -4768,18 +4770,18 @@ var Utils = { /** * Retrieve the limit of messages for a specific category. * - * @param number aCategory + * @param number category * The category of messages you want to retrieve the limit for. See the * CATEGORY_* constants. * @return number * The number of messages allowed for the specific category. */ - logLimitForCategory: function Utils_logLimitForCategory(aCategory) + logLimitForCategory: function Utils_logLimitForCategory(category) { let logLimit = DEFAULT_LOG_LIMIT; try { - let prefName = CATEGORY_CLASS_FRAGMENTS[aCategory]; + let prefName = CATEGORY_CLASS_FRAGMENTS[category]; logLimit = Services.prefs.getIntPref("devtools.hud.loglimit." + prefName); logLimit = Math.max(logLimit, 1); } @@ -4797,9 +4799,9 @@ var Utils = { * A controller (an instance of nsIController) that makes editing actions * behave appropriately in the context of the Web Console. */ -function CommandController(aWebConsole) +function CommandController(webConsole) { - this.owner = aWebConsole; + this.owner = webConsole; } CommandController.prototype = { @@ -4832,17 +4834,17 @@ CommandController.prototype = { this.owner.copySelectedItems({ linkOnly: false, contextmenu: true }); }, - supportsCommand: function CommandController_supportsCommand(aCommand) + supportsCommand: function CommandController_supportsCommand(command) { if (!this.owner || !this.owner.output) { return false; } - return this.isCommandEnabled(aCommand); + return this.isCommandEnabled(command); }, - isCommandEnabled: function CommandController_isCommandEnabled(aCommand) + isCommandEnabled: function CommandController_isCommandEnabled(command) { - switch (aCommand) { + switch (command) { case "consoleCmd_openURL": case "consoleCmd_copyURL": { // Only enable URL-related actions if node is Net Activity. @@ -4869,9 +4871,9 @@ CommandController.prototype = { return false; }, - doCommand: function CommandController_doCommand(aCommand) + doCommand: function CommandController_doCommand(command) { - switch (aCommand) { + switch (command) { case "consoleCmd_openURL": this.openURL(); break; @@ -4915,15 +4917,15 @@ CommandController.prototype = { * and the application we connect to through the remote debug protocol. * * @constructor - * @param object aWebConsole - * The Web Console instance that owns this connection proxy. - * @param RemoteTarget aTarget + * @param object webConsoleFrame + * The WebConsoleFrame object that owns this connection proxy. + * @param RemoteTarget target * The target that the console will connect to. */ -function WebConsoleConnectionProxy(aWebConsole, aTarget) +function WebConsoleConnectionProxy(webConsoleFrame, target) { - this.owner = aWebConsole; - this.target = aTarget; + this.webConsoleFrame = webConsoleFrame; + this.target = target; this._onPageError = this._onPageError.bind(this); this._onLogMessage = this._onLogMessage.bind(this); @@ -4942,12 +4944,12 @@ function WebConsoleConnectionProxy(aWebConsole, aTarget) WebConsoleConnectionProxy.prototype = { /** - * The owning Web Console instance. + * The owning Web Console Frame instance. * * @see WebConsoleFrame * @type object */ - owner: null, + webConsoleFrame: null, /** * The target that the console connects to. @@ -5050,7 +5052,7 @@ WebConsoleConnectionProxy.prototype = { this._consoleActor = this.target.form.consoleActor; if (this.target.isTabActor) { let tab = this.target.form; - this.owner.onLocationChange(tab.url, tab.title); + this.webConsoleFrame.onLocationChange(tab.url, tab.title); } this._attachConsole(); @@ -5087,46 +5089,46 @@ WebConsoleConnectionProxy.prototype = { * The "attachConsole" response handler. * * @private - * @param object aResponse + * @param object response * The JSON response object received from the server. - * @param object aWebConsoleClient + * @param object webConsoleClient * The WebConsoleClient instance for the attached console, for the * specific tab we work with. */ - _onAttachConsole: function WCCP__onAttachConsole(aResponse, aWebConsoleClient) + _onAttachConsole: function WCCP__onAttachConsole(response, webConsoleClient) { - if (aResponse.error) { - Cu.reportError("attachConsole failed: " + aResponse.error + " " + - aResponse.message); - this._connectDefer.reject(aResponse); + if (response.error) { + Cu.reportError("attachConsole failed: " + response.error + " " + + response.message); + this._connectDefer.reject(response); return; } - this.webConsoleClient = aWebConsoleClient; + this.webConsoleClient = webConsoleClient; - this._hasNativeConsoleAPI = aResponse.nativeConsoleAPI; + this._hasNativeConsoleAPI = response.nativeConsoleAPI; this.webConsoleClient.on("networkEvent", this._onNetworkEvent); this.webConsoleClient.on("networkEventUpdate", this._onNetworkEventUpdate); let msgs = ["PageError", "ConsoleAPI"]; this.webConsoleClient.getCachedMessages(msgs, this._onCachedMessages); - this.owner._onUpdateListeners(); + this.webConsoleFrame._onUpdateListeners(); }, /** * The "cachedMessages" response handler. * * @private - * @param object aResponse + * @param object response * The JSON response object received from the server. */ - _onCachedMessages: function WCCP__onCachedMessages(aResponse) + _onCachedMessages: function WCCP__onCachedMessages(response) { - if (aResponse.error) { - Cu.reportError("Web Console getCachedMessages error: " + aResponse.error + - " " + aResponse.message); - this._connectDefer.reject(aResponse); + if (response.error) { + Cu.reportError("Web Console getCachedMessages error: " + response.error + + " " + response.message); + this._connectDefer.reject(response); return; } @@ -5136,13 +5138,13 @@ WebConsoleConnectionProxy.prototype = { Cu.reportError("Web Console getCachedMessages error: invalid state."); } - let messages = aResponse.messages.concat(...this.webConsoleClient.getNetworkEvents()); + let messages = response.messages.concat(...this.webConsoleClient.getNetworkEvents()); messages.sort((a, b) => a.timeStamp - b.timeStamp); - this.owner.displayCachedMessages(messages); + this.webConsoleFrame.displayCachedMessages(messages); if (!this._hasNativeConsoleAPI) { - this.owner.logWarningAboutReplacedAPI(); + this.webConsoleFrame.logWarningAboutReplacedAPI(); } this.connected = true; @@ -5154,15 +5156,15 @@ WebConsoleConnectionProxy.prototype = { * for displaying. * * @private - * @param string aType + * @param string type * Message type. - * @param object aPacket + * @param object packet * The message received from the server. */ - _onPageError: function WCCP__onPageError(aType, aPacket) + _onPageError: function WCCP__onPageError(type, packet) { - if (this.owner && aPacket.from == this._consoleActor) { - this.owner.handlePageError(aPacket.pageError); + if (this.webConsoleFrame && packet.from == this._consoleActor) { + this.webConsoleFrame.handlePageError(packet.pageError); } }, @@ -5171,15 +5173,15 @@ WebConsoleConnectionProxy.prototype = { * for displaying. * * @private - * @param string aType + * @param string type * Message type. - * @param object aPacket + * @param object packet * The message received from the server. */ - _onLogMessage: function WCCP__onLogMessage(aType, aPacket) + _onLogMessage: function WCCP__onLogMessage(type, packet) { - if (this.owner && aPacket.from == this._consoleActor) { - this.owner.handleLogMessage(aPacket); + if (this.webConsoleFrame && packet.from == this._consoleActor) { + this.webConsoleFrame.handleLogMessage(packet); } }, @@ -5188,15 +5190,15 @@ WebConsoleConnectionProxy.prototype = { * the UI for displaying. * * @private - * @param string aType + * @param string type * Message type. - * @param object aPacket + * @param object packet * The message received from the server. */ - _onConsoleAPICall: function WCCP__onConsoleAPICall(aType, aPacket) + _onConsoleAPICall: function WCCP__onConsoleAPICall(type, packet) { - if (this.owner && aPacket.from == this._consoleActor) { - this.owner.handleConsoleAPICall(aPacket.message); + if (this.webConsoleFrame && packet.from == this._consoleActor) { + this.webConsoleFrame.handleConsoleAPICall(packet.message); } }, @@ -5212,8 +5214,8 @@ WebConsoleConnectionProxy.prototype = { */ _onNetworkEvent: function(type, networkInfo) { - if (this.owner) { - this.owner.handleNetworkEvent(networkInfo); + if (this.webConsoleFrame) { + this.webConsoleFrame.handleNetworkEvent(networkInfo); } }, @@ -5231,8 +5233,8 @@ WebConsoleConnectionProxy.prototype = { */ _onNetworkEventUpdate: function(type, { packet, networkInfo }) { - if (this.owner) { - this.owner.handleNetworkEventUpdate(networkInfo, packet); + if (this.webConsoleFrame) { + this.webConsoleFrame.handleNetworkEventUpdate(networkInfo, packet); } }, @@ -5241,22 +5243,22 @@ WebConsoleConnectionProxy.prototype = { * the UI for displaying. * * @private - * @param string aType + * @param string type * Message type. - * @param object aPacket + * @param object packet * The message received from the server. */ - _onFileActivity: function WCCP__onFileActivity(aType, aPacket) + _onFileActivity: function WCCP__onFileActivity(type, packet) { - if (this.owner && aPacket.from == this._consoleActor) { - this.owner.handleFileActivity(aPacket.uri); + if (this.webConsoleFrame && packet.from == this._consoleActor) { + this.webConsoleFrame.handleFileActivity(packet.uri); } }, - _onReflowActivity: function WCCP__onReflowActivity(aType, aPacket) + _onReflowActivity: function WCCP__onReflowActivity(type, packet) { - if (this.owner && aPacket.from == this._consoleActor) { - this.owner.handleReflowActivity(aPacket); + if (this.webConsoleFrame && packet.from == this._consoleActor) { + this.webConsoleFrame.handleReflowActivity(packet); } }, @@ -5265,15 +5267,15 @@ WebConsoleConnectionProxy.prototype = { * the UI for displaying. * * @private - * @param string aType + * @param string type * Message type. - * @param object aPacket + * @param object packet * The message received from the server. */ - _onServerLogCall: function WCCP__onServerLogCall(aType, aPacket) + _onServerLogCall: function WCCP__onServerLogCall(type, packet) { - if (this.owner && aPacket.from == this._consoleActor) { - this.owner.handleConsoleAPICall(aPacket.message); + if (this.webConsoleFrame && packet.from == this._consoleActor) { + this.webConsoleFrame.handleConsoleAPICall(packet.message); } }, @@ -5282,16 +5284,16 @@ WebConsoleConnectionProxy.prototype = { * received the Web Console UI is cleared. * * @private - * @param string aType + * @param string type * Message type. - * @param object aPacket + * @param object packet * The message received from the server. */ _onLastPrivateContextExited: - function WCCP__onLastPrivateContextExited(aType, aPacket) + function WCCP__onLastPrivateContextExited(type, packet) { - if (this.owner && aPacket.from == this._consoleActor) { - this.owner.jsterm.clearPrivateMessages(); + if (this.webConsoleFrame && packet.from == this._consoleActor) { + this.webConsoleFrame.jsterm.clearPrivateMessages(); } }, @@ -5300,30 +5302,30 @@ WebConsoleConnectionProxy.prototype = { * to the UI for displaying. * * @private - * @param string aEvent + * @param string event * Event type. - * @param object aPacket + * @param object packet * The message received from the server. */ - _onTabNavigated: function WCCP__onTabNavigated(aEvent, aPacket) + _onTabNavigated: function WCCP__onTabNavigated(event, packet) { - if (!this.owner) { + if (!this.webConsoleFrame) { return; } - this.owner.handleTabNavigated(aEvent, aPacket); + this.webConsoleFrame.handleTabNavigated(event, packet); }, /** * Release an object actor. * - * @param string aActor + * @param string actor * The actor ID to send the request to. */ - releaseActor: function WCCP_releaseActor(aActor) + releaseActor: function WCCP_releaseActor(actor) { if (this.client) { - this.client.release(aActor); + this.client.release(actor); } }, @@ -5362,7 +5364,7 @@ WebConsoleConnectionProxy.prototype = { this.webConsoleClient = null; this.target = null; this.connected = false; - this.owner = null; + this.webConsoleFrame = null; this._disconnecter.resolve(null); return this._disconnecter.promise; @@ -5383,12 +5385,12 @@ gSequenceId.n = 0; * ConsoleContextMenu this used to handle the visibility of context menu items. * * @constructor - * @param object aOwner + * @param object owner * The WebConsoleFrame instance that owns this object. */ -function ConsoleContextMenu(aOwner) +function ConsoleContextMenu(owner) { - this.owner = aOwner; + this.owner = owner; this.popup = this.owner.document.getElementById("output-contextmenu"); this.build = this.build.bind(this); this.popup.addEventListener("popupshowing", this.build); @@ -5400,9 +5402,9 @@ ConsoleContextMenu.prototype = { /* * Handle to show/hide context menu item. */ - build: function CCM_build(aEvent) + build: function CCM_build(event) { - let metadata = this.getSelectionMetadata(aEvent.rangeParent); + let metadata = this.getSelectionMetadata(event.rangeParent); for (let element of this.popup.children) { element.hidden = this.shouldHideMenuItem(element, metadata); } @@ -5411,12 +5413,12 @@ ConsoleContextMenu.prototype = { /* * Get selection information from the view. * - * @param nsIDOMElement aClickElement + * @param nsIDOMElement clickElement * The DOM element the user clicked on. * @return object * Selection metadata. */ - getSelectionMetadata: function CCM_getSelectionMetadata(aClickElement) + getSelectionMetadata: function CCM_getSelectionMetadata(clickElement) { let metadata = { selectionType: "", @@ -5424,7 +5426,7 @@ ConsoleContextMenu.prototype = { }; let selectedItems = this.owner.output.getSelectedMessages(); if (!selectedItems.length) { - let clickedItem = this.owner.output.getMessageForElement(aClickElement); + let clickedItem = this.owner.output.getMessageForElement(clickElement); if (clickedItem) { this.lastClickedMessage = clickedItem; selectedItems = [clickedItem]; @@ -5460,26 +5462,26 @@ ConsoleContextMenu.prototype = { /* * Determine if an item should be hidden. * - * @param nsIDOMElement aMenuItem - * @param object aMetadata + * @param nsIDOMElement menuItem + * @param object metadata * @return boolean * Whether the given item should be hidden or not. */ - shouldHideMenuItem: function CCM_shouldHideMenuItem(aMenuItem, aMetadata) + shouldHideMenuItem: function CCM_shouldHideMenuItem(menuItem, metadata) { - let selectionType = aMenuItem.getAttribute("selectiontype"); - if (selectionType && !aMetadata.selectionType == selectionType) { + let selectionType = menuItem.getAttribute("selectiontype"); + if (selectionType && !metadata.selectionType == selectionType) { return true; } - let selection = aMenuItem.getAttribute("selection"); + let selection = menuItem.getAttribute("selection"); if (!selection) { return false; } let shouldHide = true; let itemData = selection.split("|"); - for (let type of aMetadata.selection) { + for (let type of metadata.selection) { // check whether this menu item should show or not. if (itemData.indexOf(type) !== -1) { shouldHide = false; diff --git a/dom/cellbroadcast/tests/marionette/manifest.ini b/dom/cellbroadcast/tests/marionette/manifest.ini index 3e2293bf7daf..8b440e887dd0 100644 --- a/dom/cellbroadcast/tests/marionette/manifest.ini +++ b/dom/cellbroadcast/tests/marionette/manifest.ini @@ -6,6 +6,8 @@ qemu = true [test_cellbroadcast_etws.js] [test_cellbroadcast_gsm.js] [test_cellbroadcast_gsm_language_and_body.js] +disabled = Bug 1231462 [test_cellbroadcast_multi_sim.js] [test_cellbroadcast_umts.js] -[test_cellbroadcast_umts_language_and_body.js] \ No newline at end of file +[test_cellbroadcast_umts_language_and_body.js] +disabled = Bug 1224992 diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp index 0627f2dc7b93..0ac81bf18d44 100644 --- a/dom/quota/ActorsParent.cpp +++ b/dom/quota/ActorsParent.cpp @@ -1302,21 +1302,18 @@ struct StorageDirectoryHelper::OriginProps nsCOMPtr mDirectory; nsCString mSpec; - uint32_t mAppId; + PrincipalOriginAttributes mAttrs; int64_t mTimestamp; nsCString mGroup; nsCString mOrigin; Type mType; - bool mInMozBrowser; bool mIsApp; public: explicit OriginProps() - : mAppId(kNoAppId) - , mTimestamp(0) + : mTimestamp(0) , mType(eContent) - , mInMozBrowser(false) , mIsApp(false) { } }; @@ -1383,14 +1380,11 @@ public: static bool ParseOrigin(const nsACString& aOrigin, - uint32_t* aAppId, - bool* aInMozBrowser, - nsCString& aSpec); + nsCString& aSpec, + PrincipalOriginAttributes* aAttrs); bool - Parse(uint32_t* aAppId, - bool* aInMozBrowser, - nsACString& aSpec); + Parse(nsACString& aSpec, PrincipalOriginAttributes* aAttrs); private: void @@ -5992,19 +5986,18 @@ StorageDirectoryHelper::AddOriginDirectory(nsIFile* aDirectory) originProps->mType = OriginProps::eChrome; } else { nsCString spec; - uint32_t appId; - bool inMozBrowser; - if (NS_WARN_IF(!OriginParser::ParseOrigin(NS_ConvertUTF16toUTF8(leafName), - &appId, &inMozBrowser, spec))) { + PrincipalOriginAttributes attrs; + bool result = OriginParser::ParseOrigin(NS_ConvertUTF16toUTF8(leafName), + spec, &attrs); + if (NS_WARN_IF(!result)) { return NS_ERROR_FAILURE; } OriginProps* originProps = mOriginProps.AppendElement(); originProps->mDirectory = aDirectory; originProps->mSpec = spec; - originProps->mAppId = appId; + originProps->mAttrs = attrs; originProps->mType = OriginProps::eContent; - originProps->mInMozBrowser = inMozBrowser; if (mCreate) { int64_t timestamp = INT64_MIN; @@ -6178,17 +6171,10 @@ StorageDirectoryHelper::RunOnMainThread() return rv; } - nsCOMPtr principal; - if (originProps.mAppId == kUnknownAppId) { - rv = secMan->GetSimpleCodebasePrincipal(uri, - getter_AddRefs(principal)); - } else { - PrincipalOriginAttributes attrs(originProps.mAppId, originProps.mInMozBrowser); - principal = BasePrincipal::CreateCodebasePrincipal(uri, attrs); - rv = principal ? NS_OK : NS_ERROR_FAILURE; - } - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; + nsCOMPtr principal = + BasePrincipal::CreateCodebasePrincipal(uri, originProps.mAttrs); + if (NS_WARN_IF(!principal)) { + return NS_ERROR_FAILURE; } if (mCreate) { @@ -6239,30 +6225,20 @@ StorageDirectoryHelper::Run() // static bool OriginParser::ParseOrigin(const nsACString& aOrigin, - uint32_t* aAppId, - bool* aInMozBrowser, - nsCString& aSpec) + nsCString& aSpec, + PrincipalOriginAttributes* aAttrs) { MOZ_ASSERT(!aOrigin.IsEmpty()); - MOZ_ASSERT(aAppId); - MOZ_ASSERT(aInMozBrowser); + MOZ_ASSERT(aAttrs); OriginParser parser(aOrigin); - - if (!parser.Parse(aAppId, aInMozBrowser, aSpec)) { - return false; - } - - return true; + return parser.Parse(aSpec, aAttrs); } bool -OriginParser::Parse(uint32_t* aAppId, - bool* aInMozBrowser, - nsACString& aSpec) +OriginParser::Parse(nsACString& aSpec, PrincipalOriginAttributes* aAttrs) { - MOZ_ASSERT(aAppId); - MOZ_ASSERT(aInMozBrowser); + MOZ_ASSERT(aAttrs); while (mTokenizer.hasMoreTokens()) { const nsDependentCSubstring& token = mTokenizer.nextToken(); @@ -6294,8 +6270,7 @@ OriginParser::Parse(uint32_t* aAppId, MOZ_ASSERT(mState == eComplete || mState == eHandledTrailingSeparator); - *aAppId = mAppId; - *aInMozBrowser = mInMozBrowser; + *aAttrs = PrincipalOriginAttributes(mAppId, mInMozBrowser); nsAutoCString spec(mSchema); diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index c7083a138005..ee4cc8a32ac2 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -75,6 +75,7 @@ import org.mozilla.gecko.util.MenuUtils; import org.mozilla.gecko.util.NativeEventListener; import org.mozilla.gecko.util.NativeJSObject; import org.mozilla.gecko.util.PrefUtils; +import org.mozilla.gecko.util.ScreenshotObserver; import org.mozilla.gecko.util.StringUtils; import org.mozilla.gecko.util.ThreadUtils; import org.mozilla.gecko.util.UIAsyncTask; @@ -88,6 +89,7 @@ import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.ContentResolver; +import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -107,6 +109,7 @@ import android.nfc.NfcEvent; import android.os.Build; import android.os.Bundle; import android.os.StrictMode; +import android.provider.MediaStore; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; @@ -268,6 +271,7 @@ public class BrowserApp extends GeckoApp private boolean mHideWebContentOnAnimationEnd; private final DynamicToolbar mDynamicToolbar = new DynamicToolbar(); + private final ScreenshotObserver mScreenshotObserver = new ScreenshotObserver(); @Override public View onCreateView(final String name, final Context context, final AttributeSet attrs) { @@ -726,6 +730,15 @@ public class BrowserApp extends GeckoApp } }); + // Watch for screenshots while browser is in foreground. + mScreenshotObserver.setListener(getContext(), new ScreenshotObserver.OnScreenshotListener() { + @Override + public void onScreenshotTaken(String data, String title) { + // Treat screenshots as a sharing method. + Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.BUTTON, "screenshot"); + } + }); + // Set the maximum bits-per-pixel the favicon system cares about. IconDirectoryEntry.setMaxBPP(GeckoAppShell.getScreenDepth()); } @@ -905,6 +918,8 @@ public class BrowserApp extends GeckoApp "Prompt:ShowTop"); processTabQueue(); + + mScreenshotObserver.start(); } @Override @@ -917,6 +932,8 @@ public class BrowserApp extends GeckoApp // Register for Prompt:ShowTop so we can foreground this activity even if it's hidden. EventDispatcher.getInstance().registerGeckoThreadListener((GeckoEventListener) this, "Prompt:ShowTop"); + + mScreenshotObserver.stop(); } @Override diff --git a/mobile/android/base/java/org/mozilla/gecko/util/ScreenshotObserver.java b/mobile/android/base/java/org/mozilla/gecko/util/ScreenshotObserver.java new file mode 100644 index 000000000000..62f82e38f59d --- /dev/null +++ b/mobile/android/base/java/org/mozilla/gecko/util/ScreenshotObserver.java @@ -0,0 +1,129 @@ +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- + * 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/. */ + +package org.mozilla.gecko.util; + +import org.mozilla.gecko.AppConstants.Versions; +import org.mozilla.gecko.util.ThreadUtils; + +import android.content.ContentResolver; +import android.content.Context; +import android.database.ContentObserver; +import android.database.Cursor; +import android.net.Uri; +import android.provider.MediaStore; +import android.util.Log; + +public class ScreenshotObserver { + private static final String LOGTAG = "GeckoScreenshotObserver"; + public Context context; + + /** + * Listener for screenshot changes. + */ + public interface OnScreenshotListener { + /** + * This callback is executed on the UI thread. + */ + public void onScreenshotTaken(String data, String title); + } + + private OnScreenshotListener listener; + + public ScreenshotObserver() { + } + + public void setListener(Context context, OnScreenshotListener listener) { + this.context = context; + this.listener = listener; + } + + private MediaObserver mediaObserver; + private String[] mediaProjections = new String[] { + MediaStore.Images.ImageColumns.DATA, + MediaStore.Images.ImageColumns.DISPLAY_NAME, + MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME, + MediaStore.Images.ImageColumns.DATE_TAKEN, + MediaStore.Images.ImageColumns.TITLE + }; + + public void start() { + if (!Versions.feature14Plus) { + return; + } + + try { + if (mediaObserver == null) { + mediaObserver = new MediaObserver(); + context.getContentResolver().registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, false, mediaObserver); + } + } catch (Exception e) { + Log.e(LOGTAG, "Failure to start watching media: ", e); + } + } + + public void stop() { + if (!Versions.feature14Plus) { + return; + } + + try { + context.getContentResolver().unregisterContentObserver(mediaObserver); + mediaObserver = null; + } catch (Exception e) { + Log.e(LOGTAG, "Failure to stop watching media: ", e); + } + } + + public void onMediaChange(final Uri uri) { + // Make sure we are on not on the main thread. + final ContentResolver cr = context.getContentResolver(); + ThreadUtils.postToBackgroundThread(new Runnable() { + @Override + public void run() { + // Find the most recent image added to the MediaStore and see if it's a screenshot. + try { + Cursor cursor = cr.query(uri, mediaProjections, null, null, MediaStore.Images.ImageColumns.DATE_ADDED + " DESC LIMIT 1"); + if (cursor == null) { + return; + } + + while (cursor.moveToNext()) { + String data = cursor.getString(0); + Log.i(LOGTAG, "data: " + data); + String display = cursor.getString(1); + Log.i(LOGTAG, "display: " + display); + String album = cursor.getString(2); + Log.i(LOGTAG, "album: " + album); + long date = cursor.getLong(3); + String title = cursor.getString(4); + Log.i(LOGTAG, "title: " + title); + if (album != null && album.toLowerCase().contains("screenshot")) { + if (listener != null) { + listener.onScreenshotTaken(data, title); + break; + } + } + } + cursor.close(); + } catch (Exception e) { + Log.e(LOGTAG, "Failure to process media change: ", e); + } + } + }); + } + + private class MediaObserver extends ContentObserver { + public MediaObserver() { + super(null); + } + + @Override + public void onChange(boolean selfChange) { + super.onChange(selfChange); + onMediaChange(MediaStore.Images.Media.EXTERNAL_CONTENT_URI); + } + } +} diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index a6bf84df08f8..994480d32084 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -118,6 +118,7 @@ gujar.sources += ['java/org/mozilla/gecko/' + x for x in [ 'util/PrefUtils.java', 'util/ProxySelector.java', 'util/RawResource.java', + 'util/ScreenshotObserver.java', 'util/StringUtils.java', 'util/ThreadUtils.java', 'util/UIAsyncTask.java', diff --git a/mobile/android/components/HelperAppDialog.js b/mobile/android/components/HelperAppDialog.js index b40766c0bb17..8706d7343bfb 100644 --- a/mobile/android/components/HelperAppDialog.js +++ b/mobile/android/components/HelperAppDialog.js @@ -8,6 +8,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; const APK_MIME_TYPE = "application/vnd.android.package-archive"; +const OMA_DOWNLOAD_DESCRIPTOR_MIME_TYPE = "application/vnd.oma.dd+xml"; const PREF_BD_USEDOWNLOADDIR = "browser.download.useDownloadDir"; const URI_GENERIC_ICON_DOWNLOAD = "drawable://alert_download"; @@ -94,25 +95,23 @@ HelperAppLauncherDialog.prototype = { let mimeType = this._getMimeTypeFromLauncher(launcher); // Straight equality: nsIMIMEInfo normalizes. - return APK_MIME_TYPE == mimeType; + return APK_MIME_TYPE == mimeType || OMA_DOWNLOAD_DESCRIPTOR_MIME_TYPE == mimeType; + }, + + /** + * Returns true if `launcher` represents a download for which we wish to + * offer a "Save to disk" option. + */ + _shouldAddSaveToDiskIntent: function(launcher) { + let mimeType = this._getMimeTypeFromLauncher(launcher); + + // We can't handle OMA downloads. So don't even try. (Bug 1219078) + return mimeType != OMA_DOWNLOAD_DESCRIPTOR_MIME_TYPE; }, show: function hald_show(aLauncher, aContext, aReason) { if (!this._canDownload(aLauncher.source)) { - aLauncher.cancel(Cr.NS_BINDING_ABORTED); - - let win = this.getNativeWindow(); - if (!win) { - // Oops. - Services.console.logStringMessage("Refusing download, but can't show a toast."); - return; - } - - Services.console.logStringMessage("Refusing download of non-downloadable file."); - let bundle = Services.strings.createBundle("chrome://browser/locale/handling.properties"); - let failedText = bundle.GetStringFromName("download.blocked"); - win.toast.show(failedText, "long"); - + this._refuseDownload(aLauncher); return; } @@ -123,19 +122,27 @@ HelperAppLauncherDialog.prototype = { mimeType: aLauncher.MIMEInfo.MIMEType, }); - // Add a fake intent for save to disk at the top of the list. - apps.unshift({ - name: bundle.GetStringFromName("helperapps.saveToDisk"), - packageName: "org.mozilla.gecko.Download", - iconUri: "drawable://icon", - selected: true, // Default to download for files - launch: function() { - // Reset the preferredAction here. - aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.saveToDisk; - aLauncher.saveToDisk(null, false); - return true; - } - }); + if (this._shouldAddSaveToDiskIntent(aLauncher)) { + // Add a fake intent for save to disk at the top of the list. + apps.unshift({ + name: bundle.GetStringFromName("helperapps.saveToDisk"), + packageName: "org.mozilla.gecko.Download", + iconUri: "drawable://icon", + selected: true, // Default to download for files + launch: function() { + // Reset the preferredAction here. + aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.saveToDisk; + aLauncher.saveToDisk(null, false); + return true; + } + }); + } + + // We do not handle this download and there are no apps that want to do it + if (apps.length === 0) { + this._refuseDownload(aLauncher); + return; + } let callback = function(app) { aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.useHelperApp; @@ -187,6 +194,22 @@ HelperAppLauncherDialog.prototype = { }); }, + _refuseDownload: function(aLauncher) { + aLauncher.cancel(Cr.NS_BINDING_ABORTED); + + let win = this.getNativeWindow(); + if (!win) { + // Oops. + Services.console.logStringMessage("Refusing download, but can't show a toast."); + return; + } + + Services.console.logStringMessage("Refusing download of non-downloadable file."); + let bundle = Services.strings.createBundle("chrome://browser/locale/handling.properties"); + let failedText = bundle.GetStringFromName("download.blocked"); + win.toast.show(failedText, "long"); + }, + _getPrefName: function getPrefName(mimetype) { return "browser.download.preferred." + mimetype.replace("\\", "."); }, diff --git a/toolkit/components/reader/ReaderMode.jsm b/toolkit/components/reader/ReaderMode.jsm index 2890e1ebe85c..dd1756197a3f 100644 --- a/toolkit/components/reader/ReaderMode.jsm +++ b/toolkit/components/reader/ReaderMode.jsm @@ -228,7 +228,18 @@ this.ReaderMode = { } } } - if (xhr.responseURL != url) { + let responseURL = xhr.responseURL; + let givenURL = url; + // Convert these to real URIs to make sure the escaping (or lack + // thereof) is identical: + try { + responseURL = Services.io.newURI(responseURL, null, null).spec; + } catch (ex) { /* Ignore errors - we'll use what we had before */ } + try { + givenURL = Services.io.newURI(givenURL, null, null).spec; + } catch (ex) { /* Ignore errors - we'll use what we had before */ } + + if (responseURL != givenURL) { // We were redirected without a meta refresh tag. // Force redirect to the correct place: reject({newURL: xhr.responseURL}); diff --git a/toolkit/mozapps/extensions/test/browser/browser_experiments.js b/toolkit/mozapps/extensions/test/browser/browser_experiments.js index 766ea12edee8..3920d667d815 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_experiments.js +++ b/toolkit/mozapps/extensions/test/browser/browser_experiments.js @@ -98,6 +98,7 @@ add_task(function* initializeState() { registerCleanupFunction(() => { Services.prefs.clearUserPref("experiments.enabled"); + Services.prefs.clearUserPref("toolkit.telemetry.enabled"); if (gHttpServer) { gHttpServer.stop(() => {}); if (gSavedManifestURI !== undefined) { @@ -294,6 +295,7 @@ add_task(function* testActivateExperiment() { // We need to remove the cache file to help ensure consistent state. yield OS.File.remove(gExperiments._cacheFilePath); + Services.prefs.setBoolPref("toolkit.telemetry.enabled", true); Services.prefs.setBoolPref("experiments.enabled", true); info("Initializing experiments service."); @@ -635,6 +637,8 @@ add_task(function* testCleanup() { yield OS.File.remove(gExperiments._cacheFilePath); yield gExperiments.uninit(); yield gExperiments.init(); + + Services.prefs.clearUserPref("toolkit.telemetry.enabled"); } // Check post-conditions. diff --git a/toolkit/themes/linux/global/jar.mn b/toolkit/themes/linux/global/jar.mn index 5a5b33016c20..deab55daf718 100644 --- a/toolkit/themes/linux/global/jar.mn +++ b/toolkit/themes/linux/global/jar.mn @@ -57,3 +57,5 @@ toolkit.jar: * skin/classic/global/in-content/common.css (in-content/common.css) * skin/classic/global/in-content/info-pages.css (in-content/info-pages.css) skin/classic/global/toolbar/spring.png (toolbar/spring.png) + skin/classic/global/tree/twisty-clsd.png (tree/twisty-clsd.png) + skin/classic/global/tree/twisty-open.png (tree/twisty-open.png) diff --git a/toolkit/themes/windows/global/tree/twisty-clsd.png b/toolkit/themes/linux/global/tree/twisty-clsd.png similarity index 100% rename from toolkit/themes/windows/global/tree/twisty-clsd.png rename to toolkit/themes/linux/global/tree/twisty-clsd.png diff --git a/toolkit/themes/windows/global/tree/twisty-open.png b/toolkit/themes/linux/global/tree/twisty-open.png similarity index 100% rename from toolkit/themes/windows/global/tree/twisty-open.png rename to toolkit/themes/linux/global/tree/twisty-open.png diff --git a/toolkit/themes/shared/alert-common.css b/toolkit/themes/shared/alert-common.css index af7fd0c5d6e1..20d9e7b00cff 100644 --- a/toolkit/themes/shared/alert-common.css +++ b/toolkit/themes/shared/alert-common.css @@ -10,11 +10,6 @@ @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); -#alertBox[hasBodyText] > #alertTextBox, -#alertBox[hasOrigin] > #alertTitleBox { - border-bottom: 1px solid ThreeDShadow; -} - #alertBox[animate] { animation-timing-function: cubic-bezier(.12,1.23,.48,1.09); } @@ -59,22 +54,30 @@ } #alertImage { - width: 64px; + width: 80px; + height: 80px; + max-width: 80px; + max-height: 80px; + object-fit: scale-down; + margin: 0 7px 7px; } .alertTextBox { - padding-top: 8px; - padding-inline-start: 8px; + padding-top: 4px; /* The text box width is increased to make up for the lack of image when one - is not provided. 319px is the text box width when a picture is present, - 255px, plus the width of the image, 64px. */ - width: 319px; + is not provided. 349px is the text box width when a picture is present, + 255px, plus the width of the image, 80px, and the margins, 7px each. */ + width: 349px; } #alertBox[hasImage] > box > #alertTextBox { width: 255px; } +#alertBox:not([hasImage]) > box > #alertTextBox { + padding-inline-start: 8px; +} + #alertTextLabel { padding-inline-end: 8px; } @@ -82,13 +85,17 @@ .alertTitle { -moz-box-flex: 1; font-weight: bold; - padding: 6px 8px; + padding: 6px 8px 0; width: 255px; } #alertFooter { - -moz-box-align: end; - padding-bottom: 2px; + -moz-box-align: start; +} + +#alertBox:not([hasOrigin]) > box > #alertTextBox, +#alertFooter { + padding-bottom: 5px; } #alertSourceLabel { @@ -103,7 +110,7 @@ border-width: 0; border-radius: 20px; min-width: 0; - list-style-image: url("chrome://mozapps/skin/extensions/utilities.svg#utilities"); + list-style-image: url("chrome://mozapps/skin/extensions/utilities.svg#utilities-grayscale"); margin-inline-end: 0; margin-bottom: 0; } diff --git a/toolkit/themes/shared/extensions/utilities.svg b/toolkit/themes/shared/extensions/utilities.svg index bc93fba236fd..8bf24458ce07 100644 --- a/toolkit/themes/shared/extensions/utilities.svg +++ b/toolkit/themes/shared/extensions/utilities.svg @@ -13,6 +13,9 @@ use[id$="-native"] { fill: GrayText; } + use[id$="-grayscale"] { + fill: #4d4d4d; + } use[id$="-inverted"] { fill: #ddd; } @@ -22,5 +25,6 @@ + diff --git a/toolkit/themes/shared/non-mac.jar.inc.mn b/toolkit/themes/shared/non-mac.jar.inc.mn index c009ee93e736..a3d1ae46458a 100644 --- a/toolkit/themes/shared/non-mac.jar.inc.mn +++ b/toolkit/themes/shared/non-mac.jar.inc.mn @@ -131,14 +131,6 @@ skin/classic/global/tree/sort-dsc.png (../../windows/global/tree/sort-dsc.png) skin/classic/global/tree/sort-asc-classic.png (../../windows/global/tree/sort-asc-classic.png) skin/classic/global/tree/sort-dsc-classic.png (../../windows/global/tree/sort-dsc-classic.png) - skin/classic/global/tree/twisty-clsd.png (../../windows/global/tree/twisty-clsd.png) - skin/classic/global/tree/twisty-clsd-rtl.png (../../windows/global/tree/twisty-clsd-rtl.png) - skin/classic/global/tree/twisty-clsd-hover.png (../../windows/global/tree/twisty-clsd-hover.png) - skin/classic/global/tree/twisty-clsd-hover-rtl.png (../../windows/global/tree/twisty-clsd-hover-rtl.png) - skin/classic/global/tree/twisty-open.png (../../windows/global/tree/twisty-open.png) - skin/classic/global/tree/twisty-open-rtl.png (../../windows/global/tree/twisty-open-rtl.png) - skin/classic/global/tree/twisty-open-hover.png (../../windows/global/tree/twisty-open-hover.png) - skin/classic/global/tree/twisty-open-hover-rtl.png (../../windows/global/tree/twisty-open-hover-rtl.png) skin/classic/help/Toolbar.png (../../windows/help/Toolbar.png) skin/classic/help/Toolbar-rtl.png (../../windows/help/Toolbar-rtl.png) diff --git a/toolkit/themes/windows/global/alerts/alert.css b/toolkit/themes/windows/global/alerts/alert.css index e0667adf84ed..ce7f259126a3 100644 --- a/toolkit/themes/windows/global/alerts/alert.css +++ b/toolkit/themes/windows/global/alerts/alert.css @@ -30,21 +30,23 @@ border: none !important; } +.alertCloseBox { + /* The close button is larger on Windows and has a large + circle around it, so we add more space between the close + button and the edge of the window. */ + margin-inline-end: 2px; +} + #alertSettings { /* The close button is larger on Windows, so the gear button is moved over to accomodate it and keep the two buttons horizontally aligned together. */ - margin-inline-end: 3px; + margin-inline-end: 5px; } @media (-moz-windows-default-theme) { - #alertBox[hasBodyText] > #alertTextBox, - #alertBox[hasOrigin] > #alertTitleBox { - border-bottom-color: rgba(107,107,107,.4); - } - #alertBox { - border-color: rgba(107,107,107,.4); + border-color: rgba(107,107,107,.3); background-color: rgba(255,255,255,.9); color: rgba(0,0,0,.9); } diff --git a/toolkit/themes/windows/global/button.css b/toolkit/themes/windows/global/button.css index 066196c7bd3d..f882f8e0796a 100644 --- a/toolkit/themes/windows/global/button.css +++ b/toolkit/themes/windows/global/button.css @@ -138,11 +138,11 @@ button[type="disclosure"] { margin: 0px !important; padding: 0px !important; -moz-appearance: none; - list-style-image: url("chrome://global/skin/tree/twisty-clsd.png"); + list-style-image: url("chrome://global/skin/tree/twisty.svg#clsd"); min-width: 0px !important; background-color: transparent; } button[type="disclosure"][open="true"] { - list-style-image: url("chrome://global/skin/tree/twisty-open.png"); + list-style-image: url("chrome://global/skin/tree/twisty.svg#open"); } diff --git a/toolkit/themes/windows/global/jar.mn b/toolkit/themes/windows/global/jar.mn index a6e6bd920981..04509550e945 100644 --- a/toolkit/themes/windows/global/jar.mn +++ b/toolkit/themes/windows/global/jar.mn @@ -93,8 +93,9 @@ toolkit.jar: skin/classic/global/toolbar/spring-XP.png (toolbar/spring-XP.png) skin/classic/global/tree/sort-asc-XP.png (tree/sort-asc-XP.png) skin/classic/global/tree/sort-dsc-XP.png (tree/sort-dsc-XP.png) - skin/classic/global/tree/twisty-clsd-XP.png (tree/twisty-clsd-XP.png) - skin/classic/global/tree/twisty-open-XP.png (tree/twisty-open-XP.png) + skin/classic/global/tree/twisty.svg (tree/twisty.svg) + skin/classic/global/tree/twisty-XP.svg (tree/twisty-XP.svg) + skin/classic/global/tree/twisty-Vista78.svg (tree/twisty-Vista78.svg) #if MOZ_BUILD_APP == browser [browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar: @@ -137,10 +138,20 @@ toolkit.jar: % override chrome://global/skin/toolbar/spring.png chrome://global/skin/toolbar/spring-XP.png osversion<6 % override chrome://global/skin/tree/sort-asc.png chrome://global/skin/tree/sort-asc-XP.png osversion<6 % override chrome://global/skin/tree/sort-dsc.png chrome://global/skin/tree/sort-dsc-XP.png osversion<6 -% override chrome://global/skin/tree/twisty-clsd.png chrome://global/skin/tree/twisty-clsd-XP.png osversion<6 -% override chrome://global/skin/tree/twisty-open.png chrome://global/skin/tree/twisty-open-XP.png osversion<6 % override chrome://global/skin/icons/close.png chrome://global/skin/icons/close-XPVista7.png osversion<=6.1 % override chrome://global/skin/icons/close@2x.png chrome://global/skin/icons/close-XPVista7@2x.png osversion<=6.1 % override chrome://global/skin/icons/close-inverted.png chrome://global/skin/icons/close-inverted-XPVista7.png osversion<=6.1 % override chrome://global/skin/icons/close-inverted@2x.png chrome://global/skin/icons/close-inverted-XPVista7@2x.png osversion<=6.1 + +% override chrome://global/skin/tree/twisty.svg#clsd chrome://global/skin/tree/twisty-Vista78.svg#clsd osversion<=6.3 +% override chrome://global/skin/tree/twisty.svg#clsd-rtl chrome://global/skin/tree/twisty-Vista78.svg#clsd-rtl osversion<=6.3 +% override chrome://global/skin/tree/twisty.svg#clsd-hover chrome://global/skin/tree/twisty-Vista78.svg#clsd-hover osversion<=6.3 +% override chrome://global/skin/tree/twisty.svg#clsd-hover-rtl chrome://global/skin/tree/twisty-Vista78.svg#clsd-hover-rtl osversion<=6.3 +% override chrome://global/skin/tree/twisty.svg#open chrome://global/skin/tree/twisty-Vista78.svg#open osversion<=6.3 +% override chrome://global/skin/tree/twisty.svg#open-rtl chrome://global/skin/tree/twisty-Vista78.svg#open-rtl osversion<=6.3 +% override chrome://global/skin/tree/twisty.svg#open-hover chrome://global/skin/tree/twisty-Vista78.svg#open-hover osversion<=6.3 +% override chrome://global/skin/tree/twisty.svg#open-hover-rtl chrome://global/skin/tree/twisty-Vista78.svg#open-hover-rtl osversion<=6.3 +# to be sure osversion<6 has always higher precedence than osversion<=6.3 we override twisty-Vista78.svg instead of twisty.svg +% override chrome://global/skin/tree/twisty-Vista78.svg#clsd chrome://global/skin/tree/twisty-XP.svg#clsd osversion<6 +% override chrome://global/skin/tree/twisty-Vista78.svg#open chrome://global/skin/tree/twisty-XP.svg#open osversion<6 diff --git a/toolkit/themes/windows/global/tree.css b/toolkit/themes/windows/global/tree.css index 0bed1d66192b..56c15b86fcbe 100644 --- a/toolkit/themes/windows/global/tree.css +++ b/toolkit/themes/windows/global/tree.css @@ -317,12 +317,11 @@ treechildren::-moz-tree-twisty { -moz-padding-end: 4px; padding-top: 1px; width: 9px; /* The image's width is 9 pixels */ - list-style-image: url("chrome://global/skin/tree/twisty-clsd.png"); + list-style-image: url("chrome://global/skin/tree/twisty.svg#clsd"); } treechildren::-moz-tree-twisty(open) { - width: 9px; /* The image's width is 9 pixels */ - list-style-image: url("chrome://global/skin/tree/twisty-open.png"); + list-style-image: url("chrome://global/skin/tree/twisty.svg#open"); } treechildren::-moz-tree-indentation { @@ -373,31 +372,30 @@ treechildren::-moz-tree-cell-text(selected, editing) { treechildren::-moz-tree-twisty { -moz-padding-end: 1px; - width: 9px; } treechildren::-moz-tree-twisty(hover) { - list-style-image: url("chrome://global/skin/tree/twisty-clsd-hover.png"); + list-style-image: url("chrome://global/skin/tree/twisty.svg#clsd-hover"); } treechildren::-moz-tree-twisty(hover, open) { - list-style-image: url("chrome://global/skin/tree/twisty-open-hover.png"); + list-style-image: url("chrome://global/skin/tree/twisty.svg#open-hover"); } treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty { - list-style-image: url("chrome://global/skin/tree/twisty-clsd-rtl.png"); + list-style-image: url("chrome://global/skin/tree/twisty.svg#clsd-rtl"); } treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty(open) { - list-style-image: url("chrome://global/skin/tree/twisty-open-rtl.png"); + list-style-image: url("chrome://global/skin/tree/twisty.svg#open-rtl"); } treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty(hover) { - list-style-image: url("chrome://global/skin/tree/twisty-clsd-hover-rtl.png"); + list-style-image: url("chrome://global/skin/tree/twisty.svg#clsd-hover-rtl"); } treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty(hover, open) { - list-style-image: url("chrome://global/skin/tree/twisty-open-hover-rtl.png"); + list-style-image: url("chrome://global/skin/tree/twisty.svg#open-hover-rtl"); } @media (-moz-windows-default-theme) { diff --git a/toolkit/themes/windows/global/tree/twisty-Vista78.svg b/toolkit/themes/windows/global/tree/twisty-Vista78.svg new file mode 100644 index 000000000000..0a6908634675 --- /dev/null +++ b/toolkit/themes/windows/global/tree/twisty-Vista78.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + diff --git a/toolkit/themes/windows/global/tree/twisty-XP.svg b/toolkit/themes/windows/global/tree/twisty-XP.svg new file mode 100644 index 000000000000..66219d513e95 --- /dev/null +++ b/toolkit/themes/windows/global/tree/twisty-XP.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/toolkit/themes/windows/global/tree/twisty-clsd-XP.png b/toolkit/themes/windows/global/tree/twisty-clsd-XP.png deleted file mode 100644 index 7fe7fb542f47..000000000000 Binary files a/toolkit/themes/windows/global/tree/twisty-clsd-XP.png and /dev/null differ diff --git a/toolkit/themes/windows/global/tree/twisty-clsd-hover-rtl.png b/toolkit/themes/windows/global/tree/twisty-clsd-hover-rtl.png deleted file mode 100644 index 1b651975884e..000000000000 Binary files a/toolkit/themes/windows/global/tree/twisty-clsd-hover-rtl.png and /dev/null differ diff --git a/toolkit/themes/windows/global/tree/twisty-clsd-hover.png b/toolkit/themes/windows/global/tree/twisty-clsd-hover.png deleted file mode 100644 index 763c1da1c187..000000000000 Binary files a/toolkit/themes/windows/global/tree/twisty-clsd-hover.png and /dev/null differ diff --git a/toolkit/themes/windows/global/tree/twisty-clsd-rtl.png b/toolkit/themes/windows/global/tree/twisty-clsd-rtl.png deleted file mode 100644 index 02f4e32c375e..000000000000 Binary files a/toolkit/themes/windows/global/tree/twisty-clsd-rtl.png and /dev/null differ diff --git a/toolkit/themes/windows/global/tree/twisty-open-XP.png b/toolkit/themes/windows/global/tree/twisty-open-XP.png deleted file mode 100644 index df66d771c347..000000000000 Binary files a/toolkit/themes/windows/global/tree/twisty-open-XP.png and /dev/null differ diff --git a/toolkit/themes/windows/global/tree/twisty-open-hover-rtl.png b/toolkit/themes/windows/global/tree/twisty-open-hover-rtl.png deleted file mode 100644 index a0157cc3a929..000000000000 Binary files a/toolkit/themes/windows/global/tree/twisty-open-hover-rtl.png and /dev/null differ diff --git a/toolkit/themes/windows/global/tree/twisty-open-hover.png b/toolkit/themes/windows/global/tree/twisty-open-hover.png deleted file mode 100644 index 31c9478a4daf..000000000000 Binary files a/toolkit/themes/windows/global/tree/twisty-open-hover.png and /dev/null differ diff --git a/toolkit/themes/windows/global/tree/twisty-open-rtl.png b/toolkit/themes/windows/global/tree/twisty-open-rtl.png deleted file mode 100644 index 4e606d22ed9f..000000000000 Binary files a/toolkit/themes/windows/global/tree/twisty-open-rtl.png and /dev/null differ diff --git a/toolkit/themes/windows/global/tree/twisty.svg b/toolkit/themes/windows/global/tree/twisty.svg new file mode 100644 index 000000000000..4eeb029ee3d9 --- /dev/null +++ b/toolkit/themes/windows/global/tree/twisty.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + diff --git a/tools/mercurial/eslintvalidate.py b/tools/mercurial/eslintvalidate.py new file mode 100644 index 000000000000..e792741e93fa --- /dev/null +++ b/tools/mercurial/eslintvalidate.py @@ -0,0 +1,45 @@ +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +import os +import sys +import re +import json +from subprocess import check_output, CalledProcessError + +lintable = re.compile(r'.+\.(?:js|jsm|jsx|xml)$') +ignored = "File ignored because of your .eslintignore file. Use --no-ignore to override." + +def is_lintable(filename): + return lintable.match(filename) + +def display(ui, output): + results = json.loads(output) + for file in results: + path = os.path.relpath(file["filePath"]) + for message in file["messages"]: + if message["message"] == ignored: + continue + + ui.warn("%s:%d:%d %s\n" % (path, message["line"], message["column"], message["message"])) + +def eslinthook(ui, repo, node=None, **opts): + ctx = repo[node] + if len(ctx.parents()) > 1: + return 0 + + deleted = repo.status(ctx.p1().node(), ctx.node()).deleted + files = [f for f in ctx.files() if f not in deleted and is_lintable(f)] + + if len(files) == 0: + return + + try: + output = check_output(["eslint", "--format", "json"] + files) + display(ui, output) + except CalledProcessError as ex: + display(ui, ex.output) + ui.warn("ESLint found problems in your changes, please correct them.\n") + +def reposetup(ui, repo): + ui.setconfig('hooks', 'commit.eslint', eslinthook)