diff --git a/.eslintignore b/.eslintignore index 6749ce2ef7a5..17a0a9e0c868 100644 --- a/.eslintignore +++ b/.eslintignore @@ -287,6 +287,7 @@ toolkit/components/osfile/** # External code: toolkit/components/microformats/test/** +toolkit/components/microformats/microformat-shiv.js toolkit/components/reader/Readability.js toolkit/components/reader/JSDOMParser.js diff --git a/testing/mochitest/chrome.eslintrc.js b/testing/mochitest/chrome.eslintrc.js index d9705828fbf3..cee2b8c0a974 100644 --- a/testing/mochitest/chrome.eslintrc.js +++ b/testing/mochitest/chrome.eslintrc.js @@ -19,10 +19,13 @@ module.exports = { "addLoadEvent": false, "Assert": false, "BrowserTestUtils": false, + "ContentTask": false, "EventUtils": false, "executeSoon": false, "export_assertions": false, + "extractJarToTmp": false, "finish": false, + "getJar": false, "getRootDirectory": false, "getTestFilePath": false, "gTestPath": false, diff --git a/toolkit/.eslintrc.js b/toolkit/.eslintrc.js index 413ff196a2c9..f295f3376bfd 100644 --- a/toolkit/.eslintrc.js +++ b/toolkit/.eslintrc.js @@ -251,9 +251,13 @@ module.exports = { "ChromeUtils": false, "Components": false, "dump": true, + // Specific to Firefox + // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/InternalError + "InternalError": true, "KeyEvent": false, "openDialog": false, "MenuBoxObject": false, + "SimpleGestureEvent": false, "sizeToContent": false, "SharedArrayBuffer": false, // Note: StopIteration will likely be removed as part of removing legacy diff --git a/toolkit/components/.eslintrc.js b/toolkit/components/.eslintrc.js deleted file mode 100644 index 4840bb35c2b6..000000000000 --- a/toolkit/components/.eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = { - "rules": { - "no-undef": "off" - } -}; diff --git a/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.js b/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.js index 1bc7fed7b4b0..6c244000f1ba 100644 --- a/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.js +++ b/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.js @@ -2,6 +2,9 @@ * 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/. */ +// Global in the DOM for privileged code only. +/* global CheckerboardReportService */ + "use strict"; var trace; diff --git a/toolkit/components/aboutmemory/tests/xpcshell/.eslintrc.js b/toolkit/components/aboutmemory/tests/xpcshell/.eslintrc.js new file mode 100644 index 000000000000..d35787cd2c49 --- /dev/null +++ b/toolkit/components/aboutmemory/tests/xpcshell/.eslintrc.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + "extends": [ + "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + ] +}; diff --git a/toolkit/components/addoncompat/tests/addon/bootstrap.js b/toolkit/components/addoncompat/tests/addon/bootstrap.js index c536835c76de..ad140db86f0e 100644 --- a/toolkit/components/addoncompat/tests/addon/bootstrap.js +++ b/toolkit/components/addoncompat/tests/addon/bootstrap.js @@ -429,6 +429,8 @@ function testAboutModuleRegistration() { */ let testAboutModulesWork = (browser) => { let testConnection = () => { + // This section is loaded into a frame script. + /* global content:false */ let request = new content.XMLHttpRequest(); try { request.open("GET", "about:test1", false); diff --git a/toolkit/components/alerts/test/test_image.html b/toolkit/components/alerts/test/test_image.html index 7bf89fab22be..115b8a8732cf 100644 --- a/toolkit/components/alerts/test/test_image.html +++ b/toolkit/components/alerts/test/test_image.html @@ -68,7 +68,7 @@ add_task(function* testTimeout() { var [ready] = yield promiseImage(alert, 1000); ok(!ready, "Should cancel request if timeout fires"); - [ready, request] = yield promiseImage(alert, 45000); + [ready] = yield promiseImage(alert, 45000); ok(ready, "Should load image if request finishes before timeout"); }); diff --git a/toolkit/components/exthelper/extApplication.js b/toolkit/components/exthelper/extApplication.js index 18c2cd4b76d6..6a250a6948b2 100644 --- a/toolkit/components/exthelper/extApplication.js +++ b/toolkit/components/exthelper/extApplication.js @@ -2,6 +2,9 @@ * 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/. */ +// This file expects these globals to be declared before it is included. +/* global Ci, Cc */ + Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/AddonManager.jsm"); diff --git a/toolkit/components/formautofill/test/chrome/loader_parent.js b/toolkit/components/formautofill/test/chrome/loader_parent.js index 550a566f04a9..5efe56745c4e 100644 --- a/toolkit/components/formautofill/test/chrome/loader_parent.js +++ b/toolkit/components/formautofill/test/chrome/loader_parent.js @@ -30,7 +30,7 @@ Services.scriptloader.loadSubScript(sharedUrl, this); // Define output functions so they look the same across all frameworks. Since // we don't have an output function available here, we report as TEST-PASS. var Output = { - print: message => assert.ok(true, message), + print: message => assert.ok(false, message), }; // Define assertion functions so they look the same across all frameworks. diff --git a/toolkit/components/gfx/content/gfxFrameScript.js b/toolkit/components/gfx/content/gfxFrameScript.js index b8654ffc424a..898bea349ee2 100644 --- a/toolkit/components/gfx/content/gfxFrameScript.js +++ b/toolkit/components/gfx/content/gfxFrameScript.js @@ -1,6 +1,7 @@ /* eslint-env mozilla/frame-script */ var { classes: Cc, interfaces: Ci, utils: Cu } = Components; +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); const gfxFrameScript = { domUtils: null, diff --git a/toolkit/components/lz4/lz4_internal.js b/toolkit/components/lz4/lz4_internal.js index bf14ce51ee80..73af124376b0 100644 --- a/toolkit/components/lz4/lz4_internal.js +++ b/toolkit/components/lz4/lz4_internal.js @@ -20,6 +20,7 @@ if (typeof Components != "undefined") { this.Primitives = Primitives; this.exports = {}; } else if (typeof module != "undefined" && typeof require != "undefined") { + /* global require:false */ SharedAll = require("resource://gre/modules/osfile/osfile_shared_allthreads.jsm"); } else { throw new Error("Please load this module with Component.utils.import or with require()"); @@ -56,6 +57,7 @@ libxul.declareLazyFFI(Primitives, "maxCompressedSize", ); if (typeof module != "undefined") { + /* global module:false */ module.exports = { get compress() { return Primitives.compress; diff --git a/toolkit/components/microformats/.eslintrc.js b/toolkit/components/microformats/.eslintrc.js new file mode 100644 index 000000000000..b891e3de016a --- /dev/null +++ b/toolkit/components/microformats/.eslintrc.js @@ -0,0 +1,8 @@ +"use strict"; + +module.exports = { + "env": { + "node": true, + "amd": true, + } +}; diff --git a/toolkit/components/microformats/update/update.js b/toolkit/components/microformats/update/update.js index 51567ba5f033..0e196e46c7ae 100644 --- a/toolkit/components/microformats/update/update.js +++ b/toolkit/components/microformats/update/update.js @@ -18,8 +18,8 @@ */ // configuration -var deployDir = "../" - exportedSymbol = 'try {\n // mozilla jsm support\n Components.utils.importGlobalProperties(["URL"]);\n} catch(e) {}\nthis.EXPORTED_SYMBOLS = [\'Microformats\'];'; +var deployDir = "../"; +var exportedSymbol = 'try {\n // mozilla jsm support\n Components.utils.importGlobalProperties(["URL"]);\n} catch(e) {}\nthis.EXPORTED_SYMBOLS = [\'Microformats\'];'; diff --git a/toolkit/components/mozprotocol/tests/.eslintrc.js b/toolkit/components/mozprotocol/tests/.eslintrc.js new file mode 100644 index 000000000000..7c8f827a61f2 --- /dev/null +++ b/toolkit/components/mozprotocol/tests/.eslintrc.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + "extends": [ + "../../../../testing/mochitest/chrome.eslintrc.js" + ], +}; diff --git a/toolkit/components/perfmonitoring/tests/browser/browser_webpagePerformanceAlerts.js b/toolkit/components/perfmonitoring/tests/browser/browser_webpagePerformanceAlerts.js index eb908c8dbf63..c59ead7d6777 100644 --- a/toolkit/components/perfmonitoring/tests/browser/browser_webpagePerformanceAlerts.js +++ b/toolkit/components/perfmonitoring/tests/browser/browser_webpagePerformanceAlerts.js @@ -71,8 +71,10 @@ add_task(function* test_open_window_then_watch_it() { } info(`Attempting to remove a performance listener incorrectly, check that this does not hurt our real listener`); - Assert.throws(() => PerformanceWatcher.removePerformanceListener({addonId: addon.addonId}, () => {})); - Assert.throws(() => PerformanceWatcher.removePerformanceListener({addonId: addon.addonId + "-unbound-id-" + Math.random()}, realListener.listener)); + Assert.throws(() => PerformanceWatcher.removePerformanceListener({windowId: burner.windowId}, () => {}), + /No listener for target/, "should throw an error for a different listener"); + Assert.throws(() => PerformanceWatcher.removePerformanceListener({windowId: burner.windowId + "-unbound-id-" + Math.random()}, realListener.listener), + /No listener for target/, "should throw an error for a different window id"); // Waiting a little – listeners are buffered. yield new Promise(resolve => setTimeout(resolve, 100)); diff --git a/toolkit/components/printing/content/printUtils.js b/toolkit/components/printing/content/printUtils.js index 3e309a63299b..f2ea8dfdefe5 100644 --- a/toolkit/components/printing/content/printUtils.js +++ b/toolkit/components/printing/content/printUtils.js @@ -1,3 +1,6 @@ +// This file is loaded into the browser window scope. +/* eslint mozilla/import-browserjs-globals:"warn" */ + // -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- /* This Source Code Form is subject to the terms of the Mozilla Public diff --git a/toolkit/components/printing/tests/.eslintrc.js b/toolkit/components/printing/tests/.eslintrc.js new file mode 100644 index 000000000000..7c8f827a61f2 --- /dev/null +++ b/toolkit/components/printing/tests/.eslintrc.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + "extends": [ + "../../../../testing/mochitest/chrome.eslintrc.js" + ], +}; diff --git a/toolkit/components/printing/tests/browser_page_change_print_original.js b/toolkit/components/printing/tests/browser_page_change_print_original.js index 5990a486b707..92e4793c68b5 100644 --- a/toolkit/components/printing/tests/browser_page_change_print_original.js +++ b/toolkit/components/printing/tests/browser_page_change_print_original.js @@ -1,3 +1,6 @@ +// This file spawns content tasks. +/* global content */ + /** * Verify that if the page contents change after print preview is initialized, * and we re-initialize print preview (e.g. by changing page orientation), diff --git a/toolkit/components/prompts/content/selectDialog.js b/toolkit/components/prompts/content/selectDialog.js index 962a51cbf986..cfb7dca043c9 100644 --- a/toolkit/components/prompts/content/selectDialog.js +++ b/toolkit/components/prompts/content/selectDialog.js @@ -2,6 +2,9 @@ * 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/. */ + // Defined in dialog.xml. + /* globals centerWindowOnScreen:false, moveToAlertPosition:false */ + var Ci = Components.interfaces; var Cr = Components.results; var Cc = Components.classes; diff --git a/toolkit/components/prompts/content/tabprompts.xml b/toolkit/components/prompts/content/tabprompts.xml index 710a6a9c0e5e..6f808e41aae8 100644 --- a/toolkit/components/prompts/content/tabprompts.xml +++ b/toolkit/components/prompts/content/tabprompts.xml @@ -3,6 +3,10 @@ - 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/. --> + + + diff --git a/toolkit/components/satchel/test/parent_utils.js b/toolkit/components/satchel/test/parent_utils.js index 470ff7630bf6..5f5731c749d3 100644 --- a/toolkit/components/satchel/test/parent_utils.js +++ b/toolkit/components/satchel/test/parent_utils.js @@ -1,4 +1,6 @@ /* eslint-env mozilla/frame-script */ +// assert is available to chrome scripts loaded via SpecialPowers.loadChromeScript. +/* global assert */ const { classes: Cc, interfaces: Ci, utils: Cu } = Components; diff --git a/toolkit/components/viewsource/content/viewSource.js b/toolkit/components/viewsource/content/viewSource.js index 1eef5ef27f29..2acfa055fe2a 100644 --- a/toolkit/components/viewsource/content/viewSource.js +++ b/toolkit/components/viewsource/content/viewSource.js @@ -1,5 +1,10 @@ // -*- indent-tabs-mode: nil; js-indent-level: 2 -*- +/* import-globals-from ../../../content/globalOverlay.js */ +/* import-globals-from ../../printing/content/printUtils.js */ +/* import-globals-from ../../../content/viewZoomOverlay.js */ +/* import-globals-from ../../../content/contentAreaUtils.js */ + /* 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/. */ @@ -16,6 +21,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "CharsetMenu", XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", "resource://gre/modules/Deprecated.jsm"); +/* global gBrowser, gViewSourceBundle, gContextMenu */ [ ["gBrowser", "content"], ["gViewSourceBundle", "viewSourceBundle"], diff --git a/toolkit/components/windowcreator/test/.eslintrc.js b/toolkit/components/windowcreator/test/.eslintrc.js index af692ecd631d..a17c2d1b6f65 100644 --- a/toolkit/components/windowcreator/test/.eslintrc.js +++ b/toolkit/components/windowcreator/test/.eslintrc.js @@ -2,6 +2,8 @@ module.exports = { // eslint-disable-line no-undef "extends": [ + "../../../../testing/mochitest/browser.eslintrc.js", + "../../../../testing/mochitest/chrome.eslintrc.js", "../../../../testing/mochitest/mochitest.eslintrc.js", ] }; diff --git a/toolkit/components/windowwatcher/test/browser_new_content_window_chromeflags.js b/toolkit/components/windowwatcher/test/browser_new_content_window_chromeflags.js index 43bd96f5dd9f..cb690e8f1325 100644 --- a/toolkit/components/windowwatcher/test/browser_new_content_window_chromeflags.js +++ b/toolkit/components/windowwatcher/test/browser_new_content_window_chromeflags.js @@ -238,6 +238,8 @@ add_task(function* test_new_remote_window_flags() { // as part of the TabChild, so we have to check those too. let b = win.gBrowser.selectedBrowser; let contentChromeFlags = yield ContentTask.spawn(b, null, function*() { + // Content scripts provide docShell as a global. + /* global docShell */ docShell.QueryInterface(Ci.nsIInterfaceRequestor); try { // This will throw if we're not a remote browser. diff --git a/toolkit/content/.eslintrc.js b/toolkit/content/.eslintrc.js index 4840bb35c2b6..3edbfc67141a 100644 --- a/toolkit/content/.eslintrc.js +++ b/toolkit/content/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "rules": { - "no-undef": "off" + "mozilla/import-browserjs-globals": "warn", } }; diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index 7183458ad5ff..6fc6ad28cca1 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -508,7 +508,7 @@ var snapshotFormatters = { if (crashGuards.length) { for (let guard of crashGuards) { let resetButton = $.new("button"); - onClickReset = function() { + let onClickReset = function() { Services.prefs.setIntPref(guard.prefName, 0); resetButton.removeEventListener("click", onClickReset); resetButton.disabled = true; diff --git a/toolkit/content/datepicker.xhtml b/toolkit/content/datepicker.xhtml index 4da6e398f885..c5c76e323795 100644 --- a/toolkit/content/datepicker.xhtml +++ b/toolkit/content/datepicker.xhtml @@ -37,6 +37,7 @@ - \ No newline at end of file + diff --git a/toolkit/content/finddialog.js b/toolkit/content/finddialog.js index e2d7e3c71771..77a85c82b910 100644 --- a/toolkit/content/finddialog.js +++ b/toolkit/content/finddialog.js @@ -4,6 +4,9 @@ * 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/. */ +// Defined in dialog.xml. +/* globals moveToAlertPosition */ + Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/FormHistory.jsm"); diff --git a/toolkit/content/macWindowMenu.js b/toolkit/content/macWindowMenu.js index df6270273428..86b9bd0068ed 100644 --- a/toolkit/content/macWindowMenu.js +++ b/toolkit/content/macWindowMenu.js @@ -22,7 +22,7 @@ function macWindowMenuDidShow() { function toOpenWindow( aWindow ) { // deminiaturize the window, if it's in the Dock - if (aWindow.windowState == STATE_MINIMIZED) + if (aWindow.windowState == window.STATE_MINIMIZED) aWindow.restore(); aWindow.document.commandDispatcher.focusedWindow.focus(); } @@ -40,7 +40,7 @@ function ShowWindowFromResource( node ) { } function zoomWindow() { - if (window.windowState == STATE_NORMAL) + if (window.windowState == window.STATE_NORMAL) window.maximize(); else window.restore(); diff --git a/toolkit/content/tests/browser/browser_mediaPlayback_suspended.js b/toolkit/content/tests/browser/browser_mediaPlayback_suspended.js index fe618278d53a..5ed852c8cc63 100644 --- a/toolkit/content/tests/browser/browser_mediaPlayback_suspended.js +++ b/toolkit/content/tests/browser/browser_mediaPlayback_suspended.js @@ -23,7 +23,7 @@ function check_audio_onplay() { var audio = list[0]; return new Promise((resolve, reject) => { audio.onplay = () => { - ok(needToReceiveOnPlay, "Should not receive play event!"); + ok(false, "Should not receive play event!"); this.onplay = null; reject(); }; diff --git a/toolkit/content/tests/browser/browser_saveImageURL.js b/toolkit/content/tests/browser/browser_saveImageURL.js index 75e1cfdcdbc0..13e9aeade7de 100644 --- a/toolkit/content/tests/browser/browser_saveImageURL.js +++ b/toolkit/content/tests/browser/browser_saveImageURL.js @@ -3,6 +3,8 @@ const IMAGE_PAGE = "https://example.com/browser/toolkit/content/tests/browser/image_page.html"; const PREF_UNSAFE_FORBIDDEN = "dom.ipc.cpows.forbid-unsafe-from-browser"; +var MockFilePicker = SpecialPowers.MockFilePicker; + MockFilePicker.init(window); MockFilePicker.returnValue = MockFilePicker.returnCancel; diff --git a/toolkit/content/tests/browser/browser_save_resend_postdata.js b/toolkit/content/tests/browser/browser_save_resend_postdata.js index ceb5233c423e..187d8bd04ef1 100644 --- a/toolkit/content/tests/browser/browser_save_resend_postdata.js +++ b/toolkit/content/tests/browser/browser_save_resend_postdata.js @@ -95,6 +95,7 @@ function test() { } } +/* import-globals-from common/mockTransfer.js */ Cc["@mozilla.org/moz/jssubscript-loader;1"] .getService(Ci.mozIJSSubScriptLoader) .loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js", diff --git a/toolkit/content/tests/chrome/RegisterUnregisterChrome.js b/toolkit/content/tests/chrome/RegisterUnregisterChrome.js index 10edbab60ec5..30d341052331 100644 --- a/toolkit/content/tests/chrome/RegisterUnregisterChrome.js +++ b/toolkit/content/tests/chrome/RegisterUnregisterChrome.js @@ -18,7 +18,7 @@ var gPrefs = Cc["@mozilla.org/preferences-service;1"]. // we know the mochitest harness kills off the profile when it's done. function copyToTemporaryFile(f) { let tmpd = gDirSvc.get("ProfD", Ci.nsIFile); - tmpf = tmpd.clone(); + let tmpf = tmpd.clone(); tmpf.append("temp.manifest"); tmpf.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600); tmpf.remove(false); @@ -68,7 +68,7 @@ function copyDirToTempProfile(path, subdirname) { // The SimpleTest directory is hidden var files = Array.from(dirIter("file://" + rootDir)); - for (f in files) { + for (let f in files) { files[f].copyTo(tmpdir, ""); } return tmpdir; diff --git a/toolkit/content/tests/chrome/popup_trigger.js b/toolkit/content/tests/chrome/popup_trigger.js index 43a80aa3f728..ad22ae56d850 100644 --- a/toolkit/content/tests/chrome/popup_trigger.js +++ b/toolkit/content/tests/chrome/popup_trigger.js @@ -1,3 +1,5 @@ +/* import-globals-from ../widgets/popup_shared.js */ + var gMenuPopup = null; var gTrigger = null; var gIsMenu = false; diff --git a/toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html b/toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html index 03d8f39b46fc..650d1eb409b4 100644 --- a/toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html +++ b/toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html @@ -19,6 +19,7 @@
 
 
-
\ No newline at end of file
+
diff --git a/toolkit/content/widgets/colorpicker.xml b/toolkit/content/widgets/colorpicker.xml
index 932f609dba23..df73e0aa0f89 100644
--- a/toolkit/content/widgets/colorpicker.xml
+++ b/toolkit/content/widgets/colorpicker.xml
@@ -401,7 +401,7 @@
 
       
       
       
 
 
-
diff --git a/toolkit/content/widgets/datepicker.js b/toolkit/content/widgets/datepicker.js
index 56148e857932..cc779d19f6c1 100644
--- a/toolkit/content/widgets/datepicker.js
+++ b/toolkit/content/widgets/datepicker.js
@@ -2,6 +2,10 @@
  * 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/. */
 
+/* import-globals-from datekeeper.js */
+/* import-globals-from calendar.js */
+/* import-globals-from spinner.js */
+
 "use strict";
 
 function DatePicker(context) {
diff --git a/toolkit/content/widgets/datetimebox.xml b/toolkit/content/widgets/datetimebox.xml
index 369ee486036a..c3ea1cc47b83 100644
--- a/toolkit/content/widgets/datetimebox.xml
+++ b/toolkit/content/widgets/datetimebox.xml
@@ -1051,7 +1051,7 @@
         this.EVENTS.forEach((eventName) => {
           this.removeEventListener(eventName, this, { mozSystemGroup: true });
         });
-        this.removeEventListener("keypress", onKeyPress, {
+        this.removeEventListener("keypress", this, {
           capture: true,
           mozSystemGroup: true
         });
diff --git a/toolkit/content/widgets/datetimepicker.xml b/toolkit/content/widgets/datetimepicker.xml
index 236c8caf6c28..6ca5b9b92416 100644
--- a/toolkit/content/widgets/datetimepicker.xml
+++ b/toolkit/content/widgets/datetimepicker.xml
@@ -1118,10 +1118,6 @@
             }
 
             this._fireEvent("monthchange", this);
-            if (this.hasAttribute("monthchange")) {
-              var fn = new Function("event", aTarget.getAttribute("onmonthchange"));
-              fn.call(aTarget, event);
-            }
           ]]>
         
       
diff --git a/toolkit/content/widgets/datetimepopup.xml b/toolkit/content/widgets/datetimepopup.xml
index 6afb8375dd7f..e19d02550e44 100644
--- a/toolkit/content/widgets/datetimepopup.xml
+++ b/toolkit/content/widgets/datetimepopup.xml
@@ -26,8 +26,8 @@
         this.l10n = {};
         const mozIntl = Components.classes["@mozilla.org/mozintl;1"]
                           .getService(Components.interfaces.mozIMozIntl);
-        mozIntl.addGetCalendarInfo(l10n);
-        mozIntl.addGetDisplayNames(l10n);
+        mozIntl.addGetCalendarInfo(this.l10n);
+        mozIntl.addGetDisplayNames(this.l10n);
       ]]>
       
         
diff --git a/toolkit/content/widgets/listbox.xml b/toolkit/content/widgets/listbox.xml
index fc5686111c74..e7726723a0d2 100644
--- a/toolkit/content/widgets/listbox.xml
+++ b/toolkit/content/widgets/listbox.xml
@@ -4,6 +4,9 @@
    - 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/. -->
 
+
+
+
 
 
+
+
 
 
 
+
+
+
 
 
diff --git a/toolkit/content/widgets/timepicker.js b/toolkit/content/widgets/timepicker.js
index cd14188f6092..57114b5a9f59 100644
--- a/toolkit/content/widgets/timepicker.js
+++ b/toolkit/content/widgets/timepicker.js
@@ -2,6 +2,9 @@
  * 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/. */
 
+ /* import-globals-from timekeeper.js */
+ /* import-globals-from spinner.js */
+
 "use strict";
 
 function TimePicker(context) {
diff --git a/toolkit/content/widgets/toolbar.xml b/toolkit/content/widgets/toolbar.xml
index 6a882e5377b3..0c1a78983c42 100644
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -52,13 +52,13 @@
           // Look to see if there is a toolbarset.
           this.toolbarset = this.firstChild;
           while (this.toolbarset && this.toolbarset.localName != "toolbarset")
-            this.toolbarset = toolbarset.nextSibling;
+            this.toolbarset = this.toolbarset.nextSibling;
 
           if (this.toolbarset) {
             // Create each toolbar described by the toolbarset.
             var index = 0;
-            while (toolbarset.hasAttribute("toolbar" + (++index))) {
-              var toolbarInfo = toolbarset.getAttribute("toolbar" + index);
+            while (this.toolbarset.hasAttribute("toolbar" + (++index))) {
+              var toolbarInfo = this.toolbarset.getAttribute("toolbar" + index);
               var infoSplit = toolbarInfo.split(":");
               this.appendCustomToolbar(infoSplit[0], infoSplit[1]);
             }
@@ -587,4 +587,3 @@
   
 
 
-
diff --git a/toolkit/content/widgets/tree.xml b/toolkit/content/widgets/tree.xml
index add57daaf78d..202e575009f8 100644
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -901,84 +901,84 @@
         
       
       
         
       
       
         
       
       
         
       
       
         
       
       
         
       
       
         
       
       
         
       
       
         
       
       
         
       
       
         
       
       
         
       
       
diff --git a/toolkit/content/widgets/videocontrols.xml b/toolkit/content/widgets/videocontrols.xml
index 6912fd11925b..0097e6f1ae42 100644
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -970,19 +970,19 @@
       _showControlsTimeout : 0,
       SHOW_CONTROLS_TIMEOUT_MS: 500,
       _showControlsFn() {
-        if (Utils.video.matches("video:hover")) {
-          Utils.startFadeIn(Utils.controlBar, false);
-          Utils._showControlsTimeout = 0;
-          Utils._controlsHiddenByTimeout = false;
+        if (this.Utils.video.matches("video:hover")) {
+          this.Utils.startFadeIn(this.Utils.controlBar, false);
+          this.Utils._showControlsTimeout = 0;
+          this.Utils._controlsHiddenByTimeout = false;
         }
       },
 
       _hideControlsTimeout : 0,
       _hideControlsFn() {
-        if (!Utils.scrubber.isDragging) {
-          Utils.startFade(Utils.controlBar, false);
-          Utils._hideControlsTimeout = 0;
-          Utils._controlsHiddenByTimeout = true;
+        if (!this.Utils.scrubber.isDragging) {
+          this.Utils.startFade(this.Utils.controlBar, false);
+          this.Utils._hideControlsTimeout = 0;
+          this.Utils._controlsHiddenByTimeout = true;
         }
       },
       HIDE_CONTROLS_TIMEOUT_MS : 2000,
@@ -1067,7 +1067,7 @@
           this.startFadeOut(this.controlBar, false);
           this.textTrackList.setAttribute("hidden", "true");
           clearTimeout(this._showControlsTimeout);
-          Utils._controlsHiddenByTimeout = false;
+          this.Utils._controlsHiddenByTimeout = false;
         }
       },
 
@@ -1231,7 +1231,7 @@
 
       onFullscreenChange() {
         if (this.isVideoInFullScreen()) {
-          Utils._hideControlsTimeout = setTimeout(this._hideControlsFn, this.HIDE_CONTROLS_TIMEOUT_MS);
+          this.Utils._hideControlsTimeout = setTimeout(this._hideControlsFn, this.HIDE_CONTROLS_TIMEOUT_MS);
         }
         this.setFullscreenButtonState();
       },