diff --git a/CLOBBER b/CLOBBER index 221cfa2e536..79939c511a1 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,6 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -bug 940506: removing idl files appears to break the build without a clobber +Bug 1033481 - Use a .mozbuild file rather than a .mk in +m/a/tests/background/junit3 -- doesn't clean the classes* directory +when moving from in APK to in JAR building. diff --git a/addon-sdk/source/lib/sdk/base64.js b/addon-sdk/source/lib/sdk/base64.js index 5879a02ffcf..e96dd8534ea 100644 --- a/addon-sdk/source/lib/sdk/base64.js +++ b/addon-sdk/source/lib/sdk/base64.js @@ -11,7 +11,9 @@ module.metadata = { const { Cu } = require("chrome"); // Passing an empty object as second argument to avoid scope's pollution -const { atob, btoa } = Cu.import("resource://gre/modules/Services.jsm", {}); +// (devtools loader injects these symbols as global and prevent using +// const here) +var { atob, btoa } = Cu.import("resource://gre/modules/Services.jsm", {}); function isUTF8(charset) { let type = typeof charset; diff --git a/addon-sdk/source/lib/toolkit/loader.js b/addon-sdk/source/lib/toolkit/loader.js index c73c1ad5bde..bda348c85db 100644 --- a/addon-sdk/source/lib/toolkit/loader.js +++ b/addon-sdk/source/lib/toolkit/loader.js @@ -283,17 +283,31 @@ const load = iced(function load(loader, module) { } }); - let sandbox = sandboxes[module.uri] = Sandbox({ - name: module.uri, - prototype: create(globals, descriptors), - wantXrays: false, - wantGlobalProperties: module.id == "sdk/indexed-db" ? ["indexedDB"] : [], - invisibleToDebugger: loader.invisibleToDebugger, - metadata: { - addonID: loader.id, - URI: module.uri - } - }); + let sandbox; + if (loader.sharedGlobalSandbox && + loader.sharedGlobalBlacklist.indexOf(module.id) == -1) { + // Create a new object in this sandbox, that will be used as + // the scope object for this particular module + sandbox = new loader.sharedGlobalSandbox.Object(); + // Inject all expected globals in the scope object + getOwnPropertyNames(globals).forEach(function(name) { + descriptors[name] = getOwnPropertyDescriptor(globals, name) + }); + define(sandbox, descriptors); + } else { + sandbox = Sandbox({ + name: module.uri, + prototype: create(globals, descriptors), + wantXrays: false, + wantGlobalProperties: module.id == "sdk/indexed-db" ? ["indexedDB"] : [], + invisibleToDebugger: loader.invisibleToDebugger, + metadata: { + addonID: loader.id, + URI: module.uri + } + }); + } + sandboxes[module.uri] = sandbox; try { evaluate(sandbox, module.uri); @@ -691,8 +705,8 @@ const Loader = iced(function Loader(options) { }); let { - modules, globals, resolve, paths, rootURI, - manifest, requireMap, isNative, metadata + modules, globals, resolve, paths, rootURI, manifest, requireMap, isNative, + metadata, sharedGlobal, sharedGlobalBlacklist } = override({ paths: {}, modules: {}, @@ -702,6 +716,7 @@ const Loader = iced(function Loader(options) { resolve: options.isNative ? exports.nodeResolve : exports.resolve, + sharedGlobalBlacklist: ["sdk/indexed-db"] }, options); // We create an identity object that will be dispatched on an unload @@ -738,6 +753,24 @@ const Loader = iced(function Loader(options) { return result; }, {}); + let sharedGlobalSandbox; + if (sharedGlobal) { + // Create the unique sandbox we will be using for all modules, + // so that we prevent creating a new comportment per module. + // The side effect is that all modules will share the same + // global objects. + sharedGlobalSandbox = Sandbox({ + name: "Addon-SDK", + wantXrays: false, + wantGlobalProperties: [], + invisibleToDebugger: options.invisibleToDebugger || false, + metadata: { + addonID: options.id, + URI: "Addon-SDK" + } + }); + } + // Loader object is just a representation of a environment // state. We freeze it and mark make it's properties non-enumerable // as they are pure implementation detail that no one should rely upon. @@ -748,6 +781,8 @@ const Loader = iced(function Loader(options) { // Map of module objects indexed by module URIs. modules: { enumerable: false, value: modules }, metadata: { enumerable: false, value: metadata }, + sharedGlobalSandbox: { enumerable: false, value: sharedGlobalSandbox }, + sharedGlobalBlacklist: { enumerable: false, value: sharedGlobalBlacklist }, // Map of module sandboxes indexed by module URIs. sandboxes: { enumerable: false, value: {} }, resolve: { enumerable: false, value: resolve }, diff --git a/addon-sdk/source/test/test-loader.js b/addon-sdk/source/test/test-loader.js index 4ddcc00883c..03ea1b3e0a1 100644 --- a/addon-sdk/source/test/test-loader.js +++ b/addon-sdk/source/test/test-loader.js @@ -343,4 +343,27 @@ exports['test console global by default'] = function (assert) { function fakeConsole () {}; }; +exports['test shared globals'] = function(assert) { + let uri = root + '/fixtures/loader/cycles/'; + let loader = Loader({ paths: { '': uri }, sharedGlobal: true, + sharedGlobalBlacklist: ['b'] }); + + let program = main(loader, 'main'); + + // As it is hard to verify what is the global of an object + // (due to wrappers) we check that we see the `foo` symbol + // being manually injected into the shared global object + loader.sharedGlobalSandbox.foo = true; + + let m = loader.sandboxes[uri + 'main.js']; + let a = loader.sandboxes[uri + 'a.js']; + let b = loader.sandboxes[uri + 'b.js']; + + assert.ok(Cu.getGlobalForObject(m).foo, "main is shared"); + assert.ok(Cu.getGlobalForObject(a).foo, "a is shared"); + assert.ok(!Cu.getGlobalForObject(b).foo, "b isn't shared"); + + unload(loader); +} + require('test').run(exports); diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js index ea94ceb40f0..f29de04e91e 100644 --- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -9,7 +9,6 @@ Cu.import('resource://gre/modules/SettingsChangeNotifier.jsm'); Cu.import('resource://gre/modules/DataStoreChangeNotifier.jsm'); Cu.import('resource://gre/modules/AlarmService.jsm'); Cu.import('resource://gre/modules/ActivitiesService.jsm'); -Cu.import('resource://gre/modules/PermissionPromptHelper.jsm'); Cu.import('resource://gre/modules/NotificationDB.jsm'); Cu.import('resource://gre/modules/Payment.jsm'); Cu.import("resource://gre/modules/AppsUtils.jsm"); diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 0b16e2da563..5aba8f5eeb6 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,13 +19,13 @@ - + - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index c2d47a92600..6bba9f9ba8b 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,10 +17,10 @@ - + - + @@ -128,7 +128,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index c89c913fc7d..9942471605d 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + @@ -23,7 +23,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 0b16e2da563..5aba8f5eeb6 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,13 +19,13 @@ - + - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index b85ff724df6..cc384eaa598 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,10 +17,10 @@ - + - + diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 8655d50f8d3..1b751b151bd 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "3e612bc9b3d79a3fa36d2f38af4202abb0ead68f", + "revision": "190172ac413ab6476a6d7df3999950ec756f96a4", "repo_path": "/integration/gaia-central" } diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 332a3d657d7..2053ab0c8aa 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,12 +17,12 @@ - + - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index ecad1f8aeea..a04b3138050 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 78f96f25673..90a10f563ce 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,10 +17,10 @@ - + - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 384a9ec720e..a55ec3feb2c 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,12 +17,12 @@ - + - + diff --git a/browser/components/preferences/content.xul b/browser/components/preferences/content.xul index 89ad253a4e8..fcddb544f3d 100644 --- a/browser/components/preferences/content.xul +++ b/browser/components/preferences/content.xul @@ -149,10 +149,11 @@ label="&translateWebPages.label;." accesskey="&translateWebPages.accesskey;" onsyncfrompreference="return gContentPane.updateButtons('translateButton', 'browser.translation.detectLanguage');"/> - + +