Bug 1091706 - Ensure spawning only one devtools loader instances. r=jryans

This commit is contained in:
Alexandre Poirot 2014-11-17 12:47:35 -08:00
parent 48c371fd07
commit ce9a02c1da
3 changed files with 24 additions and 1 deletions

View File

@ -269,7 +269,9 @@ DevToolsLoader.prototype = {
* @see setProvider
*/
require: function() {
this._chooseProvider();
if (!this._provider) {
this._chooseProvider();
}
return this.require.apply(this, arguments);
},

View File

@ -0,0 +1,20 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test devtools.require
// Ensure that DevtoolsLoader.require doesn't spawn multiple
// loader/modules when early cached
function testBug1091706() {
let loader = new DevToolsLoader();
let require = loader.require;
let color1 = require("devtools/css-color");
let color2 = require("devtools/css-color");
do_check_true(color1 === color2);
}
function run_test() {
testBug1091706();
}

View File

@ -12,3 +12,4 @@ support-files =
[test_async-utils.js]
[test_consoleID.js]
[test_require_lazy.js]
[test_require.js]