Bug 798491: Add an option to stick all chrome JSMs/JS components in the same compartment. r=mrbkap,philikon
☠☠ backed out by 5bf3abe91210 ☠ ☠
authorKyle Huey <khuey@kylehuey.com>
Tue, 30 Oct 2012 12:28:11 -0700
changeset 119723 67cb43bb8865ecbcb79c2ea04a0494fd223cc69d
parent 119720 553fb59b9ca0a1815b27092a36c1e3114e2ce0a2
child 119724 8e03750d5434c1f60cbb918b6f8527e3d36665e6
push id1997
push userakeybl@mozilla.com
push dateMon, 07 Jan 2013 21:25:26 +0000
treeherdermozilla-beta@4baf45cdcf21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap, philikon
bugs798491
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 798491: Add an option to stick all chrome JSMs/JS components in the same compartment. r=mrbkap,philikon
accessible/src/jsat/AccessFu.jsm
accessible/src/jsat/EventManager.jsm
accessible/src/jsat/Presenters.jsm
accessible/src/jsat/TouchAdapter.jsm
accessible/src/jsat/TraversalRules.jsm
accessible/src/jsat/Utils.jsm
accessible/src/jsat/UtteranceGenerator.jsm
b2g/app/b2g.js
b2g/components/ActivitiesGlue.js
b2g/components/AlertsService.js
b2g/components/ContentHandler.js
b2g/components/ContentPermissionPrompt.js
b2g/components/DirectoryProvider.js
b2g/components/MailtoProtocolHandler.js
b2g/components/MozKeyboard.js
b2g/components/PaymentGlue.js
b2g/components/ProcessGlobal.js
b2g/components/RecoveryService.js
b2g/components/SmsProtocolHandler.js
b2g/components/TelProtocolHandler.js
b2g/components/TelURIParser.jsm
b2g/components/UpdatePrompt.js
b2g/components/YoutubeProtocolHandler.js
browser/components/distribution.js
browser/components/downloads/src/DownloadsCommon.jsm
browser/components/downloads/src/DownloadsStartup.js
browser/components/downloads/src/DownloadsUI.js
browser/components/feeds/src/FeedConverter.js
browser/components/feeds/src/FeedWriter.js
browser/components/feeds/src/WebContentConverter.js
browser/components/migration/src/ChromeProfileMigrator.js
browser/components/migration/src/FirefoxProfileMigrator.js
browser/components/migration/src/IEProfileMigrator.js
browser/components/migration/src/MigrationUtils.jsm
browser/components/migration/src/ProfileMigrator.js
browser/components/migration/src/SafariProfileMigrator.js
browser/components/nsBrowserContentHandler.js
browser/components/nsBrowserGlue.js
browser/components/places/src/PlacesProtocolHandler.js
browser/components/places/src/PlacesUIUtils.jsm
browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
browser/components/sessionstore/src/DocumentUtils.jsm
browser/components/sessionstore/src/SessionStorage.jsm
browser/components/sessionstore/src/SessionStore.jsm
browser/components/sessionstore/src/XPathGenerator.jsm
browser/components/sessionstore/src/nsSessionStartup.js
browser/components/sessionstore/src/nsSessionStore.js
browser/components/shell/src/nsSetDefaultBrowser.js
browser/components/sidebar/nsSidebar.js
browser/components/tabview/modules/utils.jsm
browser/components/thumbnails/PageThumbs.jsm
browser/components/thumbnails/PageThumbsProtocol.js
browser/devtools/commandline/CmdAddon.jsm
browser/devtools/commandline/CmdBreak.jsm
browser/devtools/commandline/CmdCalllog.jsm
browser/devtools/commandline/CmdCalllogChrome.jsm
browser/devtools/commandline/CmdCmd.jsm
browser/devtools/commandline/CmdConsole.jsm
browser/devtools/commandline/CmdCookie.jsm
browser/devtools/commandline/CmdDbg.jsm
browser/devtools/commandline/CmdEcho.jsm
browser/devtools/commandline/CmdExport.jsm
browser/devtools/commandline/CmdJsb.jsm
browser/devtools/commandline/CmdPagemod.jsm
browser/devtools/commandline/CmdRestart.jsm
browser/devtools/commandline/CmdScreenshot.jsm
browser/devtools/commandline/Commands.jsm
browser/devtools/commandline/gcli.jsm
browser/devtools/commandline/test/helpers.js
browser/devtools/debugger/DebuggerUI.jsm
browser/devtools/highlighter/CmdInspect.jsm
browser/devtools/highlighter/highlighter.jsm
browser/devtools/highlighter/inspector.jsm
browser/devtools/highlighter/test/helpers.js
browser/devtools/layoutview/LayoutView.jsm
browser/devtools/markupview/MarkupView.jsm
browser/devtools/responsivedesign/CmdResize.jsm
browser/devtools/responsivedesign/responsivedesign.jsm
browser/devtools/responsivedesign/test/helpers.js
browser/devtools/scratchpad/scratchpad-manager.jsm
browser/devtools/shared/Browser.jsm
browser/devtools/shared/DOMHelpers.jsm
browser/devtools/shared/DeveloperToolbar.jsm
browser/devtools/shared/EventEmitter.jsm
browser/devtools/shared/FloatingScrollbars.jsm
browser/devtools/shared/Jsbeautify.jsm
browser/devtools/shared/LayoutHelpers.jsm
browser/devtools/shared/SplitView.jsm
browser/devtools/shared/Templater.jsm
browser/devtools/shared/Undo.jsm
browser/devtools/shared/test/helpers.js
browser/devtools/sourceeditor/source-editor-orion.jsm
browser/devtools/sourceeditor/source-editor-ui.jsm
browser/devtools/sourceeditor/source-editor.jsm
browser/devtools/styleeditor/CmdEdit.jsm
browser/devtools/styleeditor/StyleEditor.jsm
browser/devtools/styleeditor/StyleEditorChrome.jsm
browser/devtools/styleeditor/StyleEditorUtil.jsm
browser/devtools/styleeditor/test/helpers.js
browser/devtools/styleinspector/CssHtmlTree.jsm
browser/devtools/styleinspector/CssLogic.jsm
browser/devtools/styleinspector/CssRuleView.jsm
browser/devtools/styleinspector/StyleInspector.jsm
browser/devtools/tilt/CmdTilt.jsm
browser/devtools/tilt/Tilt.jsm
browser/devtools/tilt/TiltGL.jsm
browser/devtools/tilt/TiltMath.jsm
browser/devtools/tilt/TiltUtils.jsm
browser/devtools/tilt/TiltVisualizer.jsm
browser/devtools/tilt/TiltVisualizerStyle.jsm
browser/devtools/webconsole/AutocompletePopup.jsm
browser/devtools/webconsole/HUDService.jsm
browser/devtools/webconsole/NetworkPanel.jsm
browser/devtools/webconsole/PropertyPanel.jsm
browser/fuel/src/fuelApplication.js
browser/modules/AboutHomeUtils.jsm
browser/modules/BrowserNewTabPreloader.jsm
browser/modules/NetworkPrioritizer.jsm
browser/modules/NewTabUtils.jsm
browser/modules/SignInToWebsite.jsm
browser/modules/Social.jsm
browser/modules/TelemetryTimestamps.jsm
browser/modules/WindowsJumpLists.jsm
browser/modules/WindowsPreviewPerTab.jsm
browser/modules/offlineAppCache.jsm
browser/modules/openLocationLastURL.jsm
browser/modules/webappsUI.jsm
browser/modules/webrtcUI.jsm
content/base/src/CSPUtils.jsm
content/base/src/contentAreaDropListener.js
content/base/src/contentSecurityPolicy.js
content/base/src/messageWakeupService.js
content/base/src/nsBadCertHandler.js
content/xslt/src/xslt/txEXSLTRegExFunctions.js
content/xtf/test/unit/xtfComponent.js
dom/activities/src/ActivitiesService.jsm
dom/activities/src/ActivityOptions.js
dom/activities/src/ActivityProxy.js
dom/activities/src/ActivityRequestHandler.js
dom/activities/src/ActivityWrapper.js
dom/alarm/AlarmDB.jsm
dom/alarm/AlarmService.jsm
dom/alarm/AlarmsManager.js
dom/apps/src/AppsService.js
dom/apps/src/AppsServiceChild.jsm
dom/apps/src/AppsUtils.jsm
dom/apps/src/OfflineCacheInstaller.jsm
dom/apps/src/PermissionsInstaller.jsm
dom/apps/src/Webapps.js
dom/apps/src/Webapps.jsm
dom/base/ConsoleAPI.js
dom/base/ConsoleAPIStorage.jsm
dom/base/DOMRequestHelper.jsm
dom/base/IndexedDBHelper.jsm
dom/base/ObjectWrapper.jsm
dom/base/SiteSpecificUserAgent.js
dom/browser-element/BrowserElementParent.js
dom/browser-element/BrowserElementPromptService.jsm
dom/contacts/ContactManager.js
dom/contacts/fallback/ContactDB.jsm
dom/contacts/fallback/ContactService.jsm
dom/encoding/test/file_stringencoding.jsm
dom/fm/DOMFMRadioChild.js
dom/fm/DOMFMRadioParent.jsm
dom/identity/DOMIdentity.jsm
dom/identity/nsDOMIdentity.js
dom/identity/nsIDService.js
dom/media/PeerConnection.js
dom/messages/SystemMessageInternal.js
dom/messages/SystemMessageManager.js
dom/mms/src/ril/MmsPduHelper.jsm
dom/mms/src/ril/MmsService.js
dom/mms/src/ril/WapPushManager.js
dom/mms/src/ril/WspPduHelper.jsm
dom/mms/src/ril/mms_consts.js
dom/mms/src/ril/wap_consts.js
dom/network/src/NetworkStatsDB.jsm
dom/network/src/NetworkStatsManager.js
dom/network/src/NetworkStatsService.jsm
dom/network/src/TCPSocket.js
dom/network/src/TCPSocketParentIntermediary.js
dom/payment/Payment.js
dom/payment/Payment.jsm
dom/payment/PaymentFlowInfo.js
dom/payment/PaymentRequestInfo.js
dom/permission/PermissionPromptHelper.jsm
dom/permission/PermissionSettings.js
dom/permission/PermissionSettings.jsm
dom/settings/SettingsChangeNotifier.jsm
dom/settings/SettingsDB.jsm
dom/settings/SettingsManager.js
dom/settings/SettingsQueue.jsm
dom/settings/SettingsService.js
dom/sms/src/ril/SmsDatabaseService.js
dom/system/GPSDGeolocationProvider.js
dom/system/NetworkGeolocationProvider.js
dom/system/gonk/NetworkManager.js
dom/system/gonk/RILContentHelper.js
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/ril_consts.js
dom/system/gonk/systemlibs.js
dom/wifi/DOMWifiManager.js
dom/wifi/WifiWorker.js
dom/workers/test/WorkerTest.jsm
dom/workers/test/extensions/traditional/WorkerTest.js
extensions/cookie/test/unit/cookieprompt.js
image/decoders/icon/qt/gtkqticonsconverter.js
intl/locale/src/PluralForm.jsm
js/ductwork/debugger/jsdebugger.jsm
js/xpconnect/loader/ISO8601DateUtils.jsm
js/xpconnect/loader/XPCOMUtils.jsm
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/loader/mozJSComponentLoader.h
js/xpconnect/loader/mozJSLoaderUtils.cpp
js/xpconnect/loader/mozJSLoaderUtils.h
js/xpconnect/tests/chrome/file_expandosharing.jsm
js/xpconnect/tests/components/js/xpctest_attributes.js
js/xpconnect/tests/components/js/xpctest_interfaces.js
js/xpconnect/tests/components/js/xpctest_params.js
js/xpconnect/tests/unit/bogus_element_type.jsm
js/xpconnect/tests/unit/bogus_exports_type.jsm
js/xpconnect/tests/unit/component-file.js
js/xpconnect/tests/unit/component_import.js
js/xpconnect/tests/unit/recursive_importA.jsm
js/xpconnect/tests/unit/recursive_importB.jsm
layout/tools/reftest/reftest-cmdline.js
layout/tools/reftest/reftest.js
mobile/android/components/AboutRedirector.js
mobile/android/components/AddonUpdateService.js
mobile/android/components/AlertsService.js
mobile/android/components/BlocklistPrompt.js
mobile/android/components/BrowserCLH.js
mobile/android/components/ContentDispatchChooser.js
mobile/android/components/ContentPermissionPrompt.js
mobile/android/components/DirectoryProvider.js
mobile/android/components/DownloadManagerUI.js
mobile/android/components/FormAutoComplete.js
mobile/android/components/HelperAppDialog.js
mobile/android/components/LoginManagerPrompter.js
mobile/android/components/PromptService.js
mobile/android/components/SafeBrowsing.jsm
mobile/android/components/SessionStore.js
mobile/android/components/Sidebar.js
mobile/android/components/XPIDialogService.js
mobile/android/modules/JNI.jsm
mobile/android/modules/LocaleRepository.jsm
mobile/android/modules/contacts.jsm
mobile/android/modules/linuxTypes.jsm
mobile/android/modules/video.jsm
mobile/xul/components/AboutRedirector.js
mobile/xul/components/AddonUpdateService.js
mobile/xul/components/AlertsService.js
mobile/xul/components/AutoCompleteCache.js
mobile/xul/components/BlocklistPrompt.js
mobile/xul/components/BrowserCLH.js
mobile/xul/components/BrowserStartup.js
mobile/xul/components/CapturePicker.js
mobile/xul/components/ContentDispatchChooser.js
mobile/xul/components/ContentPermissionPrompt.js
mobile/xul/components/DirectoryProvider.js
mobile/xul/components/DownloadManagerUI.js
mobile/xul/components/FormAutoComplete.js
mobile/xul/components/HelperAppDialog.js
mobile/xul/components/LoginManager.js
mobile/xul/components/LoginManagerPrompter.js
mobile/xul/components/PromptService.js
mobile/xul/components/SafeBrowsing.js
mobile/xul/components/SessionStore.js
mobile/xul/components/Sidebar.js
mobile/xul/components/UpdatePrompt.js
mobile/xul/components/XPIDialogService.js
mobile/xul/modules/LocaleRepository.jsm
mobile/xul/modules/contacts.jsm
mobile/xul/modules/linuxTypes.jsm
mobile/xul/modules/video.jsm
modules/libpref/src/init/all.js
netwerk/base/src/NetUtil.jsm
netwerk/protocol/app/AppProtocolHandler.js
netwerk/protocol/http/UserAgentOverrides.jsm
netwerk/test/httpserver/httpd.js
services/aitc/Aitc.js
services/aitc/modules/browserid.js
services/aitc/modules/client.js
services/aitc/modules/main.js
services/aitc/modules/manager.js
services/aitc/modules/storage.js
services/common/async.js
services/common/log4moz.js
services/common/modules-testing/aitcserver.js
services/common/modules-testing/logging.js
services/common/modules-testing/storageserver.js
services/common/modules-testing/utils.js
services/common/observers.js
services/common/preferences.js
services/common/rest.js
services/common/storageservice.js
services/common/stringbundle.js
services/common/tokenserverclient.js
services/common/utils.js
services/crypto/modules/WeaveCrypto.js
services/crypto/modules/utils.js
services/notifications/service.js
services/sync/Weave.js
services/sync/modules-testing/fakeservices.js
services/sync/modules-testing/rotaryengine.js
services/sync/modules-testing/utils.js
services/sync/modules/addonsreconciler.js
services/sync/modules/addonutils.js
services/sync/modules/engines.js
services/sync/modules/engines/addons.js
services/sync/modules/engines/apps.js
services/sync/modules/engines/bookmarks.js
services/sync/modules/engines/clients.js
services/sync/modules/engines/forms.js
services/sync/modules/engines/history.js
services/sync/modules/engines/passwords.js
services/sync/modules/engines/prefs.js
services/sync/modules/engines/tabs.js
services/sync/modules/identity.js
services/sync/modules/jpakeclient.js
services/sync/modules/keys.js
services/sync/modules/main.js
services/sync/modules/notifications.js
services/sync/modules/policies.js
services/sync/modules/record.js
services/sync/modules/resource.js
services/sync/modules/rest.js
services/sync/modules/service.js
services/sync/modules/stages/cluster.js
services/sync/modules/stages/enginesync.js
services/sync/modules/status.js
services/sync/modules/userapi.js
services/sync/modules/util.js
storage/test/unit/vacuumParticipant.js
testing/marionette/components/marionettecomponent.js
testing/marionette/marionette-elements.js
testing/specialpowers/components/SpecialPowersObserver.js
testing/specialpowers/content/MockFilePicker.jsm
toolkit/components/console/jsconsole-clhandler.js
toolkit/components/contentprefs/nsContentPrefService.js
toolkit/components/ctypes/ctypes.cpp
toolkit/components/ctypes/ctypes.jsm
toolkit/components/downloads/nsDownloadManagerUI.js
toolkit/components/downloads/test/unit/downloads_manifest.js
toolkit/components/feeds/FeedProcessor.js
toolkit/components/filepicker/nsFilePicker.js
toolkit/components/microformats/Microformats.js
toolkit/components/nsDefaultCLH.js
toolkit/components/osfile/osfile.jsm
toolkit/components/osfile/osfile_async_front.jsm
toolkit/components/osfile/osfile_shared_allthreads.jsm
toolkit/components/osfile/osfile_unix_allthreads.jsm
toolkit/components/osfile/osfile_win_allthreads.jsm
toolkit/components/osfile/ospath_unix_back.jsm
toolkit/components/osfile/ospath_win_back.jsm
toolkit/components/passwordmgr/crypto-SDR.js
toolkit/components/passwordmgr/nsLoginInfo.js
toolkit/components/passwordmgr/nsLoginManager.js
toolkit/components/passwordmgr/nsLoginManagerPrompter.js
toolkit/components/passwordmgr/storage-Legacy.js
toolkit/components/passwordmgr/storage-mozStorage.js
toolkit/components/perf/PerfMeasurement.cpp
toolkit/components/perf/PerfMeasurement.jsm
toolkit/components/places/BookmarkHTMLUtils.jsm
toolkit/components/places/ColorAnalyzer.js
toolkit/components/places/PlacesCategoriesStarter.js
toolkit/components/places/PlacesDBUtils.jsm
toolkit/components/places/PlacesUtils.jsm
toolkit/components/places/nsLivemarkService.js
toolkit/components/places/nsPlacesAutoComplete.js
toolkit/components/places/nsPlacesExpiration.js
toolkit/components/places/nsTaggingService.js
toolkit/components/places/tests/unit/nsDummyObserver.js
toolkit/components/prompts/src/CommonDialog.jsm
toolkit/components/prompts/src/nsPrompter.js
toolkit/components/reflect/reflect.jsm
toolkit/components/satchel/nsFormAutoComplete.js
toolkit/components/satchel/nsFormAutoCompleteResult.jsm
toolkit/components/satchel/nsFormHistory.js
toolkit/components/satchel/nsInputListAutoComplete.js
toolkit/components/search/nsSearchService.js
toolkit/components/search/nsSearchSuggestions.js
toolkit/components/social/FrameWorker.jsm
toolkit/components/social/MessagePortBase.jsm
toolkit/components/social/MozSocialAPI.jsm
toolkit/components/social/SocialService.jsm
toolkit/components/social/WorkerAPI.jsm
toolkit/components/telemetry/TelemetryPing.js
toolkit/components/telemetry/TelemetryStopwatch.jsm
toolkit/components/url-classifier/SafeBrowsing.jsm
toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js
toolkit/components/url-classifier/nsUrlClassifierLib.js
toolkit/components/url-classifier/nsUrlClassifierListManager.js
toolkit/components/urlformatter/nsURLFormatter.js
toolkit/content/DeferredTask.jsm
toolkit/content/Dict.jsm
toolkit/content/Geometry.jsm
toolkit/content/InlineSpellChecker.jsm
toolkit/content/LightweightThemeConsumer.jsm
toolkit/content/PageMenu.jsm
toolkit/content/PopupNotifications.jsm
toolkit/content/PrivateBrowsingUtils.jsm
toolkit/content/PropertyListUtils.jsm
toolkit/content/Services.jsm
toolkit/content/Task.jsm
toolkit/content/Troubleshoot.jsm
toolkit/content/UpdateChannel.jsm
toolkit/content/WindowDraggingUtils.jsm
toolkit/content/debug.js
toolkit/crashreporter/CrashSubmit.jsm
toolkit/crashreporter/KeyValueParser.jsm
toolkit/crashreporter/test/CrashTestUtils.jsm
toolkit/devtools/Console.jsm
toolkit/devtools/Require.jsm
toolkit/devtools/_Promise.jsm
toolkit/devtools/debugger/dbg-client.jsm
toolkit/devtools/debugger/dbg-transport.js
toolkit/devtools/debugger/server/dbg-server.jsm
toolkit/devtools/sourcemap/SourceMap.jsm
toolkit/devtools/sourcemap/tests/unit/Utils.jsm
toolkit/devtools/webconsole/NetworkHelper.jsm
toolkit/devtools/webconsole/WebConsoleClient.jsm
toolkit/devtools/webconsole/WebConsoleUtils.jsm
toolkit/forgetaboutsite/ForgetAboutSite.jsm
toolkit/identity/Identity.jsm
toolkit/identity/IdentityProvider.jsm
toolkit/identity/IdentityStore.jsm
toolkit/identity/LogUtils.jsm
toolkit/identity/RelyingParty.jsm
toolkit/identity/Sandbox.jsm
toolkit/identity/jwcrypto.jsm
toolkit/mozapps/downloads/DownloadLastDir.jsm
toolkit/mozapps/downloads/DownloadPaths.jsm
toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm
toolkit/mozapps/downloads/DownloadUtils.jsm
toolkit/mozapps/downloads/nsHelperAppDlg.js
toolkit/mozapps/extensions/AddonLogging.jsm
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/AddonRepository.jsm
toolkit/mozapps/extensions/AddonUpdateChecker.jsm
toolkit/mozapps/extensions/ChromeManifestParser.jsm
toolkit/mozapps/extensions/LightweightThemeImageOptimizer.jsm
toolkit/mozapps/extensions/LightweightThemeManager.jsm
toolkit/mozapps/extensions/PluginProvider.jsm
toolkit/mozapps/extensions/XPIProvider.jsm
toolkit/mozapps/extensions/addonManager.js
toolkit/mozapps/extensions/amContentHandler.js
toolkit/mozapps/extensions/amWebInstallListener.js
toolkit/mozapps/extensions/nsBlocklistService.js
toolkit/mozapps/extensions/test/addons/test_bootstrap1_1/version.jsm
toolkit/mozapps/extensions/test/addons/test_bootstrap1_2/version.jsm
toolkit/mozapps/extensions/test/addons/test_bootstrap1_3/version.jsm
toolkit/mozapps/handling/nsContentDispatchChooser.js
toolkit/mozapps/shared/CertUtils.jsm
toolkit/mozapps/shared/FileUtils.jsm
toolkit/mozapps/update/nsUpdateService.js
toolkit/mozapps/update/nsUpdateServiceStub.js
toolkit/mozapps/update/nsUpdateTimerManager.js
toolkit/webapps/WebappOSUtils.jsm
toolkit/webapps/WebappsInstaller.jsm
tools/profiler/Profiler.jsm
uriloader/exthandler/nsHandlerService.js
uriloader/exthandler/nsWebHandlerApp.js
webapprt/CommandLineHandler.js
webapprt/ContentPermission.js
webapprt/ContentPolicy.js
webapprt/DirectoryProvider.js
webapprt/Startup.jsm
webapprt/WebappRT.jsm
webapprt/WebappsHandler.jsm
xpcom/ds/nsINIProcessor.js
xpcom/sample/nsSample.js
xpcom/tests/regorder/core/component.js
xpcom/tests/regorder/core/component2.js
xpcom/tests/regorder/extension/extComponent.js
xulrunner/examples/simple/components/src/SimpleTest.js
xulrunner/setup/nsXULAppInstall.js
--- a/accessible/src/jsat/AccessFu.jsm
+++ b/accessible/src/jsat/AccessFu.jsm
@@ -4,29 +4,29 @@
 
 'use strict';
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 const Cr = Components.results;
 
-var EXPORTED_SYMBOLS = ['AccessFu'];
+this.EXPORTED_SYMBOLS = ['AccessFu'];
 
 Cu.import('resource://gre/modules/Services.jsm');
 Cu.import('resource://gre/modules/Geometry.jsm');
 
 Cu.import('resource://gre/modules/accessibility/Utils.jsm');
 Cu.import('resource://gre/modules/accessibility/TouchAdapter.jsm');
 
 const ACCESSFU_DISABLE = 0;
 const ACCESSFU_ENABLE = 1;
 const ACCESSFU_AUTO = 2;
 
-var AccessFu = {
+this.AccessFu = {
   /**
    * Initialize chrome-layer accessibility functionality.
    * If accessibility is enabled on the platform, then a special accessibility
    * mode is started.
    */
   attach: function attach(aWindow) {
     if (this.chromeWin)
       // XXX: only supports attaching to one window now.
--- a/accessible/src/jsat/EventManager.jsm
+++ b/accessible/src/jsat/EventManager.jsm
@@ -8,19 +8,19 @@ var Cu = Components.utils;
 var Cr = Components.results;
 
 Cu.import('resource://gre/modules/accessibility/Utils.jsm');
 Cu.import('resource://gre/modules/accessibility/Presenters.jsm');
 Cu.import('resource://gre/modules/accessibility/TraversalRules.jsm');
 Cu.import('resource://gre/modules/Services.jsm');
 Cu.import('resource://gre/modules/XPCOMUtils.jsm');
 
-var EXPORTED_SYMBOLS = ['EventManager'];
+this.EXPORTED_SYMBOLS = ['EventManager'];
 
-var EventManager = {
+this.EventManager = {
   editState: {},
 
   start: function start(aSendMsgFunc) {
     try {
       if (!this._started) {
         this.sendMsgFunc = aSendMsgFunc || function() {};
         this.presenters = [new VisualPresenter()];
 
--- a/accessible/src/jsat/Presenters.jsm
+++ b/accessible/src/jsat/Presenters.jsm
@@ -8,21 +8,21 @@ const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 const Cr = Components.results;
 
 Cu.import('resource://gre/modules/accessibility/Utils.jsm');
 Cu.import('resource://gre/modules/accessibility/UtteranceGenerator.jsm');
 Cu.import('resource://gre/modules/Geometry.jsm');
 
-var EXPORTED_SYMBOLS = ['VisualPresenter',
-                        'AndroidPresenter',
-                        'DummyAndroidPresenter',
-                        'SpeechPresenter',
-                        'PresenterContext'];
+this.EXPORTED_SYMBOLS = ['VisualPresenter',
+                         'AndroidPresenter',
+                         'DummyAndroidPresenter',
+                         'SpeechPresenter',
+                         'PresenterContext'];
 
 /**
  * The interface for all presenter classes. A presenter could be, for example,
  * a speech output module, or a visual cursor indicator.
  */
 function Presenter() {}
 
 Presenter.prototype = {
@@ -106,17 +106,17 @@ Presenter.prototype = {
    */
   editingModeChanged: function editingModeChanged(aIsEditing) {}
 };
 
 /**
  * Visual presenter. Draws a box around the virtual cursor's position.
  */
 
-function VisualPresenter() {}
+this.VisualPresenter = function VisualPresenter() {}
 
 VisualPresenter.prototype = {
   __proto__: Presenter.prototype,
 
   type: 'Visual',
 
   /**
    * The padding in pixels between the object and the highlight border.
@@ -174,17 +174,17 @@ VisualPresenter.prototype = {
     return null;
   }
 };
 
 /**
  * Android presenter. Fires Android a11y events.
  */
 
-function AndroidPresenter() {}
+this.AndroidPresenter = function AndroidPresenter() {}
 
 AndroidPresenter.prototype = {
   __proto__: Presenter.prototype,
 
   type: 'Android',
 
   // Android AccessibilityEvent type constants.
   ANDROID_VIEW_CLICKED: 0x01,
@@ -327,17 +327,17 @@ AndroidPresenter.prototype = {
     };
   }
 };
 
 /**
  * A speech presenter for direct TTS output
  */
 
-function SpeechPresenter() {}
+this.SpeechPresenter = function SpeechPresenter() {}
 
 SpeechPresenter.prototype = {
   __proto__: Presenter.prototype,
 
   type: 'Speech',
 
   pivotChanged: function SpeechPresenter_pivotChanged(aContext, aReason) {
     if (!aContext.accessible)
@@ -371,17 +371,17 @@ SpeechPresenter.prototype = {
     };
   }
 };
 
 /**
  * PresenterContext: An object that generates and caches context information
  * for a given accessible and its relationship with another accessible.
  */
-function PresenterContext(aAccessible, aOldAccessible) {
+this.PresenterContext = function PresenterContext(aAccessible, aOldAccessible) {
   this._accessible = aAccessible;
   this._oldAccessible =
     this._isDefunct(aOldAccessible) ? null : aOldAccessible;
 }
 
 PresenterContext.prototype = {
   get accessible() {
     return this._accessible;
--- a/accessible/src/jsat/TouchAdapter.jsm
+++ b/accessible/src/jsat/TouchAdapter.jsm
@@ -4,25 +4,25 @@
 
 'use strict';
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 const Cr = Components.results;
 
-var EXPORTED_SYMBOLS = ['TouchAdapter', 'AndroidTouchAdapter'];
+this.EXPORTED_SYMBOLS = ['TouchAdapter', 'AndroidTouchAdapter'];
 
 Cu.import('resource://gre/modules/accessibility/Utils.jsm');
 
 // We should not be emitting explore events more than 10 times a second.
 // It is granular enough to feel natural, and it does not hammer the CPU.
 const EXPLORE_THROTTLE = 100;
 
-var TouchAdapter = {
+this.TouchAdapter = {
   // minimal swipe distance in inches
   SWIPE_MIN_DISTANCE: 0.4,
 
   // maximum duration of swipe
   SWIPE_MAX_DURATION: 400,
 
   // how straight does a swipe need to be
   SWIPE_DIRECTNESS: 1.2,
@@ -361,17 +361,17 @@ var Mouse2Touch = {
                          false, false, false, false, touches, touches, touches);
     }
     aEvent.target.dispatchEvent(evt);
     aEvent.preventDefault();
     aEvent.stopImmediatePropagation();
   }
 };
 
-var AndroidTouchAdapter = {
+this.AndroidTouchAdapter = {
   attach: function AndroidTouchAdapter_attach(aWindow) {
     if (this.chromeWin)
       return;
 
     Logger.info('AndroidTouchAdapter.attach');
 
     this.chromeWin = aWindow;
     this.chromeWin.addEventListener('mousemove', this, true, true);
--- a/accessible/src/jsat/TraversalRules.jsm
+++ b/accessible/src/jsat/TraversalRules.jsm
@@ -4,17 +4,17 @@
 
 'use strict';
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 const Cr = Components.results;
 
-var EXPORTED_SYMBOLS = ['TraversalRules'];
+this.EXPORTED_SYMBOLS = ['TraversalRules'];
 
 Cu.import('resource://gre/modules/accessibility/Utils.jsm');
 Cu.import('resource://gre/modules/XPCOMUtils.jsm');
 
 function BaseTraversalRule(aRoles, aMatchFunc) {
   this._matchRoles = aRoles;
   this._matchFunc = aMatchFunc;
 }
@@ -65,17 +65,17 @@ var gSimpleTraversalRoles =
    Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM,
    Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT,
    Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM,
    Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON,
    Ci.nsIAccessibleRole.ROLE_ENTRY,
    // Used for traversing in to child OOP frames.
    Ci.nsIAccessibleRole.ROLE_INTERNAL_FRAME];
 
-var TraversalRules = {
+this.TraversalRules = {
   Simple: new BaseTraversalRule(
     gSimpleTraversalRoles,
     function Simple_match(aAccessible) {
       switch (aAccessible.role) {
       case Ci.nsIAccessibleRole.ROLE_COMBOBOX:
         // We don't want to ignore the subtree because this is often
         // where the list box hangs out.
         return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
--- a/accessible/src/jsat/Utils.jsm
+++ b/accessible/src/jsat/Utils.jsm
@@ -5,19 +5,19 @@
 'use strict';
 
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 Cu.import('resource://gre/modules/Services.jsm');
 
-var EXPORTED_SYMBOLS = ['Utils', 'Logger'];
+this.EXPORTED_SYMBOLS = ['Utils', 'Logger'];
 
-var Utils = {
+this.Utils = {
   _buildAppMap: {
     '{3c2e2abc-06d4-11e1-ac3b-374f68613e61}': 'b2g',
     '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}': 'browser',
     '{aa3c5121-dab2-40e2-81ca-7ea25febc110}': 'mobile/android',
     '{a23983c0-fd0e-11dc-95ff-0800200c9a66}': 'mobile/xul'
   },
 
   get AccRetrieval() {
@@ -151,17 +151,17 @@ var Utils = {
         doc = doc.parentDocument;
       }
     }
 
     return null;
   }
 };
 
-var Logger = {
+this.Logger = {
   DEBUG: 0,
   INFO: 1,
   WARNING: 2,
   ERROR: 3,
   _LEVEL_NAMES: ['DEBUG', 'INFO', 'WARNING', 'ERROR'],
 
   logLevel: 1, // INFO;
 
--- a/accessible/src/jsat/UtteranceGenerator.jsm
+++ b/accessible/src/jsat/UtteranceGenerator.jsm
@@ -13,17 +13,17 @@ const INCLUDE_DESC = 0x01;
 const INCLUDE_NAME = 0x02;
 const INCLUDE_CUSTOM = 0x04;
 
 var gStringBundle = Cc['@mozilla.org/intl/stringbundle;1'].
   getService(Ci.nsIStringBundleService).
   createBundle('chrome://global/locale/AccessFu.properties');
 
 
-var EXPORTED_SYMBOLS = ['UtteranceGenerator'];
+this.EXPORTED_SYMBOLS = ['UtteranceGenerator'];
 
 Cu.import('resource://gre/modules/accessibility/Utils.jsm');
 
 /**
  * Generates speech utterances from objects, actions and state changes.
  * An utterance is an array of strings.
  *
  * It should not be assumed that flattening an utterance array would create a
@@ -33,17 +33,17 @@ Cu.import('resource://gre/modules/access
  * Another example from {@link genForObject}: ['list item 2 of 5', 'Alabama'].
  *
  * An utterance is ordered from the least to the most important. Speaking the
  * last string usually makes sense, but speaking the first often won't.
  * For example {@link genForAction} might return ['button', 'clicked'] for a
  * clicked event. Speaking only 'clicked' makes sense. Speaking 'button' does
  * not.
  */
-var UtteranceGenerator = {
+this.UtteranceGenerator = {
   gActionMap: {
     jump: 'jumpAction',
     press: 'pressAction',
     check: 'checkAction',
     uncheck: 'uncheckAction',
     select: 'selectAction',
     open: 'openAction',
     close: 'closeAction',
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -571,8 +571,10 @@ pref("browser.prompt.allowNative", false
 // no notifications). The delay is the same for both download and upload, though
 // they are handled separately. This pref is only read once at startup:
 // a restart is required to enable a new value.
 pref("network.activity.blipIntervalMilliseconds", 250);
 
 // Send some sites a custom user-agent.
 pref("general.useragent.override.facebook.com", "\(Mobile#(Android; Mobile");
 pref("general.useragent.override.youtube.com", "\(Mobile#(Android; Mobile");
+
+pref("jsloader.reuseGlobal", true);
--- a/b2g/components/ActivitiesGlue.js
+++ b/b2g/components/ActivitiesGlue.js
@@ -62,10 +62,10 @@ ActivitiesDialog.prototype = {
     Services.tm.currentThread.dispatch(this, Ci.nsIEventTarget.DISPATCH_NORMAL);
   },
 
   classID: Components.ID("{70a83123-7467-4389-a309-3e81c74ad002}"),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIActivityUIGlue, Ci.nsIRunnable])
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivitiesDialog]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivitiesDialog]);
 
--- a/b2g/components/AlertsService.js
+++ b/b2g/components/AlertsService.js
@@ -19,9 +19,9 @@ AlertsService.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIAlertsService]),
 
   showAlertNotification: function(aImageUrl, aTitle, aText, aTextClickable, aCookie, aAlertListener, aName) {
     let browser = Services.wm.getMostRecentWindow("navigator:browser");
     browser.AlertsHelper.showAlertNotification(aImageUrl, aTitle, aText, aTextClickable, aCookie, aAlertListener, aName);
   }
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([AlertsService]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AlertsService]);
--- a/b2g/components/ContentHandler.js
+++ b/b2g/components/ContentHandler.js
@@ -45,9 +45,9 @@ ContentHandler.prototype = {
 
     aRequest.cancel(Cr.NS_BINDING_ABORTED);
   },
 
   classID: Components.ID("{d18d0216-d50c-11e1-ba54-efb18d0ef0ac}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentHandler])
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentHandler]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentHandler]);
--- a/b2g/components/ContentPermissionPrompt.js
+++ b/b2g/components/ContentPermissionPrompt.js
@@ -140,9 +140,9 @@ ContentPermissionPrompt.prototype = {
 
   classID: Components.ID("{8c719f03-afe0-4aac-91ff-6c215895d467}"),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt])
 };
 
 
 //module initialization
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPermissionPrompt]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPermissionPrompt]);
--- a/b2g/components/DirectoryProvider.js
+++ b/b2g/components/DirectoryProvider.js
@@ -72,9 +72,9 @@ DirectoryProvider.prototype = {
     }
 
     dir.appendRelativePath("updates");
     persistent.value = false;
     return dir;
   }
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([DirectoryProvider]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DirectoryProvider]);
--- a/b2g/components/MailtoProtocolHandler.js
+++ b/b2g/components/MailtoProtocolHandler.js
@@ -38,9 +38,9 @@ MailtoProtocolHandler.prototype = {
 
     throw Components.results.NS_ERROR_ILLEGAL_VALUE;
   },
 
   classID: Components.ID("{50777e53-0331-4366-a191-900999be386c}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])
 };
 
-let NSGetFactory = XPCOMUtils.generateNSGetFactory([MailtoProtocolHandler]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MailtoProtocolHandler]);
--- a/b2g/components/MozKeyboard.js
+++ b/b2g/components/MozKeyboard.js
@@ -131,10 +131,10 @@ MozKeyboard.prototype = {
         dump('Error loading ' + kFormsFrameScript + ' as frame script: ' + e + '\n');
       }
       break;
     }
     }
   }
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([MozKeyboard]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MozKeyboard]);
 
--- a/b2g/components/PaymentGlue.js
+++ b/b2g/components/PaymentGlue.js
@@ -164,9 +164,9 @@ PaymentUI.prototype = {
     return uuidgen.generateUUID().toString();
   },
 
   classID: Components.ID("{8b83eabc-7929-47f4-8b48-4dea8d887e4b}"),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentUIGlue])
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([PaymentUI]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PaymentUI]);
--- a/b2g/components/ProcessGlobal.js
+++ b/b2g/components/ProcessGlobal.js
@@ -52,9 +52,9 @@ ProcessGlobal.prototype = {
       Services.console.logStringMessage(prefix + Array.join(message.arguments,
                                                             ' '));
       break;
     }
     }
   },
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([ProcessGlobal]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ProcessGlobal]);
--- a/b2g/components/RecoveryService.js
+++ b/b2g/components/RecoveryService.js
@@ -85,9 +85,9 @@ RecoveryService.prototype = {
       status = cStatus.result;
     }
 
 #endif
     return status;
   }
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([RecoveryService]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RecoveryService]);
--- a/b2g/components/SmsProtocolHandler.js
+++ b/b2g/components/SmsProtocolHandler.js
@@ -51,9 +51,9 @@ SmsProtocolHandler.prototype = {
 
     throw Components.results.NS_ERROR_ILLEGAL_VALUE;
   },
 
   classID: Components.ID("{81ca20cb-0dad-4e32-8566-979c8998bd73}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])
 };
 
-let NSGetFactory = XPCOMUtils.generateNSGetFactory([SmsProtocolHandler]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SmsProtocolHandler]);
--- a/b2g/components/TelProtocolHandler.js
+++ b/b2g/components/TelProtocolHandler.js
@@ -50,9 +50,9 @@ TelProtocolHandler.prototype = {
 
     throw Components.results.NS_ERROR_ILLEGAL_VALUE;
   },
 
   classID: Components.ID("{782775dd-7351-45ea-aff1-0ffa872cfdd2}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])
 };
 
-let NSGetFactory = XPCOMUtils.generateNSGetFactory([TelProtocolHandler]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TelProtocolHandler]);
--- a/b2g/components/TelURIParser.jsm
+++ b/b2g/components/TelURIParser.jsm
@@ -1,20 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-let EXPORTED_SYMBOLS = ["TelURIParser"];
+this.EXPORTED_SYMBOLS = ["TelURIParser"];
 
 /**
  * Singleton providing functionality for parsing tel: and sms: URIs
  */
-let TelURIParser = {
+this.TelURIParser = {
   parseURI: function(scheme, uri) {
     // Ignore MWI and USSD codes. See 794034.
     if (uri.indexOf('*') != -1 || uri.indexOf('#') != -1) {
       return null;
     }
 
     // https://www.ietf.org/rfc/rfc2806.txt
     let subscriber = uri.slice((scheme + ':').length);
--- a/b2g/components/UpdatePrompt.js
+++ b/b2g/components/UpdatePrompt.js
@@ -406,9 +406,9 @@ UpdatePrompt.prototype = {
       progress: aProgress,
       total: aProgressMax
     });
   },
 
   onStatus: function UP_onStatus(aRequest, aUpdate, aStatus, aStatusArg) { }
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([UpdatePrompt]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UpdatePrompt]);
--- a/b2g/components/YoutubeProtocolHandler.js
+++ b/b2g/components/YoutubeProtocolHandler.js
@@ -124,9 +124,9 @@ YoutubeProtocolHandler.prototype = {
     throw Components.results.NS_ERROR_ILLEGAL_VALUE;
   },
 
   allowPort: function yt_phAllowPort(aPort, aScheme) {
     return false;
   }
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([YoutubeProtocolHandler]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([YoutubeProtocolHandler]);
--- a/browser/components/distribution.js
+++ b/browser/components/distribution.js
@@ -1,27 +1,27 @@
 /* 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/. */
 
-EXPORTED_SYMBOLS = [ "DistributionCustomizer" ];
+this.EXPORTED_SYMBOLS = [ "DistributionCustomizer" ];
 
 const Ci = Components.interfaces;
 const Cc = Components.classes;
 const Cr = Components.results;
 const Cu = Components.utils;
 
 const DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC =
   "distribution-customization-complete";
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
                                   "resource://gre/modules/PlacesUtils.jsm");
 
-function DistributionCustomizer() {
+this.DistributionCustomizer = function DistributionCustomizer() {
   let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
                getService(Ci.nsIProperties);
   let iniFile = dirSvc.get("XCurProcD", Ci.nsIFile);
   iniFile.append("distribution");
   iniFile.append("distribution.ini");
   if (iniFile.exists())
     this._iniFile = iniFile;
 }
--- a/browser/components/downloads/src/DownloadsCommon.jsm
+++ b/browser/components/downloads/src/DownloadsCommon.jsm
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-var EXPORTED_SYMBOLS = [
+this.EXPORTED_SYMBOLS = [
   "DownloadsCommon",
 ];
 
 /**
  * Handles the Downloads panel shared methods and data access.
  *
  * This file includes the following constructors and global objects:
  *
@@ -82,17 +82,17 @@ XPCOMUtils.defineLazyGetter(this, "Downl
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DownloadsCommon
 
 /**
  * This object is exposed directly to the consumers of this JavaScript module,
  * and provides shared methods for all the instances of the user interface.
  */
-const DownloadsCommon = {
+this.DownloadsCommon = {
   /**
    * Returns an object whose keys are the string names from the downloads string
    * bundle, and whose values are either the translated strings or functions
    * returning formatted strings.
    */
   get strings()
   {
     let strings = {};
--- a/browser/components/downloads/src/DownloadsStartup.js
+++ b/browser/components/downloads/src/DownloadsStartup.js
@@ -268,9 +268,9 @@ DownloadsStartup.prototype = {
     // downloads from the previous session are loaded.
     DownloadsCommon.data.ensurePersistentDataLoaded(!this._recoverAllDownloads);
   }
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Module
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadsStartup]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadsStartup]);
--- a/browser/components/downloads/src/DownloadsUI.js
+++ b/browser/components/downloads/src/DownloadsUI.js
@@ -99,9 +99,9 @@ DownloadsUI.prototype = {
       this._toolkitUI.getAttention();
     }
   }
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Module
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadsUI]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadsUI]);
--- a/browser/components/feeds/src/FeedConverter.js
+++ b/browser/components/feeds/src/FeedConverter.js
@@ -574,9 +574,9 @@ PodCastProtocolHandler.prototype = new G
 PodCastProtocolHandler.prototype.classID = Components.ID("{1c31ed79-accd-4b94-b517-06e0c81999d5}");
 
 var components = [FeedConverter,
                   FeedResultService,
                   FeedProtocolHandler,
                   PodCastProtocolHandler];
 
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/browser/components/feeds/src/FeedWriter.js
+++ b/browser/components/feeds/src/FeedWriter.js
@@ -1373,9 +1373,9 @@ FeedWriter.prototype = {
                                     contractID: FEEDWRITER_CONTRACTID,
                                     interfaces: [Ci.nsIFeedWriter],
                                     flags: Ci.nsIClassInfo.DOM_OBJECT}),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIFeedWriter,
                                          Ci.nsIDOMEventListener, Ci.nsIObserver,
                                          Ci.nsINavHistoryObserver])
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([FeedWriter]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FeedWriter]);
--- a/browser/components/feeds/src/WebContentConverter.js
+++ b/browser/components/feeds/src/WebContentConverter.js
@@ -894,9 +894,9 @@ WebContentConverterRegistrar.prototype =
       Ci.nsIFactory]),
 
   _xpcom_categories: [{
     category: "app-startup",
     service: true
   }]
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([WebContentConverterRegistrar]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WebContentConverterRegistrar]);
--- a/browser/components/migration/src/ChromeProfileMigrator.js
+++ b/browser/components/migration/src/ChromeProfileMigrator.js
@@ -335,9 +335,9 @@ function GetCookiesResource(aProfileFold
     }
   }
 }
 
 ChromeProfileMigrator.prototype.classDescription = "Chrome Profile Migrator";
 ChromeProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=chrome";
 ChromeProfileMigrator.prototype.classID = Components.ID("{4cec1de4-1671-4fc3-a53e-6c539dc77a26}");
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([ChromeProfileMigrator]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ChromeProfileMigrator]);
--- a/browser/components/migration/src/FirefoxProfileMigrator.js
+++ b/browser/components/migration/src/FirefoxProfileMigrator.js
@@ -86,9 +86,9 @@ Object.defineProperty(FirefoxProfileMigr
   get: function() true
 });
 
 
 FirefoxProfileMigrator.prototype.classDescription = "Firefox Profile Migrator";
 FirefoxProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=firefox";
 FirefoxProfileMigrator.prototype.classID = Components.ID("{91185366-ba97-4438-acba-48deaca63386}");
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([FirefoxProfileMigrator]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FirefoxProfileMigrator]);
--- a/browser/components/migration/src/IEProfileMigrator.js
+++ b/browser/components/migration/src/IEProfileMigrator.js
@@ -670,9 +670,9 @@ Object.defineProperty(IEProfileMigrator.
     return homepage;
   }
 });
 
 IEProfileMigrator.prototype.classDescription = "IE Profile Migrator";
 IEProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=ie";
 IEProfileMigrator.prototype.classID = Components.ID("{3d2532e3-4932-4774-b7ba-968f5899d3a4}");
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([IEProfileMigrator]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([IEProfileMigrator]);
--- a/browser/components/migration/src/MigrationUtils.jsm
+++ b/browser/components/migration/src/MigrationUtils.jsm
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-let EXPORTED_SYMBOLS = ["MigrationUtils", "MigratorPrototype"];
+this.EXPORTED_SYMBOLS = ["MigrationUtils", "MigratorPrototype"];
 
 const Cu = Components.utils;
 const Ci = Components.interfaces;
 const Cc = Components.classes;
 
 const TOPIC_WILL_IMPORT_BOOKMARKS = "initial-migration-will-import-default-bookmarks";
 const TOPIC_DID_IMPORT_BOOKMARKS = "initial-migration-did-import-default-bookmarks";
 
@@ -81,17 +81,17 @@ function getMigratorKeyForDefaultBrowser
  *    NSGetFactory appropriately.
  * 4. If the migrator supports multiple profiles, override the sourceProfiles
  *    Here we default for single-profile migrator.
  * 5. Implement getResources(aProfile) (see below).
  * 6. If the migrator supports reading the home page of the source browser,
  *    override |sourceHomePageURL| getter.
  * 7. For startup-only migrators, override |startupOnlyMigrator|.
  */
-let MigratorPrototype = {
+this.MigratorPrototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserProfileMigrator]),
 
   /**
    * OVERRIDE IF AND ONLY IF the source supports multiple profiles.
    *
    * Returns array of profiles (by names) from which data may be imported.
    *
    * Only profiles from which data can be imported should be listed.  Otherwise
@@ -318,17 +318,17 @@ let MigratorPrototype = {
     }
     else {
       this._resourcesByProfile = { };
     }
     return this._resourcesByProfile[aProfile] = this.getResources(aProfile);
   }
 };
 
-let MigrationUtils = Object.freeze({
+this.MigrationUtils = Object.freeze({
   resourceTypes: {
     SETTINGS:   Ci.nsIBrowserProfileMigrator.SETTINGS,
     COOKIES:    Ci.nsIBrowserProfileMigrator.COOKIES,
     HISTORY:    Ci.nsIBrowserProfileMigrator.HISTORY,
     FORMDATA:   Ci.nsIBrowserProfileMigrator.FORMDATA,
     PASSWORDS:  Ci.nsIBrowserProfileMigrator.PASSWORDS,
     BOOKMARKS:  Ci.nsIBrowserProfileMigrator.BOOKMARKS,
     OTHERDATA:  Ci.nsIBrowserProfileMigrator.OTHERDATA
--- a/browser/components/migration/src/ProfileMigrator.js
+++ b/browser/components/migration/src/ProfileMigrator.js
@@ -13,9 +13,9 @@ function ProfileMigrator() {
 ProfileMigrator.prototype = {
   migrate: MigrationUtils.startupMigration.bind(MigrationUtils),
   QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIProfileMigrator]),
   classDescription: "Profile Migrator",
   contractID: "@mozilla.org/toolkit/profile-migrator;1",
   classID: Components.ID("6F8BB968-C14F-4D6F-9733-6C6737B35DCE")
 };
 
-let NSGetFactory = XPCOMUtils.generateNSGetFactory([ProfileMigrator]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ProfileMigrator]);
--- a/browser/components/migration/src/SafariProfileMigrator.js
+++ b/browser/components/migration/src/SafariProfileMigrator.js
@@ -672,9 +672,9 @@ Object.defineProperty(SafariProfileMigra
     return "";
   }
 });
 
 SafariProfileMigrator.prototype.classDescription = "Safari Profile Migrator";
 SafariProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=safari";
 SafariProfileMigrator.prototype.classID = Components.ID("{4b609ecf-60b2-4655-9df4-dc149e474da1}");
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([SafariProfileMigrator]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SafariProfileMigrator]);
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -820,9 +820,9 @@ nsDefaultCommandLineHandler.prototype = 
                  gBrowserContentHandler.defaultArgs, NO_EXTERNAL_URIS);
     }
   },
 
   helpInfo : "",
 };
 
 var components = [nsBrowserContentHandler, nsDefaultCommandLineHandler];
-var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1746,9 +1746,9 @@ ContentPermissionPrompt.prototype = {
 
     secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_GEOLOCATION_REQUEST);
     chromeWin.PopupNotifications.show(browser, "geolocation", message, "geo-notification-icon",
                                       mainAction, secondaryActions);
   }
 };
 
 var components = [BrowserGlue, ContentPermissionPrompt];
-var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/browser/components/places/src/PlacesProtocolHandler.js
+++ b/browser/components/places/src/PlacesProtocolHandler.js
@@ -41,9 +41,9 @@ PlacesProtocolHandler.prototype = {
 
   QueryInterface: XPCOMUtils.generateQI([
     Ci.nsIProtocolHandler
   ]),
 
   classID: Components.ID("{6bcb9bde-9018-4443-a071-c32653469597}")
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([PlacesProtocolHandler]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PlacesProtocolHandler]);
--- a/browser/components/places/src/PlacesUIUtils.jsm
+++ b/browser/components/places/src/PlacesUIUtils.jsm
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-var EXPORTED_SYMBOLS = ["PlacesUIUtils"];
+this.EXPORTED_SYMBOLS = ["PlacesUIUtils"];
 
 var Ci = Components.interfaces;
 var Cc = Components.classes;
 var Cr = Components.results;
 var Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
@@ -16,17 +16,17 @@ Cu.import("resource://gre/modules/Servic
 XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
                                   "resource://gre/modules/PluralForm.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
   Cu.import("resource://gre/modules/PlacesUtils.jsm");
   return PlacesUtils;
 });
 
-var PlacesUIUtils = {
+this.PlacesUIUtils = {
   ORGANIZER_LEFTPANE_VERSION: 7,
   ORGANIZER_FOLDER_ANNO: "PlacesOrganizer/OrganizerFolder",
   ORGANIZER_QUERY_ANNO: "PlacesOrganizer/OrganizerQuery",
 
   LOAD_IN_SIDEBAR_ANNO: "bookmarkProperties/loadInSidebar",
   DESCRIPTION_ANNO: "bookmarkProperties/description",
 
   TYPE_TAB_DROP: "application/x-moz-tabbrowser-tab",
--- a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
+++ b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
@@ -586,9 +586,9 @@ PrivateBrowsingService.prototype = {
   /**
    * Whether the latest transition was initiated from the command line.
    */
   get lastChangedByCommandLine() {
     return this._lastChangedByCommandLine;
   }
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([PrivateBrowsingService]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PrivateBrowsingService]);
--- a/browser/components/sessionstore/src/DocumentUtils.jsm
+++ b/browser/components/sessionstore/src/DocumentUtils.jsm
@@ -1,21 +1,21 @@
 /* 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/. */
 
-EXPORTED_SYMBOLS = [ "DocumentUtils" ];
+this.EXPORTED_SYMBOLS = [ "DocumentUtils" ];
 
 const Cu = Components.utils;
 const Ci = Components.interfaces;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource:///modules/sessionstore/XPathGenerator.jsm");
 
-let DocumentUtils = {
+this.DocumentUtils = {
   /**
    * Obtain form data for a DOMDocument instance.
    *
    * The returned object has 2 keys, "id" and "xpath". Each key holds an object
    * which further defines form data.
    *
    * The "id" object maps element IDs to values. The "xpath" object maps the
    * XPath of an element to its value.
--- a/browser/components/sessionstore/src/SessionStorage.jsm
+++ b/browser/components/sessionstore/src/SessionStorage.jsm
@@ -1,23 +1,23 @@
 /* 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/. */
 
-let EXPORTED_SYMBOLS = ["SessionStorage"];
+this.EXPORTED_SYMBOLS = ["SessionStorage"];
 
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "SessionStore",
   "resource:///modules/sessionstore/SessionStore.jsm");
 
-let SessionStorage = {
+this.SessionStorage = {
   /**
    * Updates all sessionStorage "super cookies"
    * @param aDocShell
    *        That tab's docshell (containing the sessionStorage)
    * @param aFullData
    *        always return privacy sensitive data (use with care)
    */
   serialize: function ssto_serialize(aDocShell, aFullData) {
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -1,13 +1,13 @@
 /* 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/. */
 
-let EXPORTED_SYMBOLS = ["SessionStore"];
+this.EXPORTED_SYMBOLS = ["SessionStore"];
 
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 
 const STATE_STOPPED = 0;
 const STATE_RUNNING = 1;
@@ -94,17 +94,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
   "@mozilla.org/xre/app-info;1", "nsICrashReporter");
 #endif
 
 function debug(aMsg) {
   aMsg = ("SessionStore: " + aMsg).replace(/\S{80}/g, "$&\n");
   Services.console.logStringMessage(aMsg);
 }
 
-let SessionStore = {
+this.SessionStore = {
   get canRestoreLastSession() {
     return SessionStoreInternal.canRestoreLastSession;
   },
 
   set canRestoreLastSession(val) {
     SessionStoreInternal.canRestoreLastSession = val;
   },
 
--- a/browser/components/sessionstore/src/XPathGenerator.jsm
+++ b/browser/components/sessionstore/src/XPathGenerator.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
-let EXPORTED_SYMBOLS = ["XPathGenerator"];
+this.EXPORTED_SYMBOLS = ["XPathGenerator"];
 
-let XPathGenerator = {
+this.XPathGenerator = {
   // these two hashes should be kept in sync
   namespaceURIs:     { "xhtml": "http://www.w3.org/1999/xhtml" },
   namespacePrefixes: { "http://www.w3.org/1999/xhtml": "xhtml" },
 
   /**
    * Generates an approximate XPath query to an (X)HTML node
    */
   generate: function sss_xph_generate(aNode) {
--- a/browser/components/sessionstore/src/nsSessionStartup.js
+++ b/browser/components/sessionstore/src/nsSessionStartup.js
@@ -314,9 +314,9 @@ SessionStartup.prototype = {
 
   /* ........ QueryInterface .............. */
   QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
                                           Ci.nsISupportsWeakReference,
                                           Ci.nsISessionStartup]),
   classID:          Components.ID("{ec7a6c20-e081-11da-8ad9-0800200c9a66}"),
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStartup]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStartup]);
--- a/browser/components/sessionstore/src/nsSessionStore.js
+++ b/browser/components/sessionstore/src/nsSessionStore.js
@@ -29,9 +29,9 @@ Object.keys(SessionStore).forEach(functi
   Object.defineProperty(SessionStoreService.prototype, aName, desc);
 });
 
 SessionStoreService.prototype.classID =
   Components.ID("{5280606b-2510-4fe0-97ef-9b5a22eafe6b}");
 SessionStoreService.prototype.QueryInterface =
   XPCOMUtils.generateQI([Ci.nsISessionStore]);
 
-let NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStoreService]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStoreService]);
--- a/browser/components/shell/src/nsSetDefaultBrowser.js
+++ b/browser/components/shell/src/nsSetDefaultBrowser.js
@@ -23,9 +23,9 @@ nsSetDefaultBrowser.prototype = {
   },
 
   helpInfo: "  -setDefaultBrowser Set this app as the default browser.\n",
 
   classID: Components.ID("{F57899D0-4E2C-4ac6-9E29-50C736103B0C}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSetDefaultBrowser]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSetDefaultBrowser]);
--- a/browser/components/sidebar/nsSidebar.js
+++ b/browser/components/sidebar/nsSidebar.js
@@ -178,15 +178,15 @@ function (aSearchURL)
 nsSidebar.prototype.classInfo = XPCOMUtils.generateCI({classID: SIDEBAR_CID,
                                                        contractID: SIDEBAR_CONTRACTID,
                                                        classDescription: "Sidebar",
                                                        interfaces: [nsISidebar, nsISidebarExternal],
                                                        flags: nsIClassInfo.DOM_OBJECT});
 
 nsSidebar.prototype.QueryInterface = XPCOMUtils.generateQI([nsISidebar, nsISidebarExternal]);
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSidebar]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSidebar]);
 
 /* static functions */
 if (DEBUG)
     debug = function (s) { dump("-*- sidebar component: " + s + "\n"); }
 else
     debug = function (s) {}
--- a/browser/components/tabview/modules/utils.jsm
+++ b/browser/components/tabview/modules/utils.jsm
@@ -2,33 +2,33 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // **********
 // Title: utils.js
 
-let EXPORTED_SYMBOLS = ["Point", "Rect", "Range", "Subscribable", "Utils", "MRUList"];
+this.EXPORTED_SYMBOLS = ["Point", "Rect", "Range", "Subscribable", "Utils", "MRUList"];
 
 // #########
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 // ##########
 // Class: Point
 // A simple point.
 //
 // Constructor: Point
 // If a is a Point, creates a copy of it. Otherwise, expects a to be x,
 // and creates a Point with it along with y. If either a or y are omitted,
 // 0 is used in their place.
-function Point(a, y) {
+this.Point = function Point(a, y) {
   if (Utils.isPoint(a)) {
     this.x = a.x;
     this.y = a.y;
   } else {
     this.x = (Utils.isNumber(a) ? a : 0);
     this.y = (Utils.isNumber(y) ? y : 0);
   }
 };
@@ -55,17 +55,17 @@ Point.prototype = {
 // Class: Rect
 // A simple rectangle. Note that in addition to the left and width, it also has
 // a right property; changing one affects the others appropriately. Same for the
 // vertical properties.
 //
 // Constructor: Rect
 // If a is a Rect, creates a copy of it. Otherwise, expects a to be left,
 // and creates a Rect with it along with top, width, and height.
-function Rect(a, top, width, height) {
+this.Rect = function Rect(a, top, width, height) {
   // Note: perhaps 'a' should really be called 'rectOrLeft'
   if (Utils.isRect(a)) {
     this.left = a.left;
     this.top = a.top;
     this.width = a.width;
     this.height = a.height;
   } else {
     this.left = a;
@@ -246,17 +246,17 @@ Rect.prototype = {
 };
 
 // ##########
 // Class: Range
 // A physical interval, with a min and max.
 //
 // Constructor: Range
 // Creates a Range with the given min and max
-function Range(min, max) {
+this.Range = function Range(min, max) {
   if (Utils.isRange(min) && !max) { // if the one variable given is a range, copy it.
     this.min = min.min;
     this.max = min.max;
   } else {
     this.min = min || 0;
     this.max = max || 0;
   }
 };
@@ -352,17 +352,17 @@ Range.prototype = {
       value = 0;
     return this.min + this.extent * value;
   }
 };
 
 // ##########
 // Class: Subscribable
 // A mix-in for allowing objects to collect subscribers for custom events.
-function Subscribable() {
+this.Subscribable = function Subscribable() {
   this.subscribers = null;
 };
 
 Subscribable.prototype = {
   // ----------
   // Function: addSubscriber
   // The given callback will be called when the Subscribable fires the given event.
   addSubscriber: function Subscribable_addSubscriber(eventName, callback) {
@@ -433,17 +433,17 @@ Subscribable.prototype = {
       }
     }, this);
   }
 };
 
 // ##########
 // Class: Utils
 // Singelton with common utility functions.
-let Utils = {
+this.Utils = {
   // ----------
   // Function: toString
   // Prints [Utils] for debug use
   toString: function Utils_toString() {
     return "[Utils]";
   },
 
   // ___ Logging
@@ -763,17 +763,17 @@ let Utils = {
 };
 
 // ##########
 // Class: MRUList
 // A most recently used list.
 //
 // Constructor: MRUList
 // If a is an array of entries, creates a copy of it.
-function MRUList(a) {
+this.MRUList = function MRUList(a) {
   if (Array.isArray(a))
     this._list = a.concat();
   else
     this._list = [];
 };
 
 MRUList.prototype = {
   // ----------
--- a/browser/components/thumbnails/PageThumbs.jsm
+++ b/browser/components/thumbnails/PageThumbs.jsm
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-let EXPORTED_SYMBOLS = ["PageThumbs", "PageThumbsStorage"];
+this.EXPORTED_SYMBOLS = ["PageThumbs", "PageThumbsStorage"];
 
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
 const PREF_STORAGE_VERSION = "browser.pagethumbnails.storage_version";
 const LATEST_STORAGE_VERSION = 2;
@@ -54,17 +54,17 @@ XPCOMUtils.defineLazyGetter(this, "gUnic
   converter.charset = 'utf8';
   return converter;
 });
 
 /**
  * Singleton providing functionality for capturing web page thumbnails and for
  * accessing them if already cached.
  */
-let PageThumbs = {
+this.PageThumbs = {
   _initialized: false,
 
   /**
    * The calculated width and height of the thumbnails.
    */
   _thumbnailWidth : 0,
   _thumbnailHeight : 0,
 
@@ -273,17 +273,17 @@ let PageThumbs = {
       return Services.prefs.getBoolPref("browser.pageThumbs.enabled");
     }
     catch (e) {
       return true;
     }
   },
 };
 
-let PageThumbsStorage = {
+this.PageThumbsStorage = {
   getDirectory: function Storage_getDirectory(aCreate = true) {
     return FileUtils.getDir("ProfLD", [THUMBNAIL_DIRECTORY], aCreate);
   },
 
   getLeafNameForURL: function Storage_getLeafNameForURL(aURL) {
     let hash = this._calculateMD5Hash(aURL);
     return hash + ".png";
   },
--- a/browser/components/thumbnails/PageThumbsProtocol.js
+++ b/browser/components/thumbnails/PageThumbsProtocol.js
@@ -83,17 +83,17 @@ Protocol.prototype = {
    * @return Always false, we'll never allow ports.
    */
   allowPort: function () false,
 
   classID: Components.ID("{5a4ae9b5-f475-48ae-9dce-0b4c1d347884}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])
 };
 
-let NSGetFactory = XPCOMUtils.generateNSGetFactory([Protocol]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Protocol]);
 
 /**
  * Parses a given URI and extracts all parameters relevant to this protocol.
  * @param aURI The URI to parse.
  * @return The parsed parameters.
  */
 function parseURI(aURI) {
   let {scheme, staticHost} = PageThumbs;
--- a/browser/devtools/commandline/CmdAddon.jsm
+++ b/browser/devtools/commandline/CmdAddon.jsm
@@ -1,26 +1,26 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ "Flags" ];
+this.EXPORTED_SYMBOLS = [ "Flags" ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
                                   "resource://gre/modules/AddonManager.jsm");
 
 // We need to use an object in which to store any flags because a primitive
 // would remain undefined.
-let Flags = {
+this.Flags = {
   addonsLoaded: false
 };
 
 /**
  * 'addon' command.
  */
 gcli.addCommand({
   name: "addon",
--- a/browser/devtools/commandline/CmdBreak.jsm
+++ b/browser/devtools/commandline/CmdBreak.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "HUDService",
                                   "resource:///modules/HUDService.jsm");
 
 /**
--- a/browser/devtools/commandline/CmdCalllog.jsm
+++ b/browser/devtools/commandline/CmdCalllog.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "HUDService",
                                   "resource:///modules/HUDService.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "Debugger", function() {
--- a/browser/devtools/commandline/CmdCalllogChrome.jsm
+++ b/browser/devtools/commandline/CmdCalllogChrome.jsm
@@ -1,14 +1,14 @@
 /* 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/. */
 
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "HUDService",
                                   "resource:///modules/HUDService.jsm");
--- a/browser/devtools/commandline/CmdCmd.jsm
+++ b/browser/devtools/commandline/CmdCmd.jsm
@@ -1,13 +1,13 @@
 /* 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/. */
 
-let EXPORTED_SYMBOLS = [ "CmdCommands" ];
+this.EXPORTED_SYMBOLS = [ "CmdCommands" ];
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 let prefSvc = "@mozilla.org/preferences-service;1";
 XPCOMUtils.defineLazyGetter(this, "prefBranch", function() {
@@ -27,17 +27,17 @@ const PREF_DIR = "devtools.commands.dir"
  * calling refreshAutoCommands(). Used by refreshAutoCommands to remove the
  * added commands.
  */
 let commands = [];
 
 /**
  * Exported API
  */
-let CmdCommands = {
+this.CmdCommands = {
   /**
    * Called to look in a directory pointed at by the devtools.commands.dir pref
    * for *.mozcmd files which are then loaded.
    * @param nsIPrincipal aSandboxPrincipal Scope object for the Sandbox in which
    * we eval the script from the .mozcmd file. This should be a chrome window.
    */
   refreshAutoCommands: function GC_refreshAutoCommands(aSandboxPrincipal) {
     // First get rid of the last set of commands
--- a/browser/devtools/commandline/CmdConsole.jsm
+++ b/browser/devtools/commandline/CmdConsole.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "HUDService",
                                   "resource:///modules/HUDService.jsm");
 
 /**
--- a/browser/devtools/commandline/CmdCookie.jsm
+++ b/browser/devtools/commandline/CmdCookie.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "console",
                                   "resource://gre/modules/devtools/Console.jsm");
 
 // We should really be using nsICookieManager so we can read more than just the
--- a/browser/devtools/commandline/CmdDbg.jsm
+++ b/browser/devtools/commandline/CmdDbg.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 /**
  * 'dbg' command
  */
 gcli.addCommand({
--- a/browser/devtools/commandline/CmdEcho.jsm
+++ b/browser/devtools/commandline/CmdEcho.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 
 /**
  * 'echo' command
  */
 gcli.addCommand({
   name: "echo",
--- a/browser/devtools/commandline/CmdExport.jsm
+++ b/browser/devtools/commandline/CmdExport.jsm
@@ -1,14 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-let EXPORTED_SYMBOLS = [ ];
+
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 
 /**
  * 'export' command
  */
 gcli.addCommand({
   name: "export",
--- a/browser/devtools/commandline/CmdJsb.jsm
+++ b/browser/devtools/commandline/CmdJsb.jsm
@@ -1,17 +1,17 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 const XMLHttpRequest =
   Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1");
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource:///modules/devtools/gcli.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "js_beautify",
                                   "resource:///modules/devtools/Jsbeautify.jsm");
 
 /**
--- a/browser/devtools/commandline/CmdPagemod.jsm
+++ b/browser/devtools/commandline/CmdPagemod.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 
 /**
  * 'pagemod' command
  */
 gcli.addCommand({
   name: "pagemod",
--- a/browser/devtools/commandline/CmdRestart.jsm
+++ b/browser/devtools/commandline/CmdRestart.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 /**
  * Restart command
  *
  * @param boolean nocache
--- a/browser/devtools/commandline/CmdScreenshot.jsm
+++ b/browser/devtools/commandline/CmdScreenshot.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "LayoutHelpers",
                                   "resource:///modules/devtools/LayoutHelpers.jsm");
 
 // String used as an indication to generate default file name in the following
--- a/browser/devtools/commandline/Commands.jsm
+++ b/browser/devtools/commandline/Commands.jsm
@@ -1,14 +1,14 @@
 /* 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/. */
 
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 const Cu = Components.utils;
 
 Cu.import("resource:///modules/devtools/CmdAddon.jsm");
 Cu.import("resource:///modules/devtools/CmdBreak.jsm");
 Cu.import("resource:///modules/devtools/CmdCalllog.jsm");
 Cu.import("resource:///modules/devtools/CmdCalllogChrome.jsm");
 Cu.import("resource:///modules/devtools/CmdConsole.jsm");
--- a/browser/devtools/commandline/gcli.jsm
+++ b/browser/devtools/commandline/gcli.jsm
@@ -19,17 +19,17 @@
 /**
  * DO NOT MODIFY THIS FILE DIRECTLY.
  * This file is generated from separate files stored in the GCLI project.
  * Please modify the files there and use the import script so the 2 projects
  * are kept in sync.
  * For more information, ask Joe Walker <jwalker@mozilla.com>
  */
 
-var EXPORTED_SYMBOLS = [ "gcli" ];
+this.EXPORTED_SYMBOLS = [ "gcli" ];
 
 Components.utils.import("resource://gre/modules/devtools/Require.jsm");
 Components.utils.import("resource://gre/modules/devtools/Console.jsm");
 Components.utils.import("resource:///modules/devtools/Browser.jsm");
 
 /*
  * Copyright 2012, Mozilla Foundation and contributors
  *
@@ -10474,9 +10474,9 @@ define("text!gcli/ui/tooltip.html", [], 
   "  ${field.element}\n" +
   "  <div class=\"gcli-tt-error\" save=\"${errorEle}\">${assignment.conversion.message}</div>\n" +
   "  <div class=\"gcli-tt-highlight\" save=\"${highlightEle}\"></div>\n" +
   "</div>\n" +
   "");
 
 
 // Satisfy EXPORTED_SYMBOLS
-const gcli = require('gcli/index');
+this.gcli = require('gcli/index');
--- a/browser/devtools/commandline/test/helpers.js
+++ b/browser/devtools/commandline/test/helpers.js
@@ -49,17 +49,17 @@
  *   helpers.setup(options);
  *   dump(helpers._createDebugCheck() + '\n\n');
  * };
  *
  * Now GCLI will emit output on every keypress that both explains the state
  * of GCLI and can be run as a test case.
  */
 
-var EXPORTED_SYMBOLS = [ 'helpers' ];
+this.EXPORTED_SYMBOLS = [ 'helpers' ];
 
 var test = { };
 
 /**
  * Various functions for testing DeveloperToolbar.
  * Parts of this code exist in:
  * - browser/devtools/commandline/test/head.js
  * - browser/devtools/shared/test/head.js
@@ -498,17 +498,17 @@ DeveloperToolbarTest.checkNotCalled = fu
 DeveloperToolbarTest.closeAllTabs = function() {
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 
-var helpers = {};
+this.helpers = {};
 
 var assert = { ok: ok, is: is, log: info };
 
 helpers._display = undefined;
 helpers._options = undefined;
 
 helpers.setup = function(options) {
   helpers._options = options;
--- a/browser/devtools/debugger/DebuggerUI.jsm
+++ b/browser/devtools/debugger/DebuggerUI.jsm
@@ -20,28 +20,28 @@ XPCOMUtils.defineLazyModuleGetter(this,
   "DebuggerServer", "resource://gre/modules/devtools/dbg-server.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this,
   "Services", "resource:///modules/Services.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this,
   "FileUtils", "resource:///modules/FileUtils.jsm");
 
-let EXPORTED_SYMBOLS = ["DebuggerUI"];
+this.EXPORTED_SYMBOLS = ["DebuggerUI"];
 
 /**
  * Provides a simple mechanism of managing debugger instances.
  *
  * @param nsIDOMWindow aWindow
  *        The chrome window for which the DebuggerUI instance is created.
  */
-function DebuggerUI(aWindow) {
+this.DebuggerUI = function DebuggerUI(aWindow) {
   this.chromeWindow = aWindow;
   this.listenToTabs();
-}
+};
 
 DebuggerUI.prototype = {
   /**
    * Update the status of tool's menuitems and buttons when
    * the user switches tabs.
    */
   listenToTabs: function DUI_listenToTabs() {
     let win = this.chromeWindow;
--- a/browser/devtools/highlighter/CmdInspect.jsm
+++ b/browser/devtools/highlighter/CmdInspect.jsm
@@ -1,14 +1,14 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 
 /**
  * 'inspect' command
  */
 gcli.addCommand({
   name: "inspect",
--- a/browser/devtools/highlighter/highlighter.jsm
+++ b/browser/devtools/highlighter/highlighter.jsm
@@ -7,17 +7,17 @@
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
-var EXPORTED_SYMBOLS = ["Highlighter"];
+this.EXPORTED_SYMBOLS = ["Highlighter"];
 
 const INSPECTOR_INVISIBLE_ELEMENTS = {
   "head": true,
   "base": true,
   "basefont": true,
   "isindex": true,
   "link": true,
   "meta": true,
@@ -108,17 +108,17 @@ const PSEUDO_CLASSES = [":hover", ":acti
  */
 
 
 /**
  * Constructor.
  *
  * @param object aWindow
  */
-function Highlighter(aWindow)
+this.Highlighter = function Highlighter(aWindow)
 {
   this.chromeWin = aWindow;
   this.tabbrowser = aWindow.gBrowser;
   this.chromeDoc = aWindow.document;
   this.browser = aWindow.gBrowser.selectedBrowser;
   this.events = {};
 
   this._init();
--- a/browser/devtools/highlighter/inspector.jsm
+++ b/browser/devtools/highlighter/inspector.jsm
@@ -4,17 +4,17 @@
  * 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/. */
 
 const Cc = Components.classes;
 const Cu = Components.utils;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 
-var EXPORTED_SYMBOLS = ["InspectorUI"];
+this.EXPORTED_SYMBOLS = ["InspectorUI"];
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource:///modules/devtools/MarkupView.jsm");
 Cu.import("resource:///modules/highlighter.jsm");
 Cu.import("resource:///modules/devtools/LayoutView.jsm");
 Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
 Cu.import("resource:///modules/devtools/EventEmitter.jsm");
@@ -406,17 +406,17 @@ Inspector.prototype = {
 
 /**
  * Main controller class for the Inspector.
  *
  * @constructor
  * @param nsIDOMWindow aWindow
  *        The chrome window for which the Inspector instance is created.
  */
-function InspectorUI(aWindow)
+this.InspectorUI = function InspectorUI(aWindow)
 {
   // Let style inspector tools register themselves.
   let tmp = {};
   Cu.import("resource:///modules/devtools/StyleInspector.jsm", tmp);
 
   this.chromeWin = aWindow;
   this.chromeDoc = aWindow.document;
   this.tabbrowser = aWindow.gBrowser;
--- a/browser/devtools/highlighter/test/helpers.js
+++ b/browser/devtools/highlighter/test/helpers.js
@@ -49,17 +49,17 @@
  *   helpers.setup(options);
  *   dump(helpers._createDebugCheck() + '\n\n');
  * };
  *
  * Now GCLI will emit output on every keypress that both explains the state
  * of GCLI and can be run as a test case.
  */
 
-var EXPORTED_SYMBOLS = [ 'helpers' ];
+this.EXPORTED_SYMBOLS = [ 'helpers' ];
 
 var test = { };
 
 /**
  * Various functions for testing DeveloperToolbar.
  * Parts of this code exist in:
  * - browser/devtools/commandline/test/head.js
  * - browser/devtools/shared/test/head.js
@@ -491,17 +491,17 @@ DeveloperToolbarTest.checkNotCalled = fu
 DeveloperToolbarTest.closeAllTabs = function() {
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 
-var helpers = {};
+this.helpers = {};
 
 helpers._display = undefined;
 
 helpers.setup = function(options) {
   helpers._display = options.display;
   if (typeof ok !== 'undefined') {
     test.ok = ok;
     test.is = is;
--- a/browser/devtools/layoutview/LayoutView.jsm
+++ b/browser/devtools/layoutview/LayoutView.jsm
@@ -7,19 +7,19 @@
 "use strict";
 
 const Cu = Components.utils;
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource:///modules/inspector.jsm");
 Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
 Cu.import("resource:///modules/devtools/CssLogic.jsm");
 
-var EXPORTED_SYMBOLS = ["LayoutView"];
+this.EXPORTED_SYMBOLS = ["LayoutView"];
 
-function LayoutView(aOptions)
+this.LayoutView = function LayoutView(aOptions)
 {
   this.chromeDoc = aOptions.document;
   this.inspector = aOptions.inspector;
   this.browser = this.inspector.chromeWindow.gBrowser;
 
   this.init();
 }
 
--- a/browser/devtools/markupview/MarkupView.jsm
+++ b/browser/devtools/markupview/MarkupView.jsm
@@ -8,17 +8,17 @@ const Cc = Components.classes;
 const Cu = Components.utils;
 const Ci = Components.interfaces;
 
 // Page size for pageup/pagedown
 const PAGE_SIZE = 10;
 
 const PREVIEW_AREA = 700;
 
-var EXPORTED_SYMBOLS = ["MarkupView"];
+this.EXPORTED_SYMBOLS = ["MarkupView"];
 
 Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
 Cu.import("resource:///modules/devtools/CssRuleView.jsm");
 Cu.import("resource:///modules/devtools/Templater.jsm");
 Cu.import("resource:///modules/devtools/Undo.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 /**
@@ -34,17 +34,17 @@ Cu.import("resource://gre/modules/Servic
  * The markup tree.  Manages the mapping of nodes to MarkupContainers,
  * updating based on mutations, and the undo/redo bindings.
  *
  * @param Inspector aInspector
  *        The inspector we're watching.
  * @param iframe aFrame
  *        An iframe in which the caller has kindly loaded markup-view.xhtml.
  */
-function MarkupView(aInspector, aFrame)
+this.MarkupView = function MarkupView(aInspector, aFrame)
 {
   this._inspector = aInspector;
   this._frame = aFrame;
   this.doc = this._frame.contentDocument;
   this._elt = this.doc.querySelector("#root");
 
   this.undo = new UndoStack();
   this.undo.installController(this._frame.ownerDocument.defaultView);
--- a/browser/devtools/responsivedesign/CmdResize.jsm
+++ b/browser/devtools/responsivedesign/CmdResize.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource:///modules/devtools/gcli.jsm");
 
 /* Responsive Mode commands */
 gcli.addCommand({
   name: 'resize',
   description: gcli.lookup('resizeModeDesc')
 });
--- a/browser/devtools/responsivedesign/responsivedesign.jsm
+++ b/browser/devtools/responsivedesign/responsivedesign.jsm
@@ -7,25 +7,25 @@
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource:///modules/devtools/FloatingScrollbars.jsm");
 Cu.import("resource:///modules/devtools/EventEmitter.jsm");
 
-var EXPORTED_SYMBOLS = ["ResponsiveUIManager"];
+this.EXPORTED_SYMBOLS = ["ResponsiveUIManager"];
 
 const MIN_WIDTH = 50;
 const MIN_HEIGHT = 50;
 
 const MAX_WIDTH = 10000;
 const MAX_HEIGHT = 10000;
 
-let ResponsiveUIManager = {
+this.ResponsiveUIManager = {
   /**
    * Check if the a tab is in a responsive mode.
    * Leave the responsive mode if active,
    * active the responsive mode if not active.
    *
    * @param aWindow the main window.
    * @param aTab the tab targeted.
    */
--- a/browser/devtools/responsivedesign/test/helpers.js
+++ b/browser/devtools/responsivedesign/test/helpers.js
@@ -49,17 +49,17 @@
  *   helpers.setup(options);
  *   dump(helpers._createDebugCheck() + '\n\n');
  * };
  *
  * Now GCLI will emit output on every keypress that both explains the state
  * of GCLI and can be run as a test case.
  */
 
-var EXPORTED_SYMBOLS = [ 'helpers' ];
+this.EXPORTED_SYMBOLS = [ 'helpers' ];
 
 var test = { };
 
 /**
  * Various functions for testing DeveloperToolbar.
  * Parts of this code exist in:
  * - browser/devtools/commandline/test/head.js
  * - browser/devtools/shared/test/head.js
@@ -491,17 +491,17 @@ DeveloperToolbarTest.checkNotCalled = fu
 DeveloperToolbarTest.closeAllTabs = function() {
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 
-var helpers = {};
+this.helpers = {};
 
 helpers._display = undefined;
 
 helpers.setup = function(options) {
   helpers._display = options.display;
   if (typeof ok !== 'undefined') {
     test.ok = ok;
     test.is = is;
--- a/browser/devtools/scratchpad/scratchpad-manager.jsm
+++ b/browser/devtools/scratchpad/scratchpad-manager.jsm
@@ -1,32 +1,32 @@
 /* vim:set ts=2 sw=2 sts=2 et tw=80:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-var EXPORTED_SYMBOLS = ["ScratchpadManager"];
+this.EXPORTED_SYMBOLS = ["ScratchpadManager"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 const SCRATCHPAD_WINDOW_URL = "chrome://browser/content/scratchpad.xul";
 const SCRATCHPAD_WINDOW_FEATURES = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 /**
  * The ScratchpadManager object opens new Scratchpad windows and manages the state
  * of open scratchpads for session restore. There's only one ScratchpadManager in
  * the life of the browser.
  */
-var ScratchpadManager = {
+this.ScratchpadManager = {
 
   _nextUid: 1,
   _scratchpads: [],
 
   /**
    * Get the saved states of open scratchpad windows. Called by
    * session restore.
    *
--- a/browser/devtools/shared/Browser.jsm
+++ b/browser/devtools/shared/Browser.jsm
@@ -6,24 +6,24 @@
 
 /**
  * Define various constants to match the globals provided by the browser.
  * This module helps cases where code is shared between the web and Firefox.
  * See also Console.jsm for an implementation of the Firefox console that
  * forwards to dump();
  */
 
-const EXPORTED_SYMBOLS = [ "Node", "HTMLElement", "setTimeout", "clearTimeout" ];
+this.EXPORTED_SYMBOLS = [ "Node", "HTMLElement", "setTimeout", "clearTimeout" ];
 
 /**
  * Expose Node/HTMLElement objects. This allows us to use the Node constants
  * without resorting to hardcoded numbers
  */
-const Node = Components.interfaces.nsIDOMNode;
-const HTMLElement = Components.interfaces.nsIDOMHTMLElement;
+this.Node = Components.interfaces.nsIDOMNode;
+this.HTMLElement = Components.interfaces.nsIDOMHTMLElement;
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 /**
  * The next value to be returned by setTimeout
  */
 let nextID = 1;
 
@@ -61,32 +61,32 @@ TimerCallback.prototype.notify = functio
  * This is designed to have the same interface contract as the browser
  * function.
  * @param callback is the function you want to execute after the delay.
  * @param delay is the number of milliseconds that the function call should
  * be delayed by. Note that the actual delay may be longer, see Notes below.
  * @return the ID of the timeout, which can be used later with
  * window.clearTimeout.
  */
-const setTimeout = function setTimeout(callback, delay) {
+this.setTimeout = function setTimeout(callback, delay) {
   const timer = Components.classes["@mozilla.org/timer;1"]
                         .createInstance(Components.interfaces.nsITimer);
 
   let timerID = nextID++;
   timers[timerID] = timer;
 
   timer.initWithCallback(new TimerCallback(callback), delay, timer.TYPE_ONE_SHOT);
   return timerID;
 };
 
 /**
  * Clears the delay set by window.setTimeout() and prevents the callback from
  * being executed (if it hasn't been executed already)
  * @param timerID the ID of the timeout you wish to clear, as returned by
  * window.setTimeout().
  */
-const clearTimeout = function clearTimeout(timerID) {
+this.clearTimeout = function clearTimeout(timerID) {
   let timer = timers[timerID];
   if (timer) {
     timer.cancel();
     delete timers[timerID];
   }
 };
--- a/browser/devtools/shared/DOMHelpers.jsm
+++ b/browser/devtools/shared/DOMHelpers.jsm
@@ -1,23 +1,23 @@
 /* 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/. */
 
-const EXPORTED_SYMBOLS = ["DOMHelpers"];
+this.EXPORTED_SYMBOLS = ["DOMHelpers"];
 
 /**
  * DOMHelpers
  * Makes DOM traversal easier. Goes through iframes.
  *
  * @constructor
  * @param nsIDOMWindow aWindow
  *        The content window, owning the document to traverse.
  */
-function DOMHelpers(aWindow) {
+this.DOMHelpers = function DOMHelpers(aWindow) {
   this.window = aWindow;
 };
 
 DOMHelpers.prototype = {
   getParentObject: function Helpers_getParentObject(node)
   {
     let parentNode = node ? node.parentNode : null;
 
--- a/browser/devtools/shared/DeveloperToolbar.jsm
+++ b/browser/devtools/shared/DeveloperToolbar.jsm
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = [ "DeveloperToolbar" ];
+this.EXPORTED_SYMBOLS = [ "DeveloperToolbar" ];
 
 const NS_XHTML = "http://www.w3.org/1999/xhtml";
 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource:///modules/devtools/Commands.jsm");
 
@@ -41,17 +41,17 @@ XPCOMUtils.defineLazyGetter(this, "isLin
 });
 
 /**
  * A component to manage the global developer toolbar, which contains a GCLI
  * and buttons for various developer tools.
  * @param aChromeWindow The browser window to which this toolbar is attached
  * @param aToolbarElement See browser.xul:<toolbar id="developer-toolbar">
  */
-function DeveloperToolbar(aChromeWindow, aToolbarElement)
+this.DeveloperToolbar = function DeveloperToolbar(aChromeWindow, aToolbarElement)
 {
   this._chromeWindow = aChromeWindow;
 
   this._element = aToolbarElement;
   this._element.hidden = true;
   this._doc = this._element.ownerDocument;
 
   this._lastState = NOTIFICATIONS.HIDE;
--- a/browser/devtools/shared/EventEmitter.jsm
+++ b/browser/devtools/shared/EventEmitter.jsm
@@ -1,11 +1,13 @@
-var EXPORTED_SYMBOLS = ["EventEmitter"];
+// XXXkhuey this should have a license header.
 
-function EventEmitter() {
+this.EXPORTED_SYMBOLS = ["EventEmitter"];
+
+this.EventEmitter = function EventEmitter() {
 }
 
 EventEmitter.prototype = {
   /**
    * Connect a listener.
    *
    * @param string aEvent
    *        The event name to which we're connecting.
--- a/browser/devtools/shared/FloatingScrollbars.jsm
+++ b/browser/devtools/shared/FloatingScrollbars.jsm
@@ -1,45 +1,45 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-const EXPORTED_SYMBOLS = [ "switchToFloatingScrollbars", "switchToNativeScrollbars" ];
+this.EXPORTED_SYMBOLS = [ "switchToFloatingScrollbars", "switchToNativeScrollbars" ];
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 let URL = Services.io.newURI("chrome://browser/skin/devtools/floating-scrollbars.css", null, null);
 
 let trackedTabs = new WeakMap();
 
 /**
  * Switch to floating scrollbars, à la mobile.
  *
  * @param aTab the targeted tab.
  *
  */
-function switchToFloatingScrollbars(aTab) {
+this.switchToFloatingScrollbars = function switchToFloatingScrollbars(aTab) {
   let mgr = trackedTabs.get(aTab);
   if (!mgr) {
     mgr = new ScrollbarManager(aTab);
   }
   mgr.switchToFloating();
 }
 
 /**
  * Switch to original native scrollbars.
  *
  * @param aTab the targeted tab.
  *
  */
-function switchToNativeScrollbars(aTab) {
+this.switchToNativeScrollbars = function switchToNativeScrollbars(aTab) {
   let mgr = trackedTabs.get(aTab);
   if (mgr) {
     mgr.reset();
   }
 }
 
 function ScrollbarManager(aTab) {
   trackedTabs.set(aTab, this);
--- a/browser/devtools/shared/Jsbeautify.jsm
+++ b/browser/devtools/shared/Jsbeautify.jsm
@@ -51,19 +51,19 @@
     js_beautify(js_source_text, {
       'indent_size': 1,
       'indent_char': '\t'
     });
 
 
 */
 
-let EXPORTED_SYMBOLS = ["js_beautify"];
+this.EXPORTED_SYMBOLS = ["js_beautify"];
 
-function js_beautify(js_source_text, options) {
+this.js_beautify = function js_beautify(js_source_text, options) {
 
     var input, output, token_text, last_type, last_text, last_last_text, last_word, flags, flag_store, indent_string;
     var whitespace, wordchar, punct, parser_pos, line_starters, digits;
     var prefix, token_type, do_block_just_closed;
     var wanted_newline, just_added_newline, n_newlines;
     var preindent_string = '';
 
 
--- a/browser/devtools/shared/LayoutHelpers.jsm
+++ b/browser/devtools/shared/LayoutHelpers.jsm
@@ -13,19 +13,19 @@ Cu.import("resource://gre/modules/XPCOMU
 XPCOMUtils.defineLazyModuleGetter(this, "Services",
   "resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "PlatformKeys", function() {
   return Services.strings.createBundle(
     "chrome://global-platform/locale/platformKeys.properties");
 });
 
-var EXPORTED_SYMBOLS = ["LayoutHelpers"];
+this.EXPORTED_SYMBOLS = ["LayoutHelpers"];
 
-LayoutHelpers = {
+this.LayoutHelpers = LayoutHelpers = {
 
   /**
    * Compute the position and the dimensions for the visible portion
    * of a node, relativalely to the root window.
    *
    * @param nsIDOMNode aNode
    *        a DOM element to be highlighted
    */
--- a/browser/devtools/shared/SplitView.jsm
+++ b/browser/devtools/shared/SplitView.jsm
@@ -1,16 +1,16 @@
 /* vim:set ts=2 sw=2 sts=2 et: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = ["SplitView"];
+this.EXPORTED_SYMBOLS = ["SplitView"];
 
 /* this must be kept in sync with CSS (ie. splitview.css) */
 const LANDSCAPE_MEDIA_QUERY = "(min-width: 551px)";
 
 const BINDING_USERDATA = "splitview-binding";
 
 
 /**
@@ -21,17 +21,17 @@ const BINDING_USERDATA = "splitview-bind
  * A split view contains items, each of those having one summary and one details
  * elements.
  * It is adaptive as it behaves similarly to a richlistbox when there the aspect
  * ratio is narrow or as a pair listbox-box otherwise.
  *
  * @param DOMElement aRoot
  * @see appendItem
  */
-function SplitView(aRoot)
+this.SplitView = function SplitView(aRoot)
 {
   this._root = aRoot;
   this._controller = aRoot.querySelector(".splitview-controller");
   this._nav = aRoot.querySelector(".splitview-nav");
   this._side = aRoot.querySelector(".splitview-side-details");
   this._activeSummary = null
 
   this._mql = aRoot.ownerDocument.defaultView.matchMedia(LANDSCAPE_MEDIA_QUERY);
--- a/browser/devtools/shared/Templater.jsm
+++ b/browser/devtools/shared/Templater.jsm
@@ -10,17 +10,17 @@
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 
-var EXPORTED_SYMBOLS = [ "Templater", "template" ];
+this.EXPORTED_SYMBOLS = [ "Templater", "template" ];
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 const Node = Components.interfaces.nsIDOMNode;
 
 /**
  * For full documentation, see:
  * https://github.com/mozilla/domtemplate/blob/master/README.md
  */
@@ -39,27 +39,27 @@ const Node = Components.interfaces.nsIDO
  *   engine maintains a stack of tasks to help debug where it is. This allows
  *   this stack to be prefixed with a template name
  * - blankNullUndefined: By default DOMTemplate exports null and undefined
  *   values using the strings 'null' and 'undefined', which can be helpful for
  *   debugging, but can introduce unnecessary extra logic in a template to
  *   convert null/undefined to ''. By setting blankNullUndefined:true, this
  *   conversion is handled by DOMTemplate
  */
-function template(node, data, options) {
+this.template = function template(node, data, options) {
   var template = new Templater(options || {});
   template.processNode(node, data);
   return template;
 }
 
 /**
  * Construct a Templater object. Use template() in preference to this ctor.
  * @deprecated Use template(node, data, options);
  */
-function Templater(options) {
+this.Templater = function Templater(options) {
   if (options == null) {
     options = { allowEval: true };
   }
   this.options = options;
   if (options.stack && Array.isArray(options.stack)) {
     this.stack = options.stack;
   }
   else if (typeof options.stack === 'string') {
--- a/browser/devtools/shared/Undo.jsm
+++ b/browser/devtools/shared/Undo.jsm
@@ -1,30 +1,30 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* 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/. */
 const Cu = Components.utils;
 
-var EXPORTED_SYMBOLS=["UndoStack"];
+this.EXPORTED_SYMBOLS = ["UndoStack"];
 
 /**
  * A simple undo stack manager.
  *
  * Actions are added along with the necessary code to
  * reverse the action.
  *
  * @param function aChange Called whenever the size or position
  *   of the undo stack changes, to use for updating undo-related
  *   UI.
  * @param integer aMaxUndo Maximum number of undo steps.
  *   defaults to 50.
  */
-function UndoStack(aMaxUndo)
+this.UndoStack = function UndoStack(aMaxUndo)
 {
   this.maxUndo = aMaxUndo || 50;
   this._stack = [];
 }
 
 UndoStack.prototype = {
   // Current index into the undo stack.  Is positioned after the last
   // currently-applied change.
--- a/browser/devtools/shared/test/helpers.js
+++ b/browser/devtools/shared/test/helpers.js
@@ -49,17 +49,17 @@
  *   helpers.setup(options);
  *   dump(helpers._createDebugCheck() + '\n\n');
  * };
  *
  * Now GCLI will emit output on every keypress that both explains the state
  * of GCLI and can be run as a test case.
  */
 
-var EXPORTED_SYMBOLS = [ 'helpers' ];
+this.EXPORTED_SYMBOLS = [ 'helpers' ];
 
 var test = { };
 
 /**
  * Various functions for testing DeveloperToolbar.
  * Parts of this code exist in:
  * - browser/devtools/commandline/test/head.js
  * - browser/devtools/shared/test/head.js
@@ -491,17 +491,17 @@ DeveloperToolbarTest.checkNotCalled = fu
 DeveloperToolbarTest.closeAllTabs = function() {
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 
-var helpers = {};
+this.helpers = {};
 
 helpers._display = undefined;
 
 helpers.setup = function(options) {
   helpers._display = options.display;
   if (typeof ok !== 'undefined') {
     test.ok = ok;
     test.is = is;
--- a/browser/devtools/sourceeditor/source-editor-orion.jsm
+++ b/browser/devtools/sourceeditor/source-editor-orion.jsm
@@ -135,28 +135,28 @@ if (Services.appinfo.OS == "WINNT" ||
     Services.appinfo.OS == "Linux") {
   DEFAULT_KEYBINDINGS.push({
     action: "redo",
     code: Ci.nsIDOMKeyEvent.DOM_VK_Y,
     accel: true,
   });
 }
 
-var EXPORTED_SYMBOLS = ["SourceEditor"];
+this.EXPORTED_SYMBOLS = ["SourceEditor"];
 
 /**
  * The SourceEditor object constructor. The SourceEditor component allows you to
  * provide users with an editor tailored to the specific needs of editing source
  * code, aimed primarily at web developers.
  *
  * The editor used here is Eclipse Orion (see http://www.eclipse.org/orion).
  *
  * @constructor
  */
-function SourceEditor() {
+this.SourceEditor = function SourceEditor() {
   // Update the SourceEditor defaults from user preferences.
 
   SourceEditor.DEFAULTS.tabSize =
     Services.prefs.getIntPref(SourceEditor.PREFS.TAB_SIZE);
   SourceEditor.DEFAULTS.expandTab =
     Services.prefs.getBoolPref(SourceEditor.PREFS.EXPAND_TAB);
 
   this._onOrionSelection = this._onOrionSelection.bind(this);
--- a/browser/devtools/sourceeditor/source-editor-ui.jsm
+++ b/browser/devtools/sourceeditor/source-editor-ui.jsm
@@ -4,22 +4,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
-var EXPORTED_SYMBOLS = ["SourceEditorUI"];
+this.EXPORTED_SYMBOLS = ["SourceEditorUI"];
 
 /**
  * The Source Editor component user interface.
  */
-function SourceEditorUI(aEditor)
+this.SourceEditorUI = function SourceEditorUI(aEditor)
 {
   this.editor = aEditor;
   this._onDirtyChanged = this._onDirtyChanged.bind(this);
 }
 
 SourceEditorUI.prototype = {
   /**
    * Initialize the user interface. This is called by the SourceEditor.init()
--- a/browser/devtools/sourceeditor/source-editor.jsm
+++ b/browser/devtools/sourceeditor/source-editor.jsm
@@ -29,18 +29,18 @@ try {
   Services.prefs.clearUserPref(PREF_EDITOR_COMPONENT);
 
   // Load the default editor component.
   component = Services.prefs.getCharPref(PREF_EDITOR_COMPONENT);
   Cu.import("resource:///modules/source-editor-" + component + ".jsm", obj);
 }
 
 // Export the SourceEditor.
-var SourceEditor = obj.SourceEditor;
-var EXPORTED_SYMBOLS = ["SourceEditor"];
+this.SourceEditor = obj.SourceEditor;
+this.EXPORTED_SYMBOLS = ["SourceEditor"];
 
 // Add the constants used by all SourceEditors.
 
 XPCOMUtils.defineLazyGetter(SourceEditorUI, "strings", function() {
   return Services.strings.createBundle(SOURCEEDITOR_L10N);
 });
 
 /**
--- a/browser/devtools/styleeditor/CmdEdit.jsm
+++ b/browser/devtools/styleeditor/CmdEdit.jsm
@@ -1,15 +1,15 @@
 /* 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/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource:///modules/devtools/gcli.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "HUDService",
                                   "resource:///modules/HUDService.jsm");
 
 /**
--- a/browser/devtools/styleeditor/StyleEditor.jsm
+++ b/browser/devtools/styleeditor/StyleEditor.jsm
@@ -1,16 +1,16 @@
 /* vim:set ts=2 sw=2 sts=2 et: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = ["StyleEditor", "StyleEditorFlags", "StyleEditorManager"];
+this.EXPORTED_SYMBOLS = ["StyleEditor", "StyleEditorFlags", "StyleEditorManager"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 const DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"]
                    .getService(Ci.inIDOMUtils);
 
@@ -60,17 +60,17 @@ const TRANSITIONS_ENABLED = Services.pre
  * @param DOMDocument aDocument
  *        The content document where changes will be applied to.
  * @param DOMStyleSheet aStyleSheet
  *        Optional. The DOMStyleSheet to edit.
  *        If not set, a new empty style sheet will be appended to the document.
  * @see inputElement
  * @see StyleEditorChrome
  */
-function StyleEditor(aDocument, aStyleSheet)
+this.StyleEditor = function StyleEditor(aDocument, aStyleSheet)
 {
   assert(aDocument, "Argument 'aDocument' is required.");
 
   this._document = aDocument; // @see contentDocument
   this._inputElement = null;  // @see inputElement
   this._sourceEditor = null;  // @see sourceEditor
 
   this._state = {             // state to handle inputElement attach/detach
@@ -1138,17 +1138,17 @@ StyleEditor.prototype = {
 };
 
 /**
  * List of StyleEditor UI flags.
  * A Style Editor add-on using its own flag needs to add it to this object.
  *
  * @see StyleEditor.setFlag
  */
-let StyleEditorFlags = {
+this.StyleEditorFlags = {
   DISABLED:      "disabled",
   ERROR:         "error",
   IMPORTED:      "imported",
   INLINE:        "inline",
   MODIFIED:      "modified",
   NEW:           "new",
   UNSAVED:       "unsaved"
 };
@@ -1277,17 +1277,17 @@ function setupBracketCompletion(aSourceE
     aSourceEditor.setCaretOffset(aSourceEditor.getCaretOffset() - 1);
   }, false);
 }
 
 /**
   * Manage the different editors instances.
   */
 
-function StyleEditorManager(aWindow) {
+this.StyleEditorManager = function StyleEditorManager(aWindow) {
   this.chromeWindow = aWindow;
   this.listenToTabs();
   this.editors = new WeakMap();
 }
 
 StyleEditorManager.prototype = {
 
   /**
--- a/browser/devtools/styleeditor/StyleEditorChrome.jsm
+++ b/browser/devtools/styleeditor/StyleEditorChrome.jsm
@@ -1,16 +1,16 @@
 /* vim:set ts=2 sw=2 sts=2 et: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = ["StyleEditorChrome"];
+this.EXPORTED_SYMBOLS = ["StyleEditorChrome"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/PluralForm.jsm");
 Cu.import("resource:///modules/devtools/StyleEditor.jsm");
@@ -27,17 +27,17 @@ const STYLE_EDITOR_TEMPLATE = "styleshee
  * Manages the sheet selector, history, and opened editor(s) for the attached
  * content window.
  *
  * @param DOMElement aRoot
  *        Element that owns the chrome UI.
  * @param DOMWindow aContentWindow
  *        Content DOMWindow to attach to this chrome.
  */
-function StyleEditorChrome(aRoot, aContentWindow)
+this.StyleEditorChrome = function StyleEditorChrome(aRoot, aContentWindow)
 {
   assert(aRoot, "Argument 'aRoot' is required to initialize StyleEditorChrome.");
 
   this._root = aRoot;
   this._document = this._root.ownerDocument;
   this._window = this._document.defaultView;
 
   this._editors = [];
--- a/browser/devtools/styleeditor/StyleEditorUtil.jsm
+++ b/browser/devtools/styleeditor/StyleEditorUtil.jsm
@@ -1,20 +1,20 @@
 /* vim:set ts=2 sw=2 sts=2 et: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = [
+this.EXPORTED_SYMBOLS = [
   "_",
   "assert",
-  "attr",
-  "getCurrentBrowserTabContentWindow",
+  "attr", // XXXkhuey unused?
+  "getCurrentBrowserTabContentWindow", // XXXkhuey unused?
   "log",
   "text",
   "wire"
 ];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
@@ -30,17 +30,17 @@ const gStringBundle = Services.strings.c
 /**
  * Returns a localized string with the given key name from the string bundle.
  *
  * @param aName
  * @param ...rest
  *        Optional arguments to format in the string.
  * @return string
  */
-function _(aName)
+this._ = function _(aName)
 {
 
   if (arguments.length == 1) {
     return gStringBundle.GetStringFromName(aName);
   }
   let rest = Array.prototype.slice.call(arguments, 1);
   return gStringBundle.formatStringFromName(aName, rest, rest.length);
 }
@@ -48,17 +48,17 @@ function _(aName)
 /**
  * Assert an expression is true or throw if false.
  *
  * @param aExpression
  * @param aMessage
  *        Optional message.
  * @return aExpression
  */
-function assert(aExpression, aMessage)
+this.assert = function assert(aExpression, aMessage)
 {
   if (!!!(aExpression)) {
     let msg = aMessage ? "ASSERTION FAILURE:" + aMessage : "ASSERTION FAILURE";
     log(msg);
     throw new Error(msg);
   }
   return aExpression;
 }
@@ -71,17 +71,17 @@ function assert(aExpression, aMessage)
  * @param string aSelector
  *        Selector string for the element to get/set the text content.
  * @param string aText
  *        Optional text to set.
  * @return string
  *         Text content of matching element or null if there were no element
  *         matching aSelector.
  */
-function text(aRoot, aSelector, aText)
+this.text = function text(aRoot, aSelector, aText)
 {
   let element = aRoot.querySelector(aSelector);
   if (!element) {
     return null;
   }
 
   if (aText === undefined) {
     return element.textContent;
@@ -108,17 +108,17 @@ function forEach(aObject, aCallback)
 
 /**
  * Log a message to the console.
  * 
  * @param ...rest
  *        One or multiple arguments to log.
  *        If multiple arguments are given, they will be joined by " " in the log.
  */
-function log()
+this.log = function log()
 {
   console.logStringMessage(Array.prototype.slice.call(arguments).join(" "));
 }
 
 /**
  * Wire up element(s) matching selector with attributes, event listeners, etc.
  *
  * @param DOMElement aRoot
@@ -131,17 +131,17 @@ function log()
  *        are "events", "attributes" and "userData" taking objects themselves.
  *        Each key of properties above represents the name of the event, attribute
  *        or userData, with the value being a function used as an event handler,
  *        string to use as attribute value, or object to use as named userData
  *        respectively.
  *        If aDescriptor is a function, the argument is equivalent to :
  *        {events: {'click': aDescriptor}}
  */
-function wire(aRoot, aSelectorOrElement, aDescriptor)
+this.wire = function wire(aRoot, aSelectorOrElement, aDescriptor)
 {
   let matches;
   if (typeof(aSelectorOrElement) == "string") { // selector
     matches = aRoot.querySelectorAll(aSelectorOrElement);
     if (!matches.length) {
       return;
     }
   } else {
--- a/browser/devtools/styleeditor/test/helpers.js
+++ b/browser/devtools/styleeditor/test/helpers.js
@@ -49,17 +49,17 @@
  *   helpers.setup(options);
  *   dump(helpers._createDebugCheck() + '\n\n');
  * };
  *
  * Now GCLI will emit output on every keypress that both explains the state
  * of GCLI and can be run as a test case.
  */
 
-var EXPORTED_SYMBOLS = [ 'helpers' ];
+this.EXPORTED_SYMBOLS = [ 'helpers' ];
 
 var test = { };
 
 /**
  * Various functions for testing DeveloperToolbar.
  * Parts of this code exist in:
  * - browser/devtools/commandline/test/head.js
  * - browser/devtools/shared/test/head.js
@@ -491,17 +491,17 @@ DeveloperToolbarTest.checkNotCalled = fu
 DeveloperToolbarTest.closeAllTabs = function() {
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 
-var helpers = {};
+this.helpers = {};
 
 helpers._display = undefined;
 
 helpers.setup = function(options) {
   helpers._display = options.display;
   if (typeof ok !== 'undefined') {
     test.ok = ok;
     test.is = is;
--- a/browser/devtools/styleinspector/CssHtmlTree.jsm
+++ b/browser/devtools/styleinspector/CssHtmlTree.jsm
@@ -13,17 +13,17 @@ const HTML_NS = "http://www.w3.org/1999/
 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/PluralForm.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource:///modules/devtools/CssLogic.jsm");
 Cu.import("resource:///modules/devtools/Templater.jsm");
 
-var EXPORTED_SYMBOLS = ["CssHtmlTree", "PropertyView"];
+this.EXPORTED_SYMBOLS = ["CssHtmlTree", "PropertyView"];
 
 /**
  * Helper for long-running processes that should yield occasionally to
  * the mainloop.
  *
  * @param {Window} aWin
  *        Timeouts will be set on this window when appropriate.
  * @param {Generator} aGenerator
@@ -111,17 +111,17 @@ UpdateProcess.prototype = {
 /**
  * CssHtmlTree is a panel that manages the display of a table sorted by style.
  * There should be one instance of CssHtmlTree per style display (of which there
  * will generally only be one).
  *
  * @params {StyleInspector} aStyleInspector The owner of this CssHtmlTree
  * @constructor
  */
-function CssHtmlTree(aStyleInspector)
+this.CssHtmlTree = function CssHtmlTree(aStyleInspector)
 {
   this.styleWin = aStyleInspector.iframe;
   this.styleInspector = aStyleInspector;
   this.cssLogic = aStyleInspector.cssLogic;
   this.doc = aStyleInspector.document;
   this.win = aStyleInspector.window;
   this.getRTLAttr = this.win.getComputedStyle(this.win.gBrowser).direction;
   this.propertyViews = [];
@@ -714,17 +714,17 @@ CssHtmlTree.prototype = {
 /**
  * A container to give easy access to property data from the template engine.
  *
  * @constructor
  * @param {CssHtmlTree} aTree the CssHtmlTree instance we are working with.
  * @param {string} aName the CSS property name for which this PropertyView
  * instance will render the rules.
  */
-function PropertyView(aTree, aName)
+this.PropertyView = function PropertyView(aTree, aName)
 {
   this.tree = aTree;
   this.name = aName;
   this.getRTLAttr = aTree.getRTLAttr;
 
   this.link = "https://developer.mozilla.org/en/CSS/" + aName;
 
   this.templateMatchedSelectors = aTree.styleDocument.getElementById("templateMatchedSelectors");
--- a/browser/devtools/styleinspector/CssLogic.jsm
+++ b/browser/devtools/styleinspector/CssLogic.jsm
@@ -48,19 +48,19 @@ const RX_PSEUDO_CLASS_OR_ELT = /(:[\w-]+
 const RX_CONNECTORS = /\s*[\s>+~]\s*/g;
 const RX_ID = /\s*#\w+\s*/g;
 const RX_CLASS_OR_ATTRIBUTE = /\s*(?:\.\w+|\[.+?\])\s*/g;
 const RX_PSEUDO = /\s*:?:([\w-]+)(\(?\)?)\s*/g;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
-var EXPORTED_SYMBOLS = ["CssLogic", "CssSelector"];
+this.EXPORTED_SYMBOLS = ["CssLogic", "CssSelector"];
 
-function CssLogic()
+this.CssLogic = function CssLogic()
 {
   // The cache of examined CSS properties.
   _propertyInfos: {};
 }
 
 /**
  * Special values for filter, in addition to an href these values can be used
  */
@@ -1345,17 +1345,17 @@ CssRule.prototype = {
 /**
  * The CSS selector class allows us to document the ranking of various CSS
  * selectors.
  *
  * @constructor
  * @param {CssRule} aCssRule the CssRule instance from where the selector comes.
  * @param {string} aSelector The selector that we wish to investigate.
  */
-function CssSelector(aCssRule, aSelector)
+this.CssSelector = function CssSelector(aCssRule, aSelector)
 {
   this._cssRule = aCssRule;
   this.text = aSelector;
   this.elementStyle = this.text == "@element.style";
   this._specificity = null;
 }
 
 CssSelector.prototype = {
--- a/browser/devtools/styleinspector/CssRuleView.jsm
+++ b/browser/devtools/styleinspector/CssRuleView.jsm
@@ -26,21 +26,21 @@ const CSS_LINE_RE = /(?:[^;\(]*(?:\([^\)
 
 // Used to parse a single property line.
 const CSS_PROP_RE = /\s*([^:\s]*)\s*:\s*(.*?)\s*(?:! (important))?;?$/;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource:///modules/devtools/CssLogic.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
-var EXPORTED_SYMBOLS = ["CssRuleView",
-                        "_ElementStyle",
-                        "editableItem",
-                        "_editableField",
-                        "_getInplaceEditorForSpan"];
+this.EXPORTED_SYMBOLS = ["CssRuleView",
+                         "_ElementStyle",
+                         "editableItem",
+                         "_editableField",
+                         "_getInplaceEditorForSpan"];
 
 /**
  * Our model looks like this:
  *
  * ElementStyle:
  *   Responsible for keeping track of which properties are overridden.
  *   Maintains a list of Rule objects that apply to the element.
  * Rule:
@@ -92,17 +92,17 @@ function ElementStyle(aElement, aStore)
   // To figure out how shorthand properties are interpreted by the
   // engine, we will set properties on a dummy element and observe
   // how their .style attribute reflects them as computed values.
   this.dummyElement = doc.createElementNS(this.element.namespaceURI,
                                           this.element.tagName);
   this.populate();
 }
 // We're exporting _ElementStyle for unit tests.
-var _ElementStyle = ElementStyle;
+this._ElementStyle = ElementStyle;
 
 ElementStyle.prototype = {
 
   // The element we're looking at.
   element: null,
 
   // Empty, unconnected element of the same type as this node, used
   // to figure out how shorthand properties will be parsed.
@@ -869,17 +869,17 @@ TextProperty.prototype = {
  * @param Document aDoc
  *        The document that will contain the rule view.
  * @param object aStore
  *        The CSS rule view can use this object to store metadata
  *        that might outlast the rule view, particularly the current
  *        set of disabled properties.
  * @constructor
  */
-function CssRuleView(aDoc, aStore)
+this.CssRuleView = function CssRuleView(aDoc, aStore)
 {
   this.doc = aDoc;
   this.store = aStore;
   this.element = this.doc.createElementNS(XUL_NS, "vbox");
   this.element.setAttribute("tabindex", "0");
   this.element.classList.add("ruleview");
   this.element.flex = 1;
 
@@ -1920,17 +1920,17 @@ function editableField(aOptions)
  * @param object aOptions
  *    The options for this editor, including:
  *    {Element} element: The DOM element.
  *    {string} trigger: The DOM event that should trigger editing,
  *      defaults to "click"
  * @param function aCallback
  *        Called when the editor is activated.
  */
-function editableItem(aOptions, aCallback)
+this.editableItem = function editableItem(aOptions, aCallback)
 {
   let trigger = aOptions.trigger || "click"
   let element = aOptions.element;
   element.addEventListener(trigger, function(evt) {
     let win = this.ownerDocument.defaultView;
     let selection = win.getSelection();
     if (trigger != "click" || selection.isCollapsed) {
       aCallback(element, evt);
@@ -1962,17 +1962,17 @@ function editableItem(aOptions, aCallbac
     element.addEventListener("mouseout", cleanup, false);
   }, false);
 
   // Mark the element editable field for tab
   // navigation while editing.
   element._editable = true;
 }
 
-var _editableField = editableField;
+this._editableField = editableField;
 
 function InplaceEditor(aOptions, aEvent)
 {
   this.elt = aOptions.element;
   let doc = this.elt.ownerDocument;
   this.doc = doc;
   this.elt.inplaceEditor = this;
 
@@ -2252,17 +2252,17 @@ InplaceEditor.prototype = {
 };
 
 /*
  * Various API consumers (especially tests) sometimes want to grab the
  * inplaceEditor expando off span elements. However, when each global has its
  * own compartment, those expandos live on Xray wrappers that are only visible
  * within this JSM. So we provide a little workaround here.
  */
-function _getInplaceEditorForSpan(aSpan) { return aSpan.inplaceEditor; };
+this._getInplaceEditorForSpan = function _getInplaceEditorForSpan(aSpan) { return aSpan.inplaceEditor; };
 
 /**
  * Store of CSSStyleDeclarations mapped to properties that have been changed by
  * the user.
  */
 function UserProperties()
 {
   // FIXME: This should be a WeakMap once bug 753517 is fixed.
--- a/browser/devtools/styleinspector/StyleInspector.jsm
+++ b/browser/devtools/styleinspector/StyleInspector.jsm
@@ -10,17 +10,17 @@ const Ci = Components.interfaces;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource:///modules/devtools/CssRuleView.jsm");
 Cu.import("resource:///modules/inspector.jsm");
 
 // This module doesn't currently export any symbols directly, it only
 // registers inspector tools.
-var EXPORTED_SYMBOLS = [];
+this.EXPORTED_SYMBOLS = [];
 
 /**
  * Lookup l10n string from a string bundle.
  * @param {string} aName The key to lookup.
  * @returns A localized version of the given key.
  */
 function l10n(aName)
 {
--- a/browser/devtools/tilt/CmdTilt.jsm
+++ b/browser/devtools/tilt/CmdTilt.jsm
@@ -1,14 +1,14 @@
 /* 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/. */
 
 
-let EXPORTED_SYMBOLS = [ ];
+this.EXPORTED_SYMBOLS = [ ];
 
 Components.utils.import("resource:///modules/devtools/gcli.jsm");
 Components.utils.import("resource:///modules/HUDService.jsm");
 
 
 /**
  * 'tilt' command
  */
--- a/browser/devtools/tilt/Tilt.jsm
+++ b/browser/devtools/tilt/Tilt.jsm
@@ -43,25 +43,25 @@ const TILT_NOTIFICATIONS = {
   NODE_REMOVED: "tilt-node-removed"
 };
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource:///modules/devtools/TiltGL.jsm");
 Cu.import("resource:///modules/devtools/TiltUtils.jsm");
 Cu.import("resource:///modules/devtools/TiltVisualizer.jsm");
 
-let EXPORTED_SYMBOLS = ["Tilt"];
+this.EXPORTED_SYMBOLS = ["Tilt"];
 
 /**
  * Object managing instances of the visualizer.
  *
  * @param {Window} aWindow
  *                 the chrome window used by each visualizer instance
  */
-function Tilt(aWindow)
+this.Tilt = function Tilt(aWindow)
 {
   /**
    * Save a reference to the top-level window.
    */
   this.chromeWindow = aWindow;
 
   /**
    * All the instances of TiltVisualizer.
--- a/browser/devtools/tilt/TiltGL.jsm
+++ b/browser/devtools/tilt/TiltGL.jsm
@@ -10,22 +10,22 @@ const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 const WEBGL_CONTEXT_NAME = "experimental-webgl";
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource:///modules/devtools/TiltMath.jsm");
 Cu.import("resource:///modules/devtools/TiltUtils.jsm");
 
-let EXPORTED_SYMBOLS = ["TiltGL"];
+this.EXPORTED_SYMBOLS = ["TiltGL"];
 
 /**
  * Module containing thin wrappers around low-level WebGL functions.
  */
-let TiltGL = {};
+this.TiltGL = {};
 
 /**
  * Contains commonly used helper methods used in any 3D application.
  *
  * @param {HTMLCanvasElement} aCanvas
  *                            the canvas element used for rendering
  * @param {Function} onError
  *                   optional, function called if initialization failed
--- a/browser/devtools/tilt/TiltMath.jsm
+++ b/browser/devtools/tilt/TiltMath.jsm
@@ -4,34 +4,34 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 const Cu = Components.utils;
 
 Cu.import("resource:///modules/devtools/TiltUtils.jsm");
 
-let EXPORTED_SYMBOLS =
+this.EXPORTED_SYMBOLS =
   ["EPSILON", "TiltMath", "vec3", "mat3", "mat4", "quat4"];
 
 /**
  * Module containing high performance matrix and vector operations for WebGL.
  * Inspired by glMatrix, version 0.9.6, (c) 2011 Brandon Jones.
  */
 
-const EPSILON = 0.01;
+this.EPSILON = 0.01;
 const PI_OVER_180 = Math.PI / 180;
 const INV_PI_OVER_180 = 180 / Math.PI;
 const FIFTEEN_OVER_225 = 15 / 225;
 const ONE_OVER_255 = 1 / 255;
 
 /**
  * vec3 - 3 Dimensional Vector.
  */
-let vec3 = {
+this.vec3 = {
 
   /**
    * Creates a new instance of a vec3 using the Float32Array type.
    * Any array containing at least 3 numeric elements can serve as a vec3.
    *
    * @param {Array} aVec
    *                optional, vec3 containing values to initialize with
    *
@@ -491,17 +491,17 @@ let vec3 = {
   {
     return '[' + aVec[0] + ", " + aVec[1] + ", " + aVec[2] + ']';
   }
 };
 
 /**
  * mat3 - 3x3 Matrix.
  */
-let mat3 = {
+this.mat3 = {
 
   /**
    * Creates a new instance of a mat3 using the Float32Array array type.
    * Any array containing at least 9 numeric elements can serve as a mat3.
    *
    * @param {Array} aMat
    *                optional, mat3 containing values to initialize with
    *
@@ -654,17 +654,17 @@ let mat3 = {
            ", " + aMat[3] + ", " + aMat[4] + ", " + aMat[5] +
            ", " + aMat[6] + ", " + aMat[7] + ", " + aMat[8] + "]";
   }
 };
 
 /**
  * mat4 - 4x4 Matrix.
  */
-let mat4 = {
+this.mat4 = {
 
   /**
    * Creates a new instance of a mat4 using the default Float32Array type.
    * Any array containing at least 16 numeric elements can serve as a mat4.
    *
    * @param {Array} aMat
    *                optional, mat4 containing values to initialize with
    *
@@ -1622,17 +1622,17 @@ let mat4 = {
            ", "+ mat[12] + ", " + mat[13] + ", " + mat[14] + ", " + mat[15] +
            "]";
   }
 };
 
 /**
  * quat4 - Quaternion.
  */
-let quat4 = {
+this.quat4 = {
 
   /**
    * Creates a new instance of a quat4 using the default Float32Array type.
    * Any array containing at least 4 numeric elements can serve as a quat4.
    *
    * @param {Array} aQuat
    *                optional, quat4 containing values to initialize with
    *
@@ -2111,17 +2111,17 @@ let quat4 = {
                  aQuat[2] + ", " +
                  aQuat[3] + "]";
   }
 };
 
 /**
  * Various algebraic math functions required by the engine.
  */
-let TiltMath = {
+this.TiltMath = {
 
   /**
    * Helper function, converts degrees to radians.
    *
    * @param {Number} aDegrees
    *                 the degrees to be converted to radians
    *
    * @return {Number} the degrees converted to radians
--- a/browser/devtools/tilt/TiltUtils.jsm
+++ b/browser/devtools/tilt/TiltUtils.jsm
@@ -8,22 +8,22 @@
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
 
-let EXPORTED_SYMBOLS = ["TiltUtils"];
+this.EXPORTED_SYMBOLS = ["TiltUtils"];
 
 /**
  * Module containing various helper functions used throughout Tilt.
  */
-let TiltUtils = {};
+this.TiltUtils = {};
 
 /**
  * Various console/prompt output functions required by the engine.
  */
 TiltUtils.Output = {
 
   /**
    * Logs a message to the console.
--- a/browser/devtools/tilt/TiltVisualizer.jsm
+++ b/browser/devtools/tilt/TiltVisualizer.jsm
@@ -51,31 +51,31 @@ const TILT_CRAFTER = "resource:///module
 const TILT_PICKER = "resource:///modules/devtools/TiltWorkerPicker.js";
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource:///modules/devtools/TiltGL.jsm");
 Cu.import("resource:///modules/devtools/TiltMath.jsm");
 Cu.import("resource:///modules/devtools/TiltUtils.jsm");
 Cu.import("resource:///modules/devtools/TiltVisualizerStyle.jsm");
 
-let EXPORTED_SYMBOLS = ["TiltVisualizer"];
+this.EXPORTED_SYMBOLS = ["TiltVisualizer"];
 
 /**
  * Initializes the visualization presenter and controller.
  *
  * @param {Object} aProperties
  *                 an object containing the following properties:
  *        {Window} chromeWindow: a reference to the top level window
  *        {Window} contentWindow: the content window holding the visualized doc
  *       {Element} parentNode: the parent node to hold the visualization
  *        {Object} notifications: necessary notifications for Tilt
  *      {Function} onError: optional, function called if initialization failed
  *      {Function} onLoad: optional, function called if initialization worked
  */
-function TiltVisualizer(aProperties)
+this.TiltVisualizer = function TiltVisualizer(aProperties)
 {
   // make sure the properties parameter is a valid object
   aProperties = aProperties || {};
 
   /**
    * Save a reference to the top-level window.
    */
   this.chromeWindow = aProperties.chromeWindow;
--- a/browser/devtools/tilt/TiltVisualizerStyle.jsm
+++ b/browser/devtools/tilt/TiltVisualizerStyle.jsm
@@ -4,23 +4,23 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 const Cu = Components.utils;
 
 Cu.import("resource:///modules/devtools/TiltMath.jsm");
 
-let EXPORTED_SYMBOLS = ["TiltVisualizerStyle"];
+this.EXPORTED_SYMBOLS = ["TiltVisualizerStyle"];
 let rgba = TiltMath.hex2rgba;
 
 /**
  * Various colors and style settings used throughout Tilt.
  */
-let TiltVisualizerStyle = {
+this.TiltVisualizerStyle = {
 
   canvas: {
     background: "-moz-linear-gradient(top, #454545 0%, #000 100%)",
   },
 
   nodes: {
     highlight: {
       defaultFill: rgba("#555"),
--- a/browser/devtools/webconsole/AutocompletePopup.jsm
+++ b/browser/devtools/webconsole/AutocompletePopup.jsm
@@ -15,26 +15,26 @@ const HUD_STRINGS_URI = "chrome://browse
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "stringBundle", function () {
   return Services.strings.createBundle(HUD_STRINGS_URI);
 });
 
 
-var EXPORTED_SYMBOLS = ["AutocompletePopup"];
+this.EXPORTED_SYMBOLS = ["AutocompletePopup"];
 
 /**
  * Autocomplete popup UI implementation.
  *
  * @constructor
  * @param nsIDOMDocument aDocument
  *        The document you want the popup attached to.
  */
-function AutocompletePopup(aDocument)
+this.AutocompletePopup = function AutocompletePopup(aDocument)
 {
   this._document = aDocument;
 
   // Reuse the existing popup elements.
   this._panel = this._document.getElementById("webConsole_autocompletePopup");
   if (!this._panel) {
     this._panel = this._document.createElementNS(XUL_NS, "panel");
     this._panel.setAttribute("id", "webConsole_autocompletePopup");
--- a/browser/devtools/webconsole/HUDService.jsm
+++ b/browser/devtools/webconsole/HUDService.jsm
@@ -18,17 +18,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "WebConsoleUtils",
                                   "resource://gre/modules/devtools/WebConsoleUtils.jsm");
 
 const STRINGS_URI = "chrome://browser/locale/devtools/webconsole.properties";
 let l10n = new WebConsoleUtils.l10n(STRINGS_URI);
 
-var EXPORTED_SYMBOLS = ["HUDService"];
+this.EXPORTED_SYMBOLS = ["HUDService"];
 
 function LogFactory(aMessagePrefix)
 {
   function log(aMessage) {
     var _msg = aMessagePrefix + " " + aMessage + "\n";
     dump(_msg);
   }
   return log;
--- a/browser/devtools/webconsole/NetworkPanel.jsm
+++ b/browser/devtools/webconsole/NetworkPanel.jsm
@@ -22,27 +22,27 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/NetUtil.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "WebConsoleUtils",
                                   "resource://gre/modules/devtools/WebConsoleUtils.jsm");
 
 const STRINGS_URI = "chrome://browser/locale/devtools/webconsole.properties";
 let l10n = new WebConsoleUtils.l10n(STRINGS_URI);
 
-var EXPORTED_SYMBOLS = ["NetworkPanel"];
+this.EXPORTED_SYMBOLS = ["NetworkPanel"];
 
 /**
  * Creates a new NetworkPanel.
  *
  * @param nsIDOMNode aParent
  *        Parent node to append the created panel to.
  * @param object aHttpActivity
  *        HttpActivity to display in the panel.
  */
-function NetworkPanel(aParent, aHttpActivity)
+this.NetworkPanel = function NetworkPanel(aParent, aHttpActivity)
 {
   let doc = aParent.ownerDocument;
   this.httpActivity = aHttpActivity;
 
   // Create the underlaying panel
   this.panel = createElement(doc, "panel", {
     label: l10n.getStr("NetworkPanel.label"),
     titlebar: "normal",
--- a/browser/devtools/webconsole/PropertyPanel.jsm
+++ b/browser/devtools/webconsole/PropertyPanel.jsm
@@ -10,27 +10,27 @@ const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "WebConsoleUtils",
                                   "resource://gre/modules/devtools/WebConsoleUtils.jsm");
 
-var EXPORTED_SYMBOLS = ["PropertyPanel", "PropertyTreeView"];
+this.EXPORTED_SYMBOLS = ["PropertyPanel", "PropertyTreeView"];
 
 ///////////////////////////////////////////////////////////////////////////
 //// PropertyTreeView.
 
 /**
  * This is an implementation of the nsITreeView interface. For comments on the
  * interface properties, see the documentation:
  * https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsITreeView
  */
-var PropertyTreeView = function() {
+this.PropertyTreeView = function() {
   this._rows = [];
   this._objectActors = [];
 };
 
 PropertyTreeView.prototype = {
   /**
    * Stores the visible rows of the tree.
    * @private
@@ -399,17 +399,17 @@ function appendChild(aDocument, aParent,
  * @param string aTitle
  *        Title for the panel.
  * @param string aObject
  *        Object to display in the tree. For details about this object please
  *        see the PropertyTreeView constructor in this file.
  * @param array of objects aButtons
  *        Array with buttons to display at the bottom of the panel.
  */
-function PropertyPanel(aParent, aTitle, aObject, aButtons)
+this.PropertyPanel = function PropertyPanel(aParent, aTitle, aObject, aButtons)
 {
   let document = aParent.ownerDocument;
 
   // Create the underlying panel
   this.panel = createElement(document, "panel", {
     label: aTitle,
     titlebar: "normal",
     noautofocus: "true",
--- a/browser/fuel/src/fuelApplication.js
+++ b/browser/fuel/src/fuelApplication.js
@@ -799,10 +799,10 @@ Application.prototype = {
   }
 };
 
 #include ../../../toolkit/components/exthelper/extApplication.js
 
 // set the proto, defined in extApplication.js
 Application.prototype.__proto__ = extApplication.prototype;
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([Application]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Application]);
 
--- a/browser/modules/AboutHomeUtils.jsm
+++ b/browser/modules/AboutHomeUtils.jsm
@@ -1,26 +1,26 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = [ "AboutHomeUtils" ];
+this.EXPORTED_SYMBOLS = [ "AboutHomeUtils" ];
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 // Url to fetch snippets, in the urlFormatter service format.
 const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl";
 
 // Should be bumped up if the snippets content format changes.
 const STARTPAGE_VERSION = 3;
 
-let AboutHomeUtils = new Object();
+this.AboutHomeUtils = new Object();
 
 /**
  * Returns an object containing the name and searchURL of the original default
  * search engine.
  */
 XPCOMUtils.defineLazyGetter(AboutHomeUtils, "defaultSearchEngine", function() {
   let defaultEngine = Services.search.originalDefaultEngine;
   let submission = defaultEngine.getSubmission("_searchTerms_");
--- a/browser/modules/BrowserNewTabPreloader.jsm
+++ b/browser/modules/BrowserNewTabPreloader.jsm
@@ -1,29 +1,29 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-let EXPORTED_SYMBOLS = ["BrowserNewTabPreloader"];
+this.EXPORTED_SYMBOLS = ["BrowserNewTabPreloader"];
 
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 const PREF_BRANCH = "browser.newtab.";
 const TOPIC_DELAYED_STARTUP = "browser-delayed-startup-finished";
 const PRELOADER_INIT_DELAY_MS = 5000;
 
-let BrowserNewTabPreloader = {
+this.BrowserNewTabPreloader = {
   init: function Preloader_init() {
     Initializer.start();
   },
 
   uninit: function Preloader_uninit() {
     Initializer.stop();
     HostFrame.destroy();
     Preferences.uninit();
--- a/browser/modules/NetworkPrioritizer.jsm
+++ b/browser/modules/NetworkPrioritizer.jsm
@@ -8,17 +8,17 @@
  * with the priority adjustment used.
  *
  * Highest (-10): Selected tab in the focused window.
  * Medium (0):    Background tabs in the focused window.
  *                Selected tab in background windows.
  * Lowest (+10):  Background tabs in background windows.
  */
 
-let EXPORTED_SYMBOLS = ["trackBrowserWindow"];
+this.EXPORTED_SYMBOLS = ["trackBrowserWindow"];
 
 const Ci = Components.interfaces;
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 
 // Lazy getters
 XPCOMUtils.defineLazyServiceGetter(this, "_focusManager",
@@ -34,17 +34,17 @@ const PRIORITY_DELTA = -10;
 
 
 // Variables
 let _lastFocusedWindow = null;
 let _windows = [];
 
 
 // Exported symbol
-function trackBrowserWindow(aWindow) {
+this.trackBrowserWindow = function trackBrowserWindow(aWindow) {
   WindowHelper.addWindow(aWindow);
 }
 
 
 // Global methods
 function _handleEvent(aEvent) {
   switch (aEvent.type) {
     case "TabOpen":
--- a/browser/modules/NewTabUtils.jsm
+++ b/browser/modules/NewTabUtils.jsm
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-let EXPORTED_SYMBOLS = ["NewTabUtils"];
+this.EXPORTED_SYMBOLS = ["NewTabUtils"];
 
 const Ci = Components.interfaces;
 const Cc = Components.classes;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
@@ -670,17 +670,17 @@ let ExpirationFilter = {
       aCallback(urls);
     });
   }
 };
 
 /**
  * Singleton that provides the public API of this JSM.
  */
-let NewTabUtils = {
+this.NewTabUtils = {
   _initialized: false,
 
   init: function NewTabUtils_init() {
     if (!this._initialized) {
       this._initialized = true;
       ExpirationFilter.init();
       Telemetry.init();
     }
--- a/browser/modules/SignInToWebsite.jsm
+++ b/browser/modules/SignInToWebsite.jsm
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = ["SignInToWebsiteUX"];
+this.EXPORTED_SYMBOLS = ["SignInToWebsiteUX"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
@@ -18,17 +18,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 
 XPCOMUtils.defineLazyModuleGetter(this, "Logger",
                                   "resource://gre/modules/identity/LogUtils.jsm");
 
 function log(...aMessageArgs) {
   Logger.log.apply(Logger, ["SignInToWebsiteUX"].concat(aMessageArgs));
 }
 
-let SignInToWebsiteUX = {
+this.SignInToWebsiteUX = {
 
   init: function SignInToWebsiteUX_init() {
 
     /*
      * bug 793906 - temporarily disabling desktop UI so we can
      * focus on b2g without worrying about desktop as well
      *
     Services.obs.addObserver(this, "identity-request", false);
--- a/browser/modules/Social.jsm
+++ b/browser/modules/Social.jsm
@@ -1,27 +1,27 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-let EXPORTED_SYMBOLS = ["Social"];
+this.EXPORTED_SYMBOLS = ["Social"];
 
 const Ci = Components.interfaces;
 const Cc = Components.classes;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "SocialService",
   "resource://gre/modules/SocialService.jsm");
 
-let Social = {
+this.Social = {
   lastEventReceived: 0,
   provider: null,
   _disabledForSafeMode: false,
   init: function Social_init(callback) {
     this._disabledForSafeMode = Services.appinfo.inSafeMode && this.enabled;
 
     if (this.provider) {
       schedule(callback);
--- a/browser/modules/TelemetryTimestamps.jsm
+++ b/browser/modules/TelemetryTimestamps.jsm
@@ -1,26 +1,26 @@
 /* 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/. */
 
-let EXPORTED_SYMBOLS = ["TelemetryTimestamps"];
+this.EXPORTED_SYMBOLS = ["TelemetryTimestamps"];
 
 /**
  * This module's purpose is to collect timestamps for important
  * application-specific events.
  *
  * The TelemetryPing component attaches the timestamps stored by this module to
  * the telemetry submission, substracting the process lifetime so that the times
  * are relative to process startup. The overall goal is to produce a basic
  * timeline of the startup process.
  */
 let timeStamps = {};
 
-let TelemetryTimestamps = {
+this.TelemetryTimestamps = {
   /**
    * Adds a timestamp to the list. The addition of TimeStamps that already have
    * a value stored is ignored.
    *
    * @param name must be a unique, generally "camelCase" descriptor of what the
    *             timestamp represents. e.g.: "delayedStartupStarted"
    * @param value is a timeStamp in milliseconds since the epoch. If omitted,
    *              defaults to Date.now().
--- a/browser/modules/WindowsJumpLists.jsm
+++ b/browser/modules/WindowsJumpLists.jsm
@@ -30,17 +30,17 @@ const LIST_TYPE = {
   FREQUENT: 0
 , RECENT: 1
 }
 
 /**
  * Exports
  */
 
-let EXPORTED_SYMBOLS = [
+this.EXPORTED_SYMBOLS = [
   "WinTaskbarJumpList",
 ];
 
 /**
  * Smart getters
  */
 
 XPCOMUtils.defineLazyGetter(this, "_prefs", function() {
@@ -152,17 +152,17 @@ var tasksCfg = [
       return !PrivateBrowsingUtils.permanentPrivateBrowsing;
     },
   },
 ];
 
 /////////////////////////////////////////////////////////////////////////////
 // Implementation
 
-var WinTaskbarJumpList =
+this.WinTaskbarJumpList =
 {
   _builder: null,
   _tasks: null,
   _shuttingDown: false,
 
   /**
    * Startup, shutdown, and update
    */ 
--- a/browser/modules/WindowsPreviewPerTab.jsm
+++ b/browser/modules/WindowsPreviewPerTab.jsm
@@ -36,17 +36,17 @@
  * the user scroll through the list of tabs. Since this is undoubtedly
  * inconvenient for users with many tabs, the AeroPeek objects turns off all of
  * the tab previews. This tells the taskbar to revert to one preview per window.
  * If the number of tabs falls below this magic threshold, the preview-per-tab
  * behavior returns. There is no reliable way to determine when the scroll
  * buttons appear on the taskbar, so a magic pref-controlled number determines
  * when this threshold has been crossed.
  */
-var EXPORTED_SYMBOLS = ["AeroPeek"];
+this.EXPORTED_SYMBOLS = ["AeroPeek"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
 Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
@@ -553,17 +553,17 @@ TabWindow.prototype = {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// AeroPeek
 
 /*
  * This object acts as global storage and external interface for this feature.
  * It maintains the values of the prefs.
  */
-var AeroPeek = {
+this.AeroPeek = {
   available: false,
   // Does the pref say we're enabled?
   _prefenabled: true,
 
   _enabled: true,
 
   // nsITaskbarTabPreview array
   previews: [],
--- a/browser/modules/offlineAppCache.jsm
+++ b/browser/modules/offlineAppCache.jsm
@@ -1,18 +1,18 @@
 /* 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/. */
  
-let EXPORTED_SYMBOLS = ["OfflineAppCacheHelper"];
+this.EXPORTED_SYMBOLS = ["OfflineAppCacheHelper"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
-let OfflineAppCacheHelper = {
+this.OfflineAppCacheHelper = {
   clear: function() {
     var cacheService = Cc["@mozilla.org/network/cache-service;1"].
                        getService(Ci.nsICacheService);
     try {
       cacheService.evictEntries(Ci.nsICache.STORE_OFFLINE);
     } catch(er) {}
   }
 };
--- a/browser/modules/openLocationLastURL.jsm
+++ b/browser/modules/openLocationLastURL.jsm
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const LAST_URL_PREF = "general.open_location.last_url";
 const nsISupportsString = Components.interfaces.nsISupportsString;
 const Ci = Components.interfaces;
 
 Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
 
-var EXPORTED_SYMBOLS = [ "OpenLocationLastURL" ];
+this.EXPORTED_SYMBOLS = [ "OpenLocationLastURL" ];
 
 let prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
                         .getService(Components.interfaces.nsIPrefBranch);
 let gOpenLocationLastURLData = "";
 
 let observer = {
   QueryInterface: function (aIID) {
     if (aIID.equals(Components.interfaces.nsIObserver) ||
@@ -36,17 +36,17 @@ let observer = {
 };
 
 let os = Components.classes["@mozilla.org/observer-service;1"]
                    .getService(Components.interfaces.nsIObserverService);
 os.addObserver(observer, "last-pb-context-exited", true);
 os.addObserver(observer, "browser:purge-session-history", true);
 
 
-function OpenLocationLastURL(aWindow) {
+this.OpenLocationLastURL = function OpenLocationLastURL(aWindow) {
   this.window = aWindow;
 }
 
 OpenLocationLastURL.prototype = {
   isPrivate: function OpenLocationLastURL_isPrivate() {
     // Assume not in private browsing mode, unless the browser window is
     // in private mode.
     if (!this.window)
--- a/browser/modules/webappsUI.jsm
+++ b/browser/modules/webappsUI.jsm
@@ -1,26 +1,26 @@
 /* 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/. */
 
-let EXPORTED_SYMBOLS = ["webappsUI"];
+this.EXPORTED_SYMBOLS = ["webappsUI"];
 
 let Ci = Components.interfaces;
 let Cc = Components.classes;
 let Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Webapps.jsm");
 Cu.import("resource://gre/modules/AppsUtils.jsm");
 Cu.import("resource://gre/modules/WebappsInstaller.jsm");
 Cu.import("resource://gre/modules/WebappOSUtils.jsm");
 
-let webappsUI = {
+this.webappsUI = {
   init: function webappsUI_init() {
     Services.obs.addObserver(this, "webapps-ask-install", false);
     Services.obs.addObserver(this, "webapps-launch", false);
     Services.obs.addObserver(this, "webapps-uninstall", false);
   },
 
   uninit: function webappsUI_uninit() {
     Services.obs.removeObserver(this, "webapps-ask-install");
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -1,22 +1,22 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-let EXPORTED_SYMBOLS = ["webrtcUI"];
+this.EXPORTED_SYMBOLS = ["webrtcUI"];
 
 const Cu = Components.utils;
 const Ci = Components.interfaces;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
-let webrtcUI = {
+this.webrtcUI = {
   init: function () {
     Services.obs.addObserver(handleRequest, "getUserMedia:request", false);
   },
   uninit: function () {
     Services.obs.removeObserver(handleRequest, "getUserMedia:request");
   }
 }
 
--- a/content/base/src/CSPUtils.jsm
+++ b/content/base/src/CSPUtils.jsm
@@ -15,18 +15,18 @@ const Ci = Components.interfaces;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "Services",
                                   "resource://gre/modules/Services.jsm");
 
 // Module stuff
-var EXPORTED_SYMBOLS = ["CSPRep", "CSPSourceList", "CSPSource", "CSPHost",
-                        "CSPdebug", "CSPViolationReportListener", "CSPLocalizer"];
+this.EXPORTED_SYMBOLS = ["CSPRep", "CSPSourceList", "CSPSource", "CSPHost",
+                         "CSPdebug", "CSPViolationReportListener", "CSPLocalizer"];
 
 var STRINGS_URI = "chrome://global/locale/security/csp.properties";
 
 // these are not exported
 var gIoService = Components.classes["@mozilla.org/network/io-service;1"]
                  .getService(Ci.nsIIOService);
 
 var gETLDService = Components.classes["@mozilla.org/network/effective-tld-service;1"]
@@ -89,17 +89,17 @@ var gPrefObserver = {
 
   observe: function(aSubject, aTopic, aData) {
     if (aTopic != "nsPref:changed") return;
     if (aData === "debug")
       this._debugEnabled = this._branch.getBoolPref("debug");
   },
 };
 
-function CSPdebug(aMsg) {
+this.CSPdebug = function CSPdebug(aMsg) {
   if (!gPrefObserver.debugEnabled) return;
 
   aMsg = 'CSP debug: ' + aMsg + "\n";
   Components.classes["@mozilla.org/consoleservice;1"]
                     .getService(Ci.nsIConsoleService)
                     .logStringMessage(aMsg);
 }
 
@@ -155,17 +155,17 @@ CSPPolicyURIListener.prototype = {
   }
 };
 
 //:::::::::::::::::::::::: CLASSES :::::::::::::::::::::::::://
 
 /**
  * Class that represents a parsed policy structure.
  */
-function CSPRep() {
+this.CSPRep = function CSPRep() {
   // this gets set to true when the policy is done parsing, or when a
   // URI-borne policy has finished loading.
   this._isInitialized = false;
 
   this._allowEval = false;
   this._allowInlineScripts = false;
 
   // don't auto-populate _directives, so it is easier to find bugs
@@ -659,17 +659,17 @@ CSPRep.prototype = {
               .getService(Ci.nsIConsoleService).logMessage(consoleMsg);
   },
 };
 
 //////////////////////////////////////////////////////////////////////
 /**
  * Class to represent a list of sources
  */
-function CSPSourceList() {
+this.CSPSourceList = function CSPSourceList() {
   this._sources = [];
   this._permitAllSources = false;
 
   // Set to true when this list is created using "makeExplicit()"
   // It's useful to know this when reporting the directive that was violated.
   this._isImplicit = false;
 }
 
@@ -895,17 +895,17 @@ CSPSourceList.prototype = {
     return newCSPSrcList;
   }
 }
 
 //////////////////////////////////////////////////////////////////////
 /**
  * Class to model a source (scheme, host, port)
  */
-function CSPSource() {
+this.CSPSource = function CSPSource() {
   this._scheme = undefined;
   this._port = undefined;
   this._host = undefined;
 
   //when set to true, this allows all source
   this._permitAll = false;
 
   // when set to true, this source represents 'self'
@@ -1382,17 +1382,17 @@ CSPSource.prototype = {
   },
 
 };
 
 //////////////////////////////////////////////////////////////////////
 /**
  * Class to model a host *.x.y.
  */
-function CSPHost() {
+this.CSPHost = function CSPHost() {
   this._segments = [];
 }
 
 /**
  * Factory to create a new CSPHost, parsed from a string.
  *
  * @param aStr
  *        string rep of a CSP Host
@@ -1551,17 +1551,17 @@ CSPHost.prototype = {
   }
 };
 
 
 //////////////////////////////////////////////////////////////////////
 /**
  * Class that listens to violation report transmission and logs errors.
  */
-function CSPViolationReportListener(reportURI) {
+this.CSPViolationReportListener = function CSPViolationReportListener(reportURI) {
   this._reportURI = reportURI;
 }
 
 CSPViolationReportListener.prototype = {
   _reportURI:   null,
 
   QueryInterface: function(iid) {
     if (iid.equals(Ci.nsIStreamListener) ||
@@ -1631,17 +1631,17 @@ function cspWarn(aCSPRep, aMessage) {
     aCSPRep.warn(aMessage);
   } else {
     (new CSPRep()).warn(aMessage);
   }
 }
 
 //////////////////////////////////////////////////////////////////////
 
-CSPLocalizer = {
+this.CSPLocalizer = {
   /**
    * Retrieve a localized string.
    *
    * @param string aName
    *        The string name you want from the CSP string bundle.
    * @return string
    *         The localized string.
    */
--- a/content/base/src/contentAreaDropListener.js
+++ b/content/base/src/contentAreaDropListener.js
@@ -146,9 +146,9 @@ ContentAreaDropListener.prototype =
     if (name)
       aName.value = name;
 
     return url;
   }
 };
 
 var components = [ContentAreaDropListener];
-const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/content/base/src/contentSecurityPolicy.js
+++ b/content/base/src/contentSecurityPolicy.js
@@ -565,9 +565,9 @@ CSPReportRedirectSink.prototype = {
                                      "denied redirect while sending violation report");
       }, Ci.nsIThread.DISPATCH_NORMAL);
 
     // throw to stop the redirect happening
     throw Cr.NS_BINDING_REDIRECTED;
   }
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentSecurityPolicy]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentSecurityPolicy]);
--- a/content/base/src/messageWakeupService.js
+++ b/content/base/src/messageWakeupService.js
@@ -87,10 +87,10 @@ MessageWakeupService.prototype =
           }
         }
         break;
     }
   },
 };
 
 var components = [MessageWakeupService];
-const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
 
--- a/content/base/src/nsBadCertHandler.js
+++ b/content/base/src/nsBadCertHandler.js
@@ -37,9 +37,9 @@ BadCertHandler.prototype = {
   // nsISupports
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIBadCertListener2,
                                          Ci.nsISSLErrorListener,
                                          Ci.nsIInterfaceRequestor]),
 
   classID:          Components.ID("{dbded6ec-edbf-4054-a834-287b82c260f9}"),
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([BadCertHandler]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([BadCertHandler]);
--- a/content/xslt/src/xslt/txEXSLTRegExFunctions.js
+++ b/content/xslt/src/xslt/txEXSLTRegExFunctions.js
@@ -61,9 +61,9 @@ txEXSLTRegExFunctions.prototype = {
 
     test: function(str, regex, flags) {
         var re = new RegExp(regex, flags);
 
         return re.test(str);
     }
 }
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([txEXSLTRegExFunctions]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([txEXSLTRegExFunctions]);
--- a/content/xtf/test/unit/xtfComponent.js
+++ b/content/xtf/test/unit/xtfComponent.js
@@ -147,9 +147,9 @@ FooElementFactory.prototype =
 
     throw Components.results.NS_ERROR_NO_INTERFACE;
     return null;
   }
 };
 
 /* </foo:element> */
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([FooElementFactory]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FooElementFactory]);
--- a/dom/activities/src/ActivitiesService.jsm
+++ b/dom/activities/src/ActivitiesService.jsm
@@ -11,17 +11,17 @@ const Ci = Components.interfaces;
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
                                    "@mozilla.org/parentprocessmessagemanager;1",
                                    "nsIMessageBroadcaster");
 
-const EXPORTED_SYMBOLS = [];
+this.EXPORTED_SYMBOLS = [];
 
 let idbGlobal = this;
 
 function debug(aMsg) {
   //dump("-- ActivitiesService.jsm " + Date.now() + " " + aMsg + "\n");
 }
 
 const DB_NAME    = "activities";
--- a/dom/activities/src/ActivityOptions.js
+++ b/dom/activities/src/ActivityOptions.js
@@ -48,9 +48,9 @@ ActivityOptions.prototype = {
     classID: Components.ID("{ee983dbb-d5ea-4c5b-be98-10a13cac9f9d}"),
     contractID: "@mozilla.org/dom/activities/options;1",
     interfaces: [Ci.nsIDOMMozActivityOptions],
     flags: Ci.nsIClassInfo.DOM_OBJECT,
     classDescription: "Activity Options"
   })
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityOptions]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityOptions]);
--- a/dom/activities/src/ActivityProxy.js
+++ b/dom/activities/src/ActivityProxy.js
@@ -95,9 +95,9 @@ ActivityProxy.prototype = {
     }
     this.cleanedUp = true;
   },
 
   classID: Components.ID("{ba9bd5cb-76a0-4ecf-a7b3-d2f7c43c5949}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIActivityProxy])
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityProxy]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityProxy]);
--- a/dom/activities/src/ActivityRequestHandler.js
+++ b/dom/activities/src/ActivityRequestHandler.js
@@ -72,9 +72,9 @@ ActivityRequestHandler.prototype = {
     classID: Components.ID("{9326952a-dbe3-4d81-a51f-d9c160d96d6b}"),
     contractID: "@mozilla.org/dom/activities/request-handler;1",
     interfaces: [Ci.nsIDOMMozActivityRequestHandler],
     flags: Ci.nsIClassInfo.DOM_OBJECT,
     classDescription: "Activity Request Handler"
   })
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityRequestHandler]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityRequestHandler]);
--- a/dom/activities/src/ActivityWrapper.js
+++ b/dom/activities/src/ActivityWrapper.js
@@ -37,10 +37,10 @@ ActivityWrapper.prototype = {
 
     return handler;
   },
 
   classID: Components.ID("{5430d6f9-32d6-4924-ba39-6b6d1b093cd6}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemMessagesWrapper])
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityWrapper]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityWrapper]);
 
--- a/dom/alarm/AlarmDB.jsm
+++ b/dom/alarm/AlarmDB.jsm
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = ["AlarmDB"];
+this.EXPORTED_SYMBOLS = ["AlarmDB"];
 
 /* static functions */
 const DEBUG = false;
 
 function debug(aStr) {
   if (DEBUG)
     dump("AlarmDB: " + aStr + "\n");
 }
@@ -18,17 +18,17 @@ const { classes: Cc, interfaces: Ci, uti
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
 
 const ALARMDB_NAME    = "alarms";
 const ALARMDB_VERSION = 1;
 const ALARMSTORE_NAME = "alarms";
 
-function AlarmDB(aGlobal) {
+this.AlarmDB = function AlarmDB(aGlobal) {
   debug("AlarmDB()");
   this._global = aGlobal;
 }
 
 AlarmDB.prototype = {
   __proto__: IndexedDBHelper.prototype,
 
   init: function init(aGlobal) {
--- a/dom/alarm/AlarmService.jsm
+++ b/dom/alarm/AlarmService.jsm
@@ -13,29 +13,29 @@ function debug(aStr) {
 }
 
 const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/AlarmDB.jsm");
 
-let EXPORTED_SYMBOLS = ["AlarmService"];
+this.EXPORTED_SYMBOLS = ["AlarmService"];
 
 XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
                                    "@mozilla.org/parentprocessmessagemanager;1",
                                    "nsIMessageListenerManager");
 
 XPCOMUtils.defineLazyGetter(this, "messenger", function() {
   return Cc["@mozilla.org/system-message-internal;1"].getService(Ci.nsISystemMessagesInternal);
 });
 
 let myGlobal = this;
 
-let AlarmService = {
+this.AlarmService = {
   init: function init() {
     debug("init()");
 
     this._currentTimezoneOffset = (new Date()).getTimezoneOffset();
 
     let alarmHalService = this._alarmHalService = Cc["@mozilla.org/alarmHalService;1"].getService(Ci.nsIAlarmHalService);
     alarmHalService.setAlarmFiredCb(this._onAlarmFired.bind(this));
     alarmHalService.setTimezoneChangedCb(this._onTimezoneChanged.bind(this));
--- a/dom/alarm/AlarmsManager.js
+++ b/dom/alarm/AlarmsManager.js
@@ -166,9 +166,9 @@ AlarmsManager.prototype = {
   },
 
   // Called from DOMRequestIpcHelper.
   uninit: function uninit() {
     debug("uninit()");
   },
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([AlarmsManager])
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AlarmsManager])
--- a/dom/apps/src/AppsService.js
+++ b/dom/apps/src/AppsService.js
@@ -57,9 +57,9 @@ AppsService.prototype = {
     debug("getAppFromObserverMessage( " + aMessage + " )");
     return DOMApplicationRegistry.getAppFromObserverMessage(aMessage);
   },
 
   classID : APPS_SERVICE_CID,
   QueryInterface : XPCOMUtils.generateQI([Ci.nsIAppsService])
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([AppsService])
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AppsService])
--- a/dom/apps/src/AppsServiceChild.jsm
+++ b/dom/apps/src/AppsServiceChild.jsm
@@ -6,26 +6,26 @@
 
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 // This module exposes a subset of the functionnalities of the parent DOM
 // Registry to content processes, to be be used from the AppsService component.
 
-let EXPORTED_SYMBOLS = ["DOMApplicationRegistry"];
+this.EXPORTED_SYMBOLS = ["DOMApplicationRegistry"];
 
 Cu.import("resource://gre/modules/AppsUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 function debug(s) {
   //dump("-*- AppsServiceChild.jsm: " + s + "\n");
 }
 
-let DOMApplicationRegistry = {
+this.DOMApplicationRegistry = {
   init: function init() {
     debug("init");
     this.cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
                   .getService(Ci.nsISyncMessageSender);
 
     ["Webapps:AddApp", "Webapps:RemoveApp"].forEach((function(aMsgName) {
       this.cpmm.addMessageListener(aMsgName, this);
     }).bind(this));
--- a/dom/apps/src/AppsUtils.jsm
+++ b/dom/apps/src/AppsUtils.jsm
@@ -9,23 +9,23 @@ const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 // Shared code for AppsServiceChild.jsm, Webapps.jsm and Webapps.js
 
-let EXPORTED_SYMBOLS = ["AppsUtils", "ManifestHelper"];
+this.EXPORTED_SYMBOLS = ["AppsUtils", "ManifestHelper"];
 
 function debug(s) {
   //dump("-*- AppsUtils.jsm: " + s + "\n");
 }
 
-let AppsUtils = {
+this.AppsUtils = {
   // Clones a app, without the manifest.
   cloneAppObject: function cloneAppObject(aApp) {
     return {
       name: aApp.name,
       csp: aApp.csp,
       installOrigin: aApp.installOrigin,
       origin: aApp.origin,
       receipts: aApp.receipts ? JSON.parse(JSON.stringify(aApp.receipts)) : null,
@@ -235,17 +235,17 @@ let AppsUtils = {
 
     return ((mstone != savedmstone) || (buildID != savedBuildID));
   },
 }
 
 /**
  * Helper object to access manifest information with locale support
  */
-let ManifestHelper = function(aManifest, aOrigin) {
+this.ManifestHelper = function(aManifest, aOrigin) {
   this._origin = Services.io.newURI(aOrigin, null, null);
   this._manifest = aManifest;
   let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry)
                                                           .QueryInterface(Ci.nsIToolkitChromeRegistry);
   let locale = chrome.getSelectedLocale("browser").toLowerCase();
   this._localeRoot = this._manifest;
 
   if (this._manifest.locales && this._manifest.locales[locale]) {
--- a/dom/apps/src/OfflineCacheInstaller.jsm
+++ b/dom/apps/src/OfflineCacheInstaller.jsm
@@ -4,17 +4,17 @@
 
 "use strict";
 
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const CC = Components.Constructor;
 
-let EXPORTED_SYMBOLS = ["OfflineCacheInstaller"];
+this.EXPORTED_SYMBOLS = ["OfflineCacheInstaller"];
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/AppsUtils.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
 
 let Namespace = CC('@mozilla.org/network/application-cache-namespace;1',
                    'nsIApplicationCacheNamespace',
                    'init');
@@ -93,17 +93,17 @@ function readFile(aFile, aCallback) {
     converter.charset = "UTF-8";
 
     let data = NetUtil.readInputStreamToString(aStream,
                                                aStream.available());
     aCallback(converter.ConvertToUnicode(data));
   });
 }
 
-const OfflineCacheInstaller = {
+this.OfflineCacheInstaller = {
   installCache: function installCache(app) {
     let cacheDir = makeFile(app.basePath)
     cacheDir.append(app.appId);
     cacheDir.append("cache");
     if (!cacheDir.exists())
       return;
 
     let cacheManifest = cacheDir.clone();
--- a/dom/apps/src/PermissionsInstaller.jsm
+++ b/dom/apps/src/PermissionsInstaller.jsm
@@ -6,20 +6,20 @@
 
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/AppsUtils.jsm");
 Cu.import("resource://gre/modules/PermissionSettings.jsm");
 
-var EXPORTED_SYMBOLS = ["PermissionsInstaller",
-                        "expandPermissions",
-                        "PermissionsTable",
-                       ];
+this.EXPORTED_SYMBOLS = ["PermissionsInstaller",
+                         "expandPermissions",
+                         "PermissionsTable",
+                        ];
 const UNKNOWN_ACTION = Ci.nsIPermissionManager.UNKNOWN_ACTION;
 const ALLOW_ACTION = Ci.nsIPermissionManager.ALLOW_ACTION;
 const DENY_ACTION = Ci.nsIPermissionManager.DENY_ACTION;
 const PROMPT_ACTION = Ci.nsIPermissionManager.PROMPT_ACTION;
 
 // Permission access flags
 const READONLY = "readonly";
 const CREATEONLY = "createonly";
@@ -45,17 +45,17 @@ function mapSuffixes(aPermName, aSuffixe
 
 // Permissions Matrix: https://docs.google.com/spreadsheet/ccc?key=0Akyz_Bqjgf5pdENVekxYRjBTX0dCXzItMnRyUU1RQ0E#gid=0
 // Also, keep in sync with https://mxr.mozilla.org/mozilla-central/source/extensions/cookie/Permission.txt
 
 // Permissions that are implicit:
 // battery-status, network-information, vibration,
 // device-capabilities
 
-const PermissionsTable = { "resource-lock": {
+this.PermissionsTable =  { "resource-lock": {
                              app: ALLOW_ACTION,
                              privileged: ALLOW_ACTION,
                              certified: ALLOW_ACTION
                            },
                            geolocation: {
                              app: PROMPT_ACTION,
                              privileged: PROMPT_ACTION,
                              certified: ALLOW_ACTION
@@ -270,17 +270,17 @@ for (let permName in PermissionsTable) {
 /**
  * Expand an access string into multiple permission names,
  *   e.g: perm 'contacts' with 'readwrite' =
  *   ['contacts-read', 'contacts-create', contacts-write']
  * @param string aPermName
  * @param string aAccess
  * @returns Array
  **/
-function expandPermissions(aPermName, aAccess) {
+this.expandPermissions = function expandPermissions(aPermName, aAccess) {
   if (!PermissionsTable[aPermName]) {
     Cu.reportError("PermissionsTable.jsm: expandPermissions: Unknown Permission: " + aPermName);
     return [];
   }
 
 /*
 Temporarily disabled in order to add access fields to gaia: See Bug 805646
   if (!aAccess && PermissionsTable[aPermName].access ||
@@ -317,19 +317,19 @@ Temporarily disabled in order to add acc
 
   let expandedPerms = [aPermName];
   for (let idx in permArr) {
     if (PermissionsTable[aPermName].access.indexOf(requestedSuffixes[idx]) != -1) {
       expandedPerms.push(permArr[idx]);
     }
   }
   return expandedPerms;
-}
+};
 
-let PermissionsInstaller = {
+this.PermissionsInstaller = {
 /**
    * Install permissisions or remove deprecated permissions upon re-install
    * @param object aApp
    *        The just-installed app configuration.
             The properties used are manifestURL, origin and manifest.
    * @param boolean aIsReinstall
    *        Indicates the app was just re-installed
    * @param function aOnError
@@ -448,9 +448,9 @@ let PermissionsInstaller = {
           origin: aApp.origin,
           manifestURL: aApp.manifestURL,
           value: aValue,
           browserFlag: false
         });
       }
     );
   }
-}
+};
--- a/dom/apps/src/Webapps.js
+++ b/dom/apps/src/Webapps.js
@@ -753,11 +753,11 @@ WebappsApplicationMgmt.prototype = {
 
   classInfo: XPCOMUtils.generateCI({classID: Components.ID("{8c1bca96-266f-493a-8d57-ec7a95098c15}"),
                                     contractID: "@mozilla.org/webapps/application-mgmt;1",
                                     interfaces: [Ci.mozIDOMApplicationMgmt],
                                     flags: Ci.nsIClassInfo.DOM_OBJECT,
                                     classDescription: "Webapps Application Mgmt"})
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([WebappsRegistry,
-                                                      WebappsApplication,
-                                                      DOMError]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WebappsRegistry,
+                                                     WebappsApplication,
+                                                     DOMError]);
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -4,17 +4,17 @@
 
 "use strict";
 
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 
-let EXPORTED_SYMBOLS = ["DOMApplicationRegistry"];
+this.EXPORTED_SYMBOLS = ["DOMApplicationRegistry"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import('resource://gre/modules/ActivitiesService.jsm');
 Cu.import("resource://gre/modules/AppsUtils.jsm");
 Cu.import("resource://gre/modules/PermissionsInstaller.jsm");
 Cu.import("resource://gre/modules/OfflineCacheInstaller.jsm");
@@ -49,17 +49,17 @@ XPCOMUtils.defineLazyGetter(this, "msgmg
   const DIRECTORY_NAME = "webappsDir";
 #else
   // If we're executing in the context of the webapp runtime, the data files
   // are in a different directory (currently the Firefox profile that installed
   // the webapp); otherwise, they're in the current profile.
   const DIRECTORY_NAME = WEBAPP_RUNTIME ? "WebappRegD" : "ProfD";
 #endif
 
-let DOMApplicationRegistry = {
+this.DOMApplicationRegistry = {
   appsFile: null,
   webapps: { },
   children: [ ],
   allAppsLaunchable: false,
   downloads: { },
 
   init: function() {
     this.messages = ["Webapps:Install", "Webapps:Uninstall",
--- a/dom/base/ConsoleAPI.js
+++ b/dom/base/ConsoleAPI.js
@@ -480,9 +480,9 @@ ConsoleAPI.prototype = {
         return;
     }
     let duration = (aTimestamp || Date.now()) - this.timerRegistry[key];
     delete this.timerRegistry[key];
     return { name: aName, duration: duration };
   }
 };
 
-let NSGetFactory = XPCOMUtils.generateNSGetFactory([ConsoleAPI]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ConsoleAPI]);
--- a/dom/base/ConsoleAPIStorage.jsm
+++ b/dom/base/ConsoleAPIStorage.jsm
@@ -6,17 +6,17 @@ let Cu = Components.utils;
 let Ci = Components.interfaces;
 let Cc = Components.classes;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 const STORAGE_MAX_EVENTS = 200;
 
-var EXPORTED_SYMBOLS = ["ConsoleAPIStorage"];
+this.EXPORTED_SYMBOLS = ["ConsoleAPIStorage"];
 
 var _consoleStorage = {};
 
 /**
  * The ConsoleAPIStorage is meant to cache window.console API calls for later
  * reuse by other components when needed. For example, the Web Console code can
  * display the cached messages when it opens for the active tab.
  *
@@ -31,17 +31,17 @@ var _consoleStorage = {};
  *    // Get the cached events array for the window you want (use the inner
  *    // window ID).
  *    let events = ConsoleAPIStorage.getEvents(innerWindowID);
  *    events.forEach(function(event) { ... });
  *
  *    // Clear the events for the given inner window ID.
  *    ConsoleAPIStorage.clearEvents(innerWindowID);
  */
-var ConsoleAPIStorage = {
+this.ConsoleAPIStorage = {
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
 
   /** @private */
   observe: function CS_observe(aSubject, aTopic, aData)
   {
     if (aTopic == "xpcom-shutdown") {
       Services.obs.removeObserver(this, "xpcom-shutdown");
--- a/dom/base/DOMRequestHelper.jsm
+++ b/dom/base/DOMRequestHelper.jsm
@@ -5,26 +5,26 @@
 /**
   * helper object for APIs that deal with DOMRequest and need to release them properly
   * when the window goes out of scope
   */
 const Cu = Components.utils; 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
-let EXPORTED_SYMBOLS = ["DOMRequestIpcHelper"];
+this.EXPORTED_SYMBOLS = ["DOMRequestIpcHelper"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
                                    "@mozilla.org/childprocessmessagemanager;1",
                                    "nsIMessageListenerManager");
 
-function DOMRequestIpcHelper() {
+this.DOMRequestIpcHelper = function DOMRequestIpcHelper() {
 }
 
 DOMRequestIpcHelper.prototype = {
   getRequestId: function(aRequest) {
     let id = "id" + this._getRandomId();
     this._requests[id] = aRequest;
     return id;
   },
--- a/dom/base/IndexedDBHelper.jsm
+++ b/dom/base/IndexedDBHelper.jsm
@@ -1,31 +1,32 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict"
 
 let DEBUG = 0;
+let debug;
 if (DEBUG) {
   debug = function (s) { dump("-*- IndexedDBHelper: " + s + "\n"); }
 } else {
   debug = function (s) {}
 }
 
 const Cu = Components.utils; 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
-let EXPORTED_SYMBOLS = ["IndexedDBHelper"];
+this.EXPORTED_SYMBOLS = ["IndexedDBHelper"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
-function IndexedDBHelper() { }
+this.IndexedDBHelper = function IndexedDBHelper() {}
 
 IndexedDBHelper.prototype = {
   
   // Cache the database
   _db: null,
 
   // Close the database
   close: function close() {
--- a/dom/base/ObjectWrapper.jsm
+++ b/dom/base/ObjectWrapper.jsm
@@ -3,21 +3,21 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict"
 
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
-const EXPORTED_SYMBOLS = ["ObjectWrapper"];
+this.EXPORTED_SYMBOLS = ["ObjectWrapper"];
 
 // Makes sure that we expose correctly chrome JS objects to content.
 
-let ObjectWrapper = {
+this.ObjectWrapper = {
   getObjectKind: function objWrapper_getobjectkind(aObject) {
     if (!aObject) {
       return "null";
     }
 
     if (Array.isArray(aObject)) {
       return "array";
     } else if (aObject.mozSlice && (typeof aObject.mozSlice == "function")) {
--- a/dom/base/SiteSpecificUserAgent.js
+++ b/dom/base/SiteSpecificUserAgent.js
@@ -19,9 +19,9 @@ SiteSpecificUserAgent.prototype = {
   getUserAgentForURI: function ssua_getUserAgentForURI(aURI) {
     return UserAgentOverrides.getOverrideForURI(aURI) || DEFAULT_UA;
   },
 
   classID: Components.ID("{506c680f-3d1c-4954-b351-2c80afbc37d3}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISiteSpecificUserAgent])
 };
 
-let NSGetFactory = XPCOMUtils.generateNSGetFactory([SiteSpecificUserAgent]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SiteSpecificUserAgent]);
--- a/dom/browser-element/BrowserElementParent.js
+++ b/dom/browser-element/BrowserElementParent.js
@@ -641,9 +641,9 @@ BrowserElementParent.prototype = {
       break;
     default:
       debug('Unknown topic: ' + topic);
       break;
     };
   },
 };
 
-var NSGetFactory = XPCOMUtils.generateNSGetFactory([BrowserElementParentFactory]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([BrowserElementParentFactory]);
--- a/dom/browser-element/BrowserElementPromptService.jsm
+++ b/dom/browser-element/BrowserElementPromptService.jsm
@@ -6,17 +6,17 @@
 "use strict";
 
 let Cu = Components.utils;
 let Ci = Components.interfaces;
 let Cc = Components.classes;
 let Cr = Components.results;
 let Cm = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
 
-let EXPORTED_SYMBOLS = ["BrowserElementPromptService"];
+this.EXPORTED_SYMBOLS = ["BrowserElementPromptService"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
 const BROWSER_FRAMES_ENABLED_PREF = "dom.mozBrowserFramesEnabled";
 
 function debug(msg) {
@@ -536,17 +536,17 @@ BrowserElementPromptFactory.prototype = 
     }
 
     debug("Returning wrapped getPrompt for " + win);
     return new BrowserElementPrompt(win, browserElementChild)
                                    .QueryInterface(iid);
   }
 };
 
-let BrowserElementPromptService = {
+this.BrowserElementPromptService = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
                                          Ci.nsISupportsWeakReference]),
 
   _initialized: false,
 
   _init: function() {
     if (this._initialized) {
       return;
--- a/dom/contacts/ContactManager.js
+++ b/dom/contacts/ContactManager.js
@@ -596,10 +596,10 @@ ContactManager.prototype = {
 
   classInfo : XPCOMUtils.generateCI({classID: CONTACTMANAGER_CID,
                                      contractID: CONTACTMANAGER_CONTRACTID,
                                      classDescription: "ContactManager",
                                      interfaces: [nsIDOMContactManager],
                                      flags: nsIClassInfo.DOM_OBJECT})
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory(
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
                        [Contact, ContactManager, ContactProperties, ContactAddress, ContactField, ContactTelField, ContactFindOptions])
--- a/dom/contacts/fallback/ContactDB.jsm
+++ b/dom/contacts/fallback/ContactDB.jsm
@@ -1,31 +1,31 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = ['ContactDB'];
+this.EXPORTED_SYMBOLS = ['ContactDB'];
 
 const DEBUG = false;
 function debug(s) { dump("-*- ContactDB component: " + s + "\n"); }
 
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
 
 const DB_NAME = "contacts";
 const DB_VERSION = 4;
 const STORE_NAME = "contacts";
 
-function ContactDB(aGlobal) {
+this.ContactDB = function ContactDB(aGlobal) {
   if (DEBUG) debug("Constructor");
   this._global = aGlobal;
 }
 
 ContactDB.prototype = {
   __proto__: IndexedDBHelper.prototype,
 
   upgradeSchema: function upgradeSchema(aTransaction, aDb, aOldVersion, aNewVersion) {
--- a/dom/contacts/fallback/ContactService.jsm
+++ b/dom/contacts/fallback/ContactService.jsm
@@ -6,17 +6,17 @@
 
 const DEBUG = false;
 function debug(s) { dump("-*- Fallback ContactService component: " + s + "\n"); }
 
 const Cu = Components.utils; 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
-let EXPORTED_SYMBOLS = ["DOMContactManager"];
+this.EXPORTED_SYMBOLS = ["DOMContactManager"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/ContactDB.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
                                    "@mozilla.org/parentprocessmessagemanager;1",
                                    "nsIMessageListenerManager");
@@ -33,17 +33,17 @@ XPCOMUtils.defineLazyGetter(this, "mRIL"
   }
   return telephony.
          getService(Ci.nsIInterfaceRequestor).
          getInterface(Ci.nsIRadioInterfaceLayer);
 });
 
 let myGlobal = this;
 
-let DOMContactManager = {
+this.DOMContactManager = {
   init: function() {
     if (DEBUG) debug("Init");
     this._messages = ["Contacts:Find", "Contacts:Clear", "Contact:Save", "Contact:Remove", "Contacts:GetSimContacts"];
     this._messages.forEach((function(msgName) {
       ppmm.addMessageListener(msgName, this);
     }).bind(this));
 
     var idbManager = Components.classes["@mozilla.org/dom/indexeddb/manager;1"].getService(Ci.nsIIndexedDatabaseManager);
--- a/dom/encoding/test/file_stringencoding.jsm
+++ b/dom/encoding/test/file_stringencoding.jsm
@@ -1,6 +1,6 @@
-var EXPORTED_SYMBOLS = ['checkFromJSM'];
+this.EXPORTED_SYMBOLS = ['checkFromJSM'];
 
-function checkFromJSM(is_op) {
+this.checkFromJSM = function checkFromJSM(is_op) {
   is_op(new TextDecoder().encoding, "utf-8", "JSM should have TextDecoder");
   is_op(new TextEncoder().encoding, "utf-8", "JSM should have TextEncoder");
 }
--- a/dom/fm/DOMFMRadioChild.js
+++ b/dom/fm/DOMFMRadioChild.js
@@ -378,10 +378,10 @@ DOMFMRadioChild.prototype = {
         } catch (e) {
           debug("Exception is caught: " + e);
         }
       }
     }
   }
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([DOMFMRadioChild]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DOMFMRadioChild]);
 
--- a/dom/fm/DOMFMRadioParent.jsm
+++ b/dom/fm/DOMFMRadioParent.jsm
@@ -55,19 +55,19 @@ XPCOMUtils.defineLazyServiceGetter(this,
 XPCOMUtils.defineLazyGetter(this, "FMRadio", function() {
   return Cc["@mozilla.org/fmradio;1"].getService(Ci.nsIFMRadio);
 });
 
 XPCOMUtils.defineLazyServiceGetter(this, "gSettingsService",
                                    "@mozilla.org/settingsService;1",
                                    "nsISettingsService");
 
-let EXPORTED_SYMBOLS = ["DOMFMRadioParent"];
+this.EXPORTED_SYMBOLS = ["DOMFMRadioParent"];
 
-let DOMFMRadioParent = {
+this.DOMFMRadioParent = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
                                          Ci.nsISettingsServiceCallback]),
 
   _initialized: false,
 
   /* Indicates if the FM radio is currently enabled */
   _isEnabled: false,
 
--- a/dom/identity/DOMIdentity.jsm
+++ b/dom/identity/DOMIdentity.jsm
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 // This is the parent process corresponding to nsDOMIdentity.
-let EXPORTED_SYMBOLS = ["DOMIdentity"];
+this.EXPORTED_SYMBOLS = ["DOMIdentity"];
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "IdentityService",
 #ifdef MOZ_B2G_VERSION
                                   "resource://gre/modules/identity/MinimalIdentity.jsm");
 #else
@@ -118,17 +118,17 @@ RPWatchContext.prototype = {
     this._mm.sendAsyncMessage("Identity:RP:Watch:OnReady", message);
   },
 
   doError: function RPWatchContext_onerror(aMessage) {
     log("doError: " + aMessage);
   }
 };
 
-let DOMIdentity = {
+this.DOMIdentity = {
   // nsIMessageListener
   receiveMessage: function DOMIdentity_receiveMessage(aMessage) {
     let msg = aMessage.json;
 
     // Target is the frame message manager that called us and is
     // used to send replies back to the proper window.
     let targetMM = aMessage.target;
 
--- a/dom/identity/nsDOMIdentity.js
+++ b/dom/identity/nsDOMIdentity.js
@@ -529,9 +529,9 @@ nsDOMIdentityInternal.prototype = {
     classID: Components.ID("{8bcac6a3-56a4-43a4-a44c-cdf42763002f}"),
     contractID: "@mozilla.org/dom/identity;1",
     interfaces: [],
     classDescription: "Identity DOM Implementation"
   })
 
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([nsDOMIdentityInternal]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsDOMIdentityInternal]);
--- a/dom/identity/nsIDService.js
+++ b/dom/identity/nsIDService.js
@@ -26,9 +26,9 @@ IDService.prototype = {
         // Startup DOMIdentity.jsm
         Cu.import("resource://gre/modules/DOMIdentity.jsm");
         DOMIdentity._init();
         break;
     }
   }
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([IDService]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([IDService]);
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -668,11 +668,11 @@ PeerConnectionObserver.prototype = {
       try {
         this._dompc.onclosedconnection.onCallback();
       } catch(e) {}
     }
     this._dompc._executeNext();
   }
 };
 
-let NSGetFactory = XPCOMUtils.generateNSGetFactory(
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
   [IceCandidate, SessionDescription, PeerConnection]
 );
--- a/dom/messages/SystemMessageInternal.js
+++ b/dom/messages/SystemMessageInternal.js
@@ -356,9 +356,9 @@ SystemMessageInternal.prototype = {
     return hasher.finish(true);
   },
 
   classID: Components.ID("{70589ca5-91ac-4b9e-b839-d6a88167d714}"),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemMessagesInternal, Ci.nsIObserver])
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([SystemMessageInternal]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SystemMessageInternal]);
--- a/dom/messages/SystemMessageManager.js
+++ b/dom/messages/SystemMessageManager.js
@@ -212,9 +212,9 @@ SystemMessageManager.prototype = {
 
   classInfo: XPCOMUtils.generateCI({classID: Components.ID("{bc076ea0-609b-4d8f-83d7-5af7cbdc3bb2}"),
                                     contractID: "@mozilla.org/system-message-manager;1",
                                     interfaces: [Ci.nsIDOMNavigatorSystemMessages],
                                     flags: Ci.nsIClassInfo.DOM_OBJECT,
                                     classDescription: "System Messages"})
 }
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([SystemMessageManager]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SystemMessageManager]);
--- a/dom/mms/src/ril/MmsPduHelper.jsm
+++ b/dom/mms/src/ril/MmsPduHelper.jsm
@@ -8,17 +8,17 @@ const {classes: Cc, interfaces: Ci, util
 
 let WSP = {};
 Cu.import("resource://gre/modules/WspPduHelper.jsm", WSP);
 
 Cu.import("resource://gre/modules/mms_consts.js");
 
 let DEBUG; // set to true to see debug messages
 
-function translatePduErrorToStatus(error) {
+this.translatePduErrorToStatus = function translatePduErrorToStatus(error) {
   if (error == MMS_PDU_ERROR_OK) {
     return MMS_PDU_STATUS_RETRIEVED;
   }
 
   if ((error >= MMS_PDU_ERROR_TRANSIENT_FAILURE)
       && (error < MMS_PDU_ERROR_PERMANENT_FAILURE)) {
     return MMS_PDU_STATUS_DEFERRED;
   }
@@ -35,17 +35,17 @@ function defineLazyRegExp(obj, name, pat
 
 /**
  * Internal decoding function for boolean values.
  *
  * Boolean-value = Yes | No
  * Yes = <Octet 128>
  * No = <Octet 129>
  */
-let BooleanValue = {
+this.BooleanValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Boolean true or false.
    *
    * @throws CodeError if read octet equals to neither 128 nor 129.
    */
@@ -71,17 +71,17 @@ let BooleanValue = {
 
 /**
  * MMS Address
  *
  * address = email | device-address | alphanum-shortcode | num-shortcode
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A section 8
  */
-let Address = {
+this.Address = {
   /**
    * @param data
    *        A wrapped object to store encoded raw data.
    *
    * @return An object of two string-typed attributes: address and type.
    */
   decode: function decode(data) {
     let str = EncodedStringValue.decode(data);
@@ -182,17 +182,17 @@ defineLazyRegExp(Address, "REGEXP_ENCODE
 defineLazyRegExp(Address, "REGEXP_NUM",                "^[\\+*#]\\d+$");
 defineLazyRegExp(Address, "REGEXP_ALPHANUM",           "^\\w+$");
 
 /**
  * Header-field = MMS-header | Application-header
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.2
  */
-let HeaderField = {
+this.HeaderField = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    * @param options
    *        Extra context for decoding.
    *
    * @return A decoded object containing `name` and `value` properties or null
    *         in case of a failed parsing. The `name` property must be a string,
@@ -219,17 +219,17 @@ let HeaderField = {
 };
 
 /**
  * MMS-header = MMS-field-name MMS-value
  * MMS-field-name = Short-integer
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.2
  */
-let MmsHeader = {
+this.MmsHeader = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    * @param options
    *        Extra context for decoding.
    *
    * @return A decoded object containing `name` and `value` properties or null
    *         in case of a failed parsing. The `name` property must be a string,
@@ -295,17 +295,17 @@ let MmsHeader = {
 };
 
 /**
  * Content-class-value = text | image-basic| image-rich | video-basic |
  *                       video-rich | megapixel | content-basic | content-rich
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.9
  */
-let ContentClassValue = {
+this.ContentClassValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A integer value for each class.
    *
    * @throws CodeError if decoded value is not in range 128..135.
    */
@@ -340,17 +340,17 @@ let ContentClassValue = {
  *
  * When used in the M-Mbox-Delete.conf and M-Delete.conf PDU:
  *
  *   Content-location-Del-value = Value-length Status-count-value Content-location-value
  *   Status-count-value = Integer-value
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.10
  */
-let ContentLocationValue = {
+this.ContentLocationValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    * @param options
    *        Extra context for decoding.
    *
    * @return A decoded object containing `uri` and conditional `statusCount`
    *         properties.
@@ -379,17 +379,17 @@ let ContentLocationValue = {
 };
 
 /**
  * Element-Descriptor-value = Value-length Content-Reference-value *(Parameter)
  * Content-Reference-value = Text-string
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.18
  */
-let ElementDescriptorValue = {
+this.ElementDescriptorValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded object containing a string property `contentReference`
    *         and an optinal `params` name-value map.
    */
   decode: function decode(data) {
@@ -417,17 +417,17 @@ let ElementDescriptorValue = {
  * Table 27.` So we can't reuse that of WSP.
  *
  *   Parameter = Parameter-name Parameter-value
  *   Parameter-name = Short-integer | Text-string
  *   Parameter-value = Constrained-encoding | Text-string
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.18
  */
-let Parameter = {
+this.Parameter = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded string.
    *
    * @throws NotWellKnownEncodingError if decoded well-known parameter number
    *         is not registered or supported.
@@ -527,17 +527,17 @@ let Parameter = {
  * The Char-set values are registered by IANA as MIBEnum value and SHALL be
  * encoded as Integer-value.
  *
  *   Encoded-string-value = Text-string | Value-length Char-set Text-string
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.19
  * @see OMA-TS-MMS_CONF-V1_3-20110913-A clause 10.2.1
  */
-let EncodedStringValue = {
+this.EncodedStringValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded string.
    *
    * @throws CodeError if the raw octets cannot be converted.
    * @throws NotWellKnownEncodingError if decoded well-known charset number is
@@ -665,17 +665,17 @@ let EncodedStringValue = {
 
 /**
  * Expiry-value = Value-length (Absolute-token Date-value | Relative-token Delta-seconds-value)
  * Absolute-token = <Octet 128>
  * Relative-token = <Octet 129>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.20
  */
-let ExpiryValue = {
+this.ExpiryValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A Date object for absolute expiry or an integer for relative one.
    *
    * @throws CodeError if decoded token equals to neither 128 nor 129.
    */
@@ -738,17 +738,17 @@ let ExpiryValue = {
 
 /**
  * From-value = Value-length (Address-present-token Address | Insert-address-token)
  * Address-present-token = <Octet 128>
  * Insert-address-token = <Octet 129>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.21
  */
-let FromValue = {
+this.FromValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded Address-value or null for MMS Proxy-Relay Insert-Address
    *         mode.
    *
    * @throws CodeError if decoded token equals to neither 128 nor 129.
@@ -801,17 +801,17 @@ let FromValue = {
 };
 
 /**
  * Previously-sent-by-value = Value-length Forwarded-count-value Address
  * Forwarded-count-value = Integer-value
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.23
  */
-let PreviouslySentByValue = {
+this.PreviouslySentByValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded object containing an integer `forwardedCount` and an
    *         string-typed `originator` attributes.
    */
   decode: function decode(data) {
@@ -831,17 +831,17 @@ let PreviouslySentByValue = {
 };
 
 /**
  * Previously-sent-date-value = Value-length Forwarded-count-value Date-value
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.23
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.24
  */
-let PreviouslySentDateValue = {
+this.PreviouslySentDateValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded object containing an integer `forwardedCount` and an
    *         Date-typed `timestamp` attributes.
    */
   decode: function decode(data) {
@@ -865,17 +865,17 @@ let PreviouslySentDateValue = {
  * Class-identifier = Personal | Advertisement | Informational | Auto
  * Personal = <Octet 128>
  * Advertisement = <Octet 129>
  * Informational = <Octet 130>
  * Auto = <Octet 131>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.27
  */
-let MessageClassValue = {
+this.MessageClassValue = {
   WELL_KNOWN_CLASSES: ["personal", "advertisement", "informational", "auto"],
 
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded string.
    *
@@ -921,17 +921,17 @@ let MessageClassValue = {
   },
 };
 
  /**
  * Message-type-value = <Octet 128..151>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.30
  */
-let MessageTypeValue = {
+this.MessageTypeValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded integer.
    *
    * @throws CodeError if decoded value is not in the range 128..151.
    */
@@ -964,17 +964,17 @@ let MessageTypeValue = {
 /**
  * MM-flags-value = Value-length ( Add-token | Remove-token | Filter-token ) Encoded-string-value
  * Add-token = <Octet 128>
  * Remove-token = <Octet 129>
  * Filter-token = <Octet 130>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.32
  */
-let MmFlagsValue = {
+this.MmFlagsValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded object containing an integer `type` and an string-typed
    *         `text` attributes.
    *
    * @throws CodeError if decoded value is not in the range 128..130.
@@ -1027,17 +1027,17 @@ let MmFlagsValue = {
  * Draft = <Octet 128>
  * Sent = <Octet 129>
  * New = <Octet 130>
  * Retrieved = <Octet 131>
  * Forwarded = <Octet 132>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.33
  */
-let MmStateValue = {
+this.MmStateValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded integer.
    *
    * @throws CodeError if decoded value is not in the range 128..132.
    */
@@ -1070,17 +1070,17 @@ let MmStateValue = {
 /**
  * Priority-value = Low | Normal | High
  * Low = <Octet 128>
  * Normal = <Octet 129>
  * High = <Octet 130>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.35
  */
-let PriorityValue = {
+this.PriorityValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded integer.
    *
    * @throws CodeError if decoded value is not in the range 128..130.
    */
@@ -1109,17 +1109,17 @@ let PriorityValue = {
 };
 
 /**
  * Recommended-Retrieval-Mode-value = Manual
  * Manual = <Octet 128>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.39
  */
-let RecommendedRetrievalModeValue = {
+this.RecommendedRetrievalModeValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded integer.
    */
   decode: function decode(data) {
     return WSP.Octet.decodeEqualTo(data, 128);
@@ -1131,17 +1131,17 @@ let RecommendedRetrievalModeValue = {
  *                        Accepted text only
  * Requested = <Octet 128>
  * Requested text only = <Octet 129>
  * Accepted = <Octet 130>
  * Accepted text only = <Octet 131>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.43
  */
-let ReplyChargingValue = {
+this.ReplyChargingValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded integer.
    *
    * @throws CodeError if decoded value is not in the range 128..131.
    */
@@ -1175,17 +1175,17 @@ let ReplyChargingValue = {
  *   Response-text-value = Encoded-string-value
  *
  * When used in the M-Mbox-Delete.conf and M-Delete.conf PDUs:
  *
  *   Response-text-Del-value = Value-length Status-count-value Response-text-value
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.49
  */
-let ResponseText = {
+this.ResponseText = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    * @param options
    *        Extra context for decoding.
    *
    * @return An object containing a string-typed `text` attribute and a
    *         integer-typed `statusCount` one.
@@ -1227,17 +1227,17 @@ let ResponseText = {
  * Error-transient-network-problem = <Octet 194>
  * Error-permanent-failure = <Octet 224>
  * Error-permanent-service-denied = <Octet 225>
  * Error-permanent-message-not-found = <Octet 226>
  * Error-permanent-content-unsupported = <Octet 227>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.50
  */
-let RetrieveStatusValue = {
+this.RetrieveStatusValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded integer.
    */
   decode: function decode(data) {
     let value = WSP.Octet.decode(data);
@@ -1265,17 +1265,17 @@ let RetrieveStatusValue = {
  * Deferred = <Octet 131>
  * Unrecognised = <Octet 132>
  * Indeterminate = <Octet 133>
  * Forwarded = <Octet 134>
  * Unreachable = <Octet 135>
  *
  * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.54
  */
-let StatusValue = {
+this.StatusValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded integer.
    *
    * @throws CodeError if decoded value is not in the range 128..135.
    */
@@ -1300,17 +1300,17 @@ let StatusValue = {
     if ((value < 128) || (value > 135)) {
       throw new WSP.CodeError("Status-value: invalid status " + value);
     }
 
     WSP.Octet.encode(data, value);
   },
 };
 
-let PduHelper = {
+this.PduHelper = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    * @param headers
    *        An optional object to store parsed header fields. Created
    *        automatically if undefined.
    *
    * @return A boolean value indicating whether it's followed by message body.
@@ -1690,17 +1690,17 @@ let debug;
 if (DEBUG) {
   debug = function (s) {
     dump("-$- MmsPduHelper: " + s + "\n");
   };
 } else {
   debug = function (s) {};
 }
 
-const EXPORTED_SYMBOLS = ALL_CONST_SYMBOLS.concat([
+this.EXPORTED_SYMBOLS = ALL_CONST_SYMBOLS.concat([
   // Utility functions
   "translatePduErrorToStatus",
 
   // Decoders
   "BooleanValue",
   "Address",
   "HeaderField",
   "MmsHeader",
--- a/dom/mms/src/ril/MmsService.js
+++ b/dom/mms/src/ril/MmsService.js
@@ -586,17 +586,17 @@ MmsService.prototype = {
       debug("applyFilter: match " + uri.spec);
       return this.proxyInfo;
     }
 
     return proxyInfo;
   },
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([MmsService]);
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MmsService]);
 
 let debug;
 if (DEBUG) {
   debug = function (s) {
     dump("-@- MmsService: " + s + "\n");
   };
 } else {
   debug = function (s) {};
--- a/dom/mms/src/ril/WapPushManager.js
+++ b/dom/mms/src/ril/WapPushManager.js
@@ -4,24 +4,24 @@
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
-Cu.import("resource://gre/modules/WspPduHelper.jsm");
+Cu.import("resource://gre/modules/WspPduHelper.jsm", this);
 
 const DEBUG = false; // set to true to see debug messages
 
 /**
  * Helpers for WAP PDU processing.
  */
-let WapPushManager = {
+this.WapPushManager = {
 
   /**
    * Parse raw PDU data and deliver to a proper target.
    *
    * @param data
    *        A wrapped object containing raw PDU data.
    * @param options
    *        Extra context for decoding.
@@ -81,12 +81,12 @@ let debug;
 if (DEBUG) {
   debug = function (s) {
     dump("-*- WapPushManager: " + s + "\n");
   };
 } else {
   debug = function (s) {};
 }
 
-const EXPORTED_SYMBOLS = ALL_CONST_SYMBOLS.concat([
+this.EXPORTED_SYMBOLS = ALL_CONST_SYMBOLS.concat([
   "WapPushManager",
 ]);
 
--- a/dom/mms/src/ril/WspPduHelper.jsm
+++ b/dom/mms/src/ril/WspPduHelper.jsm
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
-Cu.import("resource://gre/modules/wap_consts.js");
+Cu.import("resource://gre/modules/wap_consts.js", this);
 
 let DEBUG; // set to true to see debug messages
 
 // Special ASCII characters
 const NUL = 0;
 const CR = 13;
 const LF = 10;
 const SP = 32;
@@ -21,17 +21,17 @@ const DEL = 127;
 
 // Special ASCII character ranges
 const CTLS = 32;
 const ASCIIS = 128;
 
 /**
  * Error class for generic encoding/decoding failures.
  */
-function CodeError(message) {
+this.CodeError = function CodeError(message) {
   this.name = "CodeError";
   this.message = message || "Invalid format";
 }
 CodeError.prototype = new Error();
 CodeError.prototype.constructor = CodeError;
 
 /**
  * Error class for unexpected NUL char at decoding text elements.
@@ -51,17 +51,17 @@ NullCharError.prototype.constructor = Nu
  *
  * This error is only raised when expected format isn't met and the parser
  * context can't do anything more to either skip it or hand over to other
  * alternative encoding/decoding steps.
  *
  * @param message [optional]
  *        A short description for the error.
  */
-function FatalCodeError(message) {
+this.FatalCodeError = function FatalCodeError(message) {
   this.name = "FatalCodeError";
   this.message = message || "Decoding fails";
 }
 FatalCodeError.prototype = new Error();
 FatalCodeError.prototype.constructor = FatalCodeError;
 
 /**
  * Error class for undefined well known encoding.
@@ -71,17 +71,17 @@ FatalCodeError.prototype.constructor = F
  * undefined well known encoding may be followed by a Q-value, which is
  * basically a uintvar. However, there is no way you can distiguish an Q-value
  * 0.64, encoded as 0x41, from a string begins with 'A', which is also 0x41.
  * The `skipValue` will try the latter one, which is not expected.
  *
  * @param message [optional]
  *        A short description for the error.
  */
-function NotWellKnownEncodingError(message) {
+this.NotWellKnownEncodingError = function NotWellKnownEncodingError(message) {
   this.name = "NotWellKnownEncodingError";
   this.message = message || "Not well known encoding";
 }
 NotWellKnownEncodingError.prototype = new FatalCodeError();
 NotWellKnownEncodingError.prototype.constructor = NotWellKnownEncodingError;
 
 /**
  * Internal helper function to retrieve the value of a property with its name
@@ -91,17 +91,17 @@ NotWellKnownEncodingError.prototype.cons
  *        An object that contains parsed header fields.
  * @param name
  *        Header name string to be checked.
  *
  * @return Value of specified header field.
  *
  * @throws FatalCodeError if headers[name] is undefined.
  */
-function ensureHeader(headers, name) {
+this.ensureHeader = function ensureHeader(headers, name) {
   let value = headers[name];
   // Header field might have a null value as NoValue
   if (value === undefined) {
     throw new FatalCodeError("ensureHeader: header " + name + " not defined");
   }
   return value;
 }
 
@@ -125,17 +125,17 @@ function ensureHeader(headers, name) {
  * @param data
  *        A wrapped object containing raw PDU data.
  *
  * @return Skipped value of several possible types like string, integer, or
  *         an array of octets.
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.1.2
  */
-function skipValue(data) {
+this.skipValue = function skipValue(data) {
   let begin = data.offset;
   let value = Octet.decode(data);
   if (value <= 31) {
     if (value == 31) {
       value = UintVar.decode(data);
     }
 
     if (value) {
@@ -160,17 +160,17 @@ function skipValue(data) {
  *
  * @param data
  *        A wrapped object containing raw PDU data.
  * @param options
  *        Extra context for decoding.
  *
  * @return Decoded value.
  */
-function decodeAlternatives(data, options) {
+this.decodeAlternatives = function decodeAlternatives(data, options) {
   let begin = data.offset;
   for (let i = 2; i < arguments.length; i++) {
     try {
       return arguments[i].decode(data, options);
     } catch (e) {
       // Throw the last exception we get
       if (i == (arguments.length - 1)) {
         throw e;
@@ -186,34 +186,34 @@ function decodeAlternatives(data, option
  *
  * @param data
  *        A wrapped object to store encoded raw data.
  * @param value
  *        Object value of arbitrary type to be encoded.
  * @param options
  *        Extra context for encoding.
  */
-function encodeAlternatives(data, value, options) {
+this.encodeAlternatives = function encodeAlternatives(data, value, options) {
   let begin = data.offset;
   for (let i = 3; i < arguments.length; i++) {
     try {
       arguments[i].encode(data, value, options);
       return;
     } catch (e) {
       // Throw the last exception we get
       if (i == (arguments.length - 1)) {
         throw e;
       }
 
       data.offset = begin;
     }
   }
 }
 
-let Octet = {
+this.Octet = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @throws RangeError if no more data is available.
    */
   decode: function decode(data) {
     if (data.offset >= data.array.length) {
@@ -310,17 +310,17 @@ let Octet = {
  * CRLF = CR LF
  * CR = <US-ASCII CR, carriage return (13)>
  * LF = <US-ASCII LF, linefeed (10)>
  * SP = <US-ASCII SP, space (32)>
  * HT = <US-ASCII HT, horizontal-tab(9)>
  *
  * @see RFC 2616 clause 2.2 Basic Rules
  */
-let Text = {
+this.Text = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded character.
    *
    * @throws NullCharError if a NUL character read.
    * @throws CodeError if a control character read.
@@ -394,17 +394,17 @@ let Text = {
     let code = text.charCodeAt(0);
     if ((code < CTLS) || (code == DEL) || (code > 255)) {
       throw new CodeError("Text: invalid char code " + code);
     }
     Octet.encode(data, code);
   },
 };
 
-let NullTerminatedTexts = {
+this.NullTerminatedTexts = {
   /**
    * Decode internal referenced null terminated text string.
    *
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded string.
    */
@@ -438,17 +438,17 @@ let NullTerminatedTexts = {
 
 /**
  * TOKEN = 1*<any CHAR except CTLs or separators>
  * CHAR = <any US-ASCII character (octets 0 - 127)>
  * SEPARATORS = ()<>@,;:\"/[]?={} SP HT
  *
  * @see RFC 2616 clause 2.2 Basic Rules
  */
-let Token = {
+this.Token = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded character.
    *
    * @throws NullCharError if a NUL character read.
    * @throws CodeError if an invalid character read.
@@ -514,17 +514,17 @@ let Token = {
  * mark       = -_.!~*'()
  * escaped    = % hex hex
  * excluded but used = #%
  *
  * Or, in decimal, they are: 33,35-59,61,63-90,95,97-122,126
  *
  * @see RFC 2396 Uniform Resource Indentifiers (URI)
  */
-let URIC = {
+this.URIC = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded character.
    *
    * @throws NullCharError if a NUL character read.
    * @throws CodeError if an invalid character read.
@@ -550,17 +550,17 @@ let URIC = {
  * character must precede it. Otherwise the Quote character must be omitted.
  * The Quote is not part of the contents.
  *
  *   Text-string = [Quote] *TEXT End-of-string
  *   Quote = <Octet 127>
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.1
  */
-let TextString = {
+this.TextString = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded string.
    */
   decode: function decode(data) {
     let begin = data.offset;
@@ -606,17 +606,17 @@ let TextString = {
   },
 };
 
 /**
  * Token-text = Token End-of-string
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.1
  */
-let TokenText = {
+this.TokenText = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded string.
    */
   decode: function decode(data) {
     let str = "";
@@ -649,17 +649,17 @@ let TokenText = {
 /**
  * The TEXT encodes an RFC2616 Quoted-string with the enclosing
  * quotation-marks <"> removed.
  *
  *   Quoted-string = <Octet 34> *TEXT End-of-string
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.1
  */
-let QuotedString = {
+this.QuotedString = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded string.
    *
    * @throws CodeError if first octet read is not 0x34.
    */
@@ -688,17 +688,17 @@ let QuotedString = {
  * Integers in range 0-127 shall be encoded as a one octet value with the
  * most significant bit set to one (1xxx xxxx) and with the value in the
  * remaining least significant bits.
  *
  *   Short-integer = OCTET
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.1
  */
-let ShortInteger = {
+this.ShortInteger = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded integer value.
    *
    * @throws CodeError if the octet read is less than 0x80.
    */
@@ -734,17 +734,17 @@ let ShortInteger = {
  * number of octets must be used to encode the value.
  *
  *   Long-integer = Short-length Multi-octet-integer
  *   Short-length = <Any octet 0-30>
  *   Multi-octet-integer = 1*30 OCTET
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.1
  */
-let LongInteger = {
+this.LongInteger = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    * @param length
    *        Number of octets to read.
    *
    * @return A decoded integer value or an octets array of max 30 elements.
    */
@@ -816,17 +816,17 @@ let LongInteger = {
     Octet.encode(data, array.length);
     Octet.encodeMultiple(data, array);
   },
 };
 
 /**
  * @see WAP-230-WSP-20010705-a clause 8.4.2.1
  */
-let UintVar = {
+this.UintVar = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded integer value.
    */
   decode: function decode(data) {
     let value = Octet.decode(data);
@@ -869,17 +869,17 @@ let UintVar = {
  * encoding, or when the assigned number of the well-known encoding is small
  * enough to fit into Short-Integer.
  *
  *   Constrained-encoding = Extension-Media | Short-integer
  *   Extension-Media = *TEXT End-of-string
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.1
  */
-let ConstrainedEncoding = {
+this.ConstrainedEncoding = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decode integer value or string.
    */
   decode: function decode(data) {
     return decodeAlternatives(data, null, NullTerminatedTexts, ShortInteger);
@@ -903,17 +903,17 @@ let ConstrainedEncoding = {
 /**
  * Value-length = Short-length | (Length-quote Length)
  * Short-length = <Any octet 0-30>
  * Length-quote = <Octet 31>
  * Length = Uintvar-integer
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.2
  */
-let ValueLength = {
+this.ValueLength = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded integer value.
    *
    * @throws CodeError if the first octet read is larger than 31.
    */
@@ -945,17 +945,17 @@ let ValueLength = {
   },
 };
 
 /**
  * No-value = <Octet 0>
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.3
  */
-let NoValue = {
+this.NoValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Always returns null.
    */
   decode: function decode(data) {
     Octet.decodeEqualTo(data, 0);
@@ -976,17 +976,17 @@ let NoValue = {
   },
 };
 
 /**
  * Text-value = No-value | Token-text | Quoted-string
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.3
  */
-let TextValue = {
+this.TextValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded string or null for No-value.
    */
   decode: function decode(data) {
     return decodeAlternatives(data, null, NoValue, TokenText, QuotedString);
@@ -1003,17 +1003,17 @@ let TextValue = {
   },
 };
 
 /**
  * Integer-Value = Short-integer | Long-integer
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.3
  */
-let IntegerValue = {
+this.IntegerValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded integer value or array of octets.
    */
   decode: function decode(data) {
     return decodeAlternatives(data, null, ShortInteger, LongInteger);
@@ -1039,17 +1039,17 @@ let IntegerValue = {
 /**
  * The encoding of dates shall be done in number of seconds from
  * 1970-01-01, 00:00:00 GMT.
  *
  *   Date-value = Long-integer
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.3
  */
-let DateValue = {
+this.DateValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A Date object.
    */
   decode: function decode(data) {
     let numOrArray = LongInteger.decode(data);
@@ -1082,27 +1082,27 @@ let DateValue = {
   },
 };
 
 /**
  * Delta-seconds-value = Integer-value
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.3
  */
-let DeltaSecondsValue = IntegerValue;
+this.DeltaSecondsValue = IntegerValue;
 
 /**
  * Quality factor 0 and quality factors with one or two decimal digits are
  * encoded into 1-100; three digits ones into 101-1099.
  *
  *   Q-value = 1*2 OCTET
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.3
  */
-let QValue = {
+this.QValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded integer value of 1..1099.
    *
    * @throws CodeError if decoded UintVar is not in range 1..1099.
    */
@@ -1148,17 +1148,17 @@ let QValue = {
  * significant bits contain a minor version number in the range 0-14. If
  * there is only a major version number, this is encoded by placing the value
  * 15 in the four least significant bits.
  *
  *   Version-value = Short-integer | Text-string
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.3
  */
-let VersionValue = {
+this.VersionValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Binary encoded version number.
    */
   decode: function decode(data) {
     let begin = data.offset;
@@ -1213,17 +1213,17 @@ let VersionValue = {
  * URI value should be encoded per [RFC2616], but service user may use a
  * different format.
  *
  *   Uri-value = Text-string
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.3
  * @see RFC 2616 clause 2.2 Basic Rules
  */
-let UriValue = {
+this.UriValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded uri string.
    */
   decode: function decode(data) {
     let str = "";
@@ -1240,17 +1240,17 @@ let UriValue = {
 
 /**
  * Internal coder for "type" parameter.
  *
  *   Type-value = Constrained-encoding
  *
  * @see WAP-230-WSP-20010705-a table 38
  */
-let TypeValue = {
+this.TypeValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded content type string.
    */
   decode: function decode(data) {
     let numOrStr = ConstrainedEncoding.decode(data);
@@ -1301,17 +1301,17 @@ let TypeValue = {
  * For Untyped-parameters, the type of the value is unknown, but is shall be
  * encoded as an integer, if that is possible.
  *
  *   Untyped-parameter = Token-text Untyped-value
  *   Untyped-value = Integer-value | Text-value
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.4
  */
-let Parameter = {
+this.Parameter = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded object containing `name` and `value` properties or null
    *         if something wrong. The `name` property must be a string, but the
    *         `value` property can be many different types depending on `name`.
    *
@@ -1495,17 +1495,17 @@ let Parameter = {
 };
 
 /**
  * Header = Message-header | Shift-sequence
  * Message-header = Well-known-header | Application-header
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.6
  */
-let Header = {
+this.Header = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded object containing `name` and `value` properties or null
    *         in case of a failed parsing. The `name` property must be a string,
    *         but the `value` property can be many different types depending on
    *         `name`.
@@ -1546,17 +1546,17 @@ let Header = {
 };
 
 /**
  * Well-known-header = Well-known-field-name Wap-value
  * Well-known-field-name = Short-integer
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.6
  */
-let WellKnownHeader = {
+this.WellKnownHeader = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded object containing `name` and `value` properties or null
    *         in case of a failed parsing. The `name` property must be a string,
    *         but the `value` property can be many different types depending on
    *         `name`.
@@ -1612,17 +1612,17 @@ let WellKnownHeader = {
 };
 
 /**
  * Application-header = Token-text Application-specific-value
  * Application-specific-value = Text-string
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.6
  */
-let ApplicationHeader = {
+this.ApplicationHeader = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded object containing `name` and `value` properties or null
    *         in case of a failed parsing. The `name` property must be a string,
    *         but the `value` property can be many different types depending on
    *         `name`.
@@ -1669,17 +1669,17 @@ let ApplicationHeader = {
 };
 
 /**
  * Field-name = Token-text | Well-known-field-name
  * Well-known-field-name = Short-integer
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.6
  */
-let FieldName = {
+this.FieldName = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A field name string.
    *
    * @throws NotWellKnownEncodingError if decoded well-known header field
    *         number is not registered or supported.
@@ -1721,17 +1721,17 @@ let FieldName = {
 /**
  * Accept-charset-value = Constrained-charset | Accept-charset-general-form
  * Constrained-charset = Any-charset | Constrained-encoding
  * Any-charset = <Octet 128>
  * Accept-charset-general-form = Value-length (Well-known-charset | Token-text) [Q-value]
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.8
  */
-let AcceptCharsetValue = {
+this.AcceptCharsetValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A object with a property `charset` of string "*".
    */
   decodeAnyCharset: function decodeAnyCharset(data) {
     Octet.decodeEqualTo(data, 128);
@@ -1836,17 +1836,17 @@ let AcceptCharsetValue = {
   },
 };
 
 /**
  * Well-known-charset = Any-charset | Integer-value
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.8
  */
-let WellKnownCharset = {
+this.WellKnownCharset = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A object with a string property `charset`.
    *
    * @throws CodeError if decoded charset number is an array.
    * @throws NotWellKnownEncodingError if decoded well-known charset number
@@ -1910,17 +1910,17 @@ let WellKnownCharset = {
  *   Content-general-form = Value-length Media-type
  *   Media-type = Media *(Parameter)
  *   Media = Well-known-media | Extension-Media
  *   Well-known-media = Integer-value
  *   Extension-Media = *TEXT End-of-string
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.24
  */
-let ContentTypeValue = {
+this.ContentTypeValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return A decoded object containing `media` and `params` properties or
    *         null in case of a failed parsing. The `media` property must be a
    *         string, and the `params` property is always null.
    *
@@ -2098,17 +2098,17 @@ let ContentTypeValue = {
 };
 
 /**
  * Application-id-value = Uri-value | App-assigned-code
  * App-assigned-code = Integer-value
  *
  * @see WAP-230-WSP-20010705-a clause 8.4.2.54
  */
-let ApplicationIdValue = {
+this.ApplicationIdValue = {
   /**
    * @param data
    *        A wrapped object containing raw PDU data.
    *
    * @return Decoded string value.
    *
    * @throws CodeError if decoded application id number is an array.
    * @throws NotWellKnownEncodingError if decoded well-known application id
@@ -2134,17 +2134,17 @@ let ApplicationIdValue = {
       throw new NotWellKnownEncodingError(
         "Application-id-value: not well known id: " + id);
     }
 
     return entry.urn;
   },
 };
 
-let PduHelper = {
+this.PduHelper = {
   /**
    * Parse multiple header fields with end mark.
    *
    * @param data
    *        A wrapped object containing raw PDU data.
    * @param end
    *        An ending offset indicating the end of headers.
    * @param headers [optional]
@@ -2375,17 +2375,17 @@ let PduHelper = {
   },
 };
 
 // WSP Header Field Name Assignments
 // Note: Items commented out are either deprecated or not implemented.
 //       Deprecated items should only be supported for backward compatibility
 //       purpose.
 // @see WAP-230-WSP-20010705-a Appendix A. Assigned Numbers.
-const WSP_HEADER_FIELDS = (function () {
+this.WSP_HEADER_FIELDS = (function () {
   let names = {};
   function add(name, number, coder) {
     let entry = {
       name: name,
       number: number,
       coder: coder,
     };
     names[name] = names[number] = entry;
@@ -2471,17 +2471,17 @@ const WSP_HEADER_FIELDS = (function () {
   //add("x-wap-security",       0x46);
   //add("cache-control",        0x47);
 
   return names;
 })();
 
 // WSP Content Type Assignments
 // @see http://www.wapforum.org/wina
-const WSP_WELL_KNOWN_CONTENT_TYPES = (function () {
+this.WSP_WELL_KNOWN_CONTENT_TYPES = (function () {
   let types = {};
 
   function add(type, number) {
     let entry = {
       type: type,
       number: number,
     };
     types[type] = types[number] = entry;
@@ -2499,17 +2499,17 @@ const WSP_WELL_KNOWN_CONTENT_TYPES = (fu
 
   return types;
 })();
 
 // WSP Well-Known Parameter Assignments
 // Note: Items commented out are either deprecated or not implemented.
 //       Deprecated items should not be used.
 // @see WAP-230-WSP-20010705-a Appendix A. Assigned Numbers.
-const WSP_WELL_KNOWN_PARAMS = (function () {
+this.WSP_WELL_KNOWN_PARAMS = (function () {
   let params = {};
 
   function add(name, number, coder) {
     let entry = {
       name: name,
       number: number,
       coder: coder,
     };
@@ -2554,17 +2554,17 @@ const WSP_WELL_KNOWN_PARAMS = (function 
   add("path",              0x1D, TextValue);
 
   return params;
 })();
 
 // WSP Character Set Assignments
 // @see WAP-230-WSP-20010705-a Appendix A. Assigned Numbers.
 // @see http://www.iana.org/assignments/character-sets
-const WSP_WELL_KNOWN_CHARSETS = (function () {
+this.WSP_WELL_KNOWN_CHARSETS = (function () {
   let charsets = {};
 
   function add(name, number, converter) {
     let entry = {
       name: name,
       number: number,
       converter: converter,
     };
@@ -2577,17 +2577,17 @@ const WSP_WELL_KNOWN_CHARSETS = (functio
   add("utf-8",            106, "UTF-8");
   add("windows-1252",    2252, "windows-1252");
 
   return charsets;
 })();
 
 // OMNA PUSH Application ID
 // @see http://www.openmobilealliance.org/tech/omna/omna-push-app-id.aspx
-const OMNA_PUSH_APPLICATION_IDS = (function () {
+this.OMNA_PUSH_APPLICATION_IDS = (function () {
   let ids = {};
 
   function add(urn, number) {
     let entry = {
       urn: urn,
       number: number,
     };
 
@@ -2603,17 +2603,17 @@ let debug;
 if (DEBUG) {
   debug = function (s) {
     dump("-@- WspPduHelper: " + s + "\n");
   };
 } else {
   debug = function (s) {};
 }
 
-const EXPORTED_SYMBOLS = ALL_CONST_SYMBOLS.concat([
+this.EXPORTED_SYMBOLS = ALL_CONST_SYMBOLS.concat([
   // Constant values
   "WSP_HEADER_FIELDS",
   "WSP_WELL_KNOWN_CONTENT_TYPES",
   "WSP_WELL_KNOWN_PARAMS",
   "WSP_WELL_KNOWN_CHARSETS",
   "OMNA_PUSH_APPLICATION_IDS",
 
   // Error classes
@@ -2658,9 +2658,8 @@ const EXPORTED_SYMBOLS = ALL_CONST_SYMBO
   "AcceptCharsetValue",
   "WellKnownCharset",
   "ContentTypeValue",
   "ApplicationIdValue",
 
   // Parser
   "PduHelper",
 ]);
-
--- a/dom/mms/src/ril/mms_consts.js
+++ b/dom/mms/src/ril/mms_consts.js
@@ -1,101 +1,102 @@
 /* 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/. */
 
 // Encoded X-Mms-Message-Type values
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.30
-const MMS_PDU_TYPE_SEND_REQ = 128;
-const MMS_PDU_TYPE_SEND_CONF = 129;
-const MMS_PDU_TYPE_NOTIFICATION_IND = 130;
-const MMS_PDU_TYPE_NOTIFYRESP_IND = 131;
-const MMS_PDU_TYPE_RETRIEVE_CONF = 132;
-const MMS_PDU_TYPE_ACKNOWLEDGE_IND = 133;
-const MMS_PDU_TYPE_DELIVERY_IND = 134;
-const MMS_PDU_TYPE_READ_REC_IND = 135;
-const MMS_PDU_TYPE_READ_ORIG_IND = 136;
-const MMS_PDU_TYPE_FORWARD_REQ = 137;
-const MMS_PDU_TYPE_FORWARD_CONF = 138;
-const MMS_PDU_TYPE_MBOX_STORE_REQ = 139;
-const MMS_PDU_TYPE_MBOX_STORE_CONF = 140;
-const MMS_PDU_TYPE_MBOX_VIEW_REQ = 141;
-const MMS_PDU_TYPE_MBOX_VIEW_CONF = 142;
-const MMS_PDU_TYPE_MBOX_UPLOAD_REQ = 143;
-const MMS_PDU_TYPE_MBOX_UPLOAD_CONF = 144;
-const MMS_PDU_TYPE_MBOX_DELETE_REQ = 145;
-const MMS_PDU_TYPE_MBOX_DELETE_CONF = 146;
-const MMS_PDU_TYPE_MBOX_DESCR = 147;
-const MMS_PDU_TYPE_DELETE_REQ = 148;
-const MMS_PDU_TYPE_DELETE_CONF = 149;
-const MMS_PDU_TYPE_CANCEL_REQ = 150;
-const MMS_PDU_TYPE_CANCEL_CONF = 151;
+this.MMS_PDU_TYPE_SEND_REQ = 128;
+this.MMS_PDU_TYPE_SEND_CONF = 129;
+this.MMS_PDU_TYPE_NOTIFICATION_IND = 130;
+this.MMS_PDU_TYPE_NOTIFYRESP_IND = 131;
+this.MMS_PDU_TYPE_RETRIEVE_CONF = 132;
+this.MMS_PDU_TYPE_ACKNOWLEDGE_IND = 133;
+this.MMS_PDU_TYPE_DELIVERY_IND = 134;
+this.MMS_PDU_TYPE_READ_REC_IND = 135;
+this.MMS_PDU_TYPE_READ_ORIG_IND = 136;
+this.MMS_PDU_TYPE_FORWARD_REQ = 137;
+this.MMS_PDU_TYPE_FORWARD_CONF = 138;
+this.MMS_PDU_TYPE_MBOX_STORE_REQ = 139;
+this.MMS_PDU_TYPE_MBOX_STORE_CONF = 140;
+this.MMS_PDU_TYPE_MBOX_VIEW_REQ = 141;
+this.MMS_PDU_TYPE_MBOX_VIEW_CONF = 142;
+this.MMS_PDU_TYPE_MBOX_UPLOAD_REQ = 143;
+this.MMS_PDU_TYPE_MBOX_UPLOAD_CONF = 144;
+this.MMS_PDU_TYPE_MBOX_DELETE_REQ = 145;
+this.MMS_PDU_TYPE_MBOX_DELETE_CONF = 146;
+this.MMS_PDU_TYPE_MBOX_DESCR = 147;
+this.MMS_PDU_TYPE_DELETE_REQ = 148;
+this.MMS_PDU_TYPE_DELETE_CONF = 149;
+this.MMS_PDU_TYPE_CANCEL_REQ = 150;
+this.MMS_PDU_TYPE_CANCEL_CONF = 151;
 
 // MMS version 1.3
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.34
-const MMS_VERSION = (0x01 << 4) | 0x03;
+this.MMS_VERSION = (0x01 << 4) | 0x03;
 
 // Common Status Values
-const MMS_PDU_ERROR_OK                = 128;
-const MMS_PDU_ERROR_TRANSIENT_FAILURE = 192;
-const MMS_PDU_ERROR_PERMANENT_FAILURE = 224;
+this.MMS_PDU_ERROR_OK                = 128;
+this.MMS_PDU_ERROR_TRANSIENT_FAILURE = 192;
+this.MMS_PDU_ERROR_PERMANENT_FAILURE = 224;
 
 // X-Mms-Response-Status values
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.48
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A Table 28, 29, 30
-//const MMS_PDU_RESPONSE_ERROR_UNSPECIFIED                                 = 129; (obsolete)
-//const MMS_PDU_RESPONSE_ERROR_SERVICE_DENIED                              = 130; (obsolete)
-//const MMS_PDU_RESPONSE_ERROR_MESSAGE_FORMAT_CORRUPT                      = 131; (obsolete)
-//const MMS_PDU_RESPONSE_ERROR_SENDING_ADDRESS_UNRESOLVED                  = 132; (obsolete)
-//const MMS_PDU_RESPONSE_ERROR_MESSAGE_NOT_FOUND                           = 133; (obsolete)
-//const MMS_PDU_RESPONSE_ERROR_NETWORK_PROBLEM                             = 134; (obsolete)
-//const MMS_PDU_RESPONSE_ERROR_CONTENT_NOT_ACCEPTED                        = 135; (obsolete)
-const MMS_PDU_RESPONSE_ERROR_UNSUPPORTED_MESSAGE                           = 136;
-const MMS_PDU_RESPONSE_ERROR_TRANSIENT_SENDING_ADDRESS_UNRESOLVED          = 193;
-const MMS_PDU_RESPONSE_ERROR_TRANSIENT_MESSAGE_NOT_FOUND                   = 194;
-const MMS_PDU_RESPONSE_ERROR_TRANSIENT_NETWORK_PROBLEM                     = 195;
-const MMS_PDU_RESPONSE_ERROR_TRANSIENT_PARTIAL_SUCCESS                     = 196;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_SERVICE_DENIED                      = 225;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT              = 226;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_SENDING_ADDRESS_UNRESOLVED          = 227;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_MESSAGE_NOT_FOUND                   = 228;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_CONTENT_NOT_ACCEPTED                = 229;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_REPLY_CHARGING_LIMITATIONS_NOT_MET  = 230;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_REPLY_CHARGING_REQUEST_NOT_ACCEPTED = 231;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_REPLY_CHARGING_FORWARDING_DENIED    = 232;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_REPLY_CHARGING_NOT_SUPPORTED        = 233;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_ADDRESS_HIDING_NOT_SUPPORTED        = 234;
-const MMS_PDU_RESPONSE_ERROR_PERMANENT_LACK_OF_PREPAID                     = 235;
+//this.MMS_PDU_RESPONSE_ERROR_UNSPECIFIED                                 = 129; (obsolete)
+//this.MMS_PDU_RESPONSE_ERROR_SERVICE_DENIED                              = 130; (obsolete)
+//this.MMS_PDU_RESPONSE_ERROR_MESSAGE_FORMAT_CORRUPT                      = 131; (obsolete)
+//this.MMS_PDU_RESPONSE_ERROR_SENDING_ADDRESS_UNRESOLVED                  = 132; (obsolete)
+//this.MMS_PDU_RESPONSE_ERROR_MESSAGE_NOT_FOUND                           = 133; (obsolete)
+//this.MMS_PDU_RESPONSE_ERROR_NETWORK_PROBLEM                             = 134; (obsolete)
+//this.MMS_PDU_RESPONSE_ERROR_CONTENT_NOT_ACCEPTED                        = 135; (obsolete)
+this.MMS_PDU_RESPONSE_ERROR_UNSUPPORTED_MESSAGE                           = 136;
+this.MMS_PDU_RESPONSE_ERROR_TRANSIENT_SENDING_ADDRESS_UNRESOLVED          = 193;
+this.MMS_PDU_RESPONSE_ERROR_TRANSIENT_MESSAGE_NOT_FOUND                   = 194;
+this.MMS_PDU_RESPONSE_ERROR_TRANSIENT_NETWORK_PROBLEM                     = 195;
+this.MMS_PDU_RESPONSE_ERROR_TRANSIENT_PARTIAL_SUCCESS                     = 196;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_SERVICE_DENIED                      = 225;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT              = 226;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_SENDING_ADDRESS_UNRESOLVED          = 227;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_MESSAGE_NOT_FOUND                   = 228;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_CONTENT_NOT_ACCEPTED                = 229;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_REPLY_CHARGING_LIMITATIONS_NOT_MET  = 230;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_REPLY_CHARGING_REQUEST_NOT_ACCEPTED = 231;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_REPLY_CHARGING_FORWARDING_DENIED    = 232;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_REPLY_CHARGING_NOT_SUPPORTED        = 233;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_ADDRESS_HIDING_NOT_SUPPORTED        = 234;
+this.MMS_PDU_RESPONSE_ERROR_PERMANENT_LACK_OF_PREPAID                     = 235;
 
 // X-Mms-Retrieve-Status values
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.50
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A Table 31
-const MMS_PDU_RETRIEVE_ERROR_TRANSIENT_MESSAGE_NOT_FOUND   = 193;
-const MMS_PDU_RETRIEVE_ERROR_TRANSIENT_NETWORK_PROBLEM     = 194;
-const MMS_PDU_RETRIEVE_ERROR_PERMANENT_SERVICE_DENIED      = 225;
-const MMS_PDU_RETRIEVE_ERROR_PERMANENT_MESSAGE_NOT_FOUND   = 226;
-const MMS_PDU_RETRIEVE_ERROR_PERMANENT_CONTENT_UNSUPPORTED = 227;
+this.MMS_PDU_RETRIEVE_ERROR_TRANSIENT_MESSAGE_NOT_FOUND   = 193;
+this.MMS_PDU_RETRIEVE_ERROR_TRANSIENT_NETWORK_PROBLEM     = 194;
+this.MMS_PDU_RETRIEVE_ERROR_PERMANENT_SERVICE_DENIED      = 225;
+this.MMS_PDU_RETRIEVE_ERROR_PERMANENT_MESSAGE_NOT_FOUND   = 226;
+this.MMS_PDU_RETRIEVE_ERROR_PERMANENT_CONTENT_UNSUPPORTED = 227;
 
 // X-Mms-Store-Status values
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.58
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A Table 35
-const MMS_PDU_STORE_ERROR_TRANSIENT_NETWORK_PROBLEM        = 193;
-const MMS_PDU_STORE_ERROR_PERMANENT_SERVICE_DENIED         = 225;
-const MMS_PDU_STORE_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT = 226;
-const MMS_PDU_STORE_ERROR_PERMANENT_MESSAGE_NOT_FOUND      = 227;
-const MMS_PDU_STORE_ERROR_PERMANENT_MMBOX_FULL             = 228;
+this.MMS_PDU_STORE_ERROR_TRANSIENT_NETWORK_PROBLEM        = 193;
+this.MMS_PDU_STORE_ERROR_PERMANENT_SERVICE_DENIED         = 225;
+this.MMS_PDU_STORE_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT = 226;
+this.MMS_PDU_STORE_ERROR_PERMANENT_MESSAGE_NOT_FOUND      = 227;
+this.MMS_PDU_STORE_ERROR_PERMANENT_MMBOX_FULL             = 228;
 
 // X-Mms-Status values
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.54
-const MMS_PDU_STATUS_EXPIRED       = 128;
-const MMS_PDU_STATUS_RETRIEVED     = 129;
-const MMS_PDU_STATUS_REJECTED      = 130;
-const MMS_PDU_STATUS_DEFERRED      = 131;
-const MMS_PDU_STATUS_UNRECOGNISED  = 132;
-const MMS_PDU_STATUS_INDETERMINATE = 133;
-const MMS_PDU_STATUS_FORWARDED     = 134;
-const MMS_PDU_STATUS_UNREACHABLE   = 135;
+this.MMS_PDU_STATUS_EXPIRED       = 128;
+this.MMS_PDU_STATUS_RETRIEVED     = 129;
+this.MMS_PDU_STATUS_REJECTED      = 130;
+this.MMS_PDU_STATUS_DEFERRED      = 131;
+this.MMS_PDU_STATUS_UNRECOGNISED  = 132;
+this.MMS_PDU_STATUS_INDETERMINATE = 133;
+this.MMS_PDU_STATUS_FORWARDED     = 134;
+this.MMS_PDU_STATUS_UNREACHABLE   = 135;
 
-const ALL_CONST_SYMBOLS = Object.keys(this);
+this.ALL_CONST_SYMBOLS = undefined; // We want ALL_CONST_SYMBOLS to be exported.
+this.ALL_CONST_SYMBOLS = Object.keys(this);
 
 // Allow this file to be imported via Compo