Bug 1558298: Part 5 - Let ChromePowers.js handle its own SpecialPowers imports. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D34594

--HG--
extra : rebase_source : 3e96cb3372833bc84de491ccbea8e26e84fad27c
extra : source : f94500dd11e38ba34310216d958943d6ef07ce96
This commit is contained in:
Kris Maglione 2019-06-10 14:15:47 -07:00
Родитель cb781b9e5b
Коммит cc17dab6b6
5 изменённых файлов: 5 добавлений и 11 удалений

Просмотреть файл

@ -8,10 +8,6 @@
onload="setTimeout(nextTest, 0);"
title="bug 293235 test">
<script>
ChromeUtils.import("resource://specialpowers/SpecialPowersAPI.jsm", this);
</script>
<script src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />

Просмотреть файл

@ -8,10 +8,6 @@
onload="setTimeout(nextTest, 0);"
title="bug 396649 test">
<script>
ChromeUtils.import("resource://specialpowers/SpecialPowersAPI.jsm", this);
</script>
<script src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />

Просмотреть файл

@ -396,8 +396,6 @@ function Tester(aTests, structuredLogger, aCallback) {
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", this.cpowEventUtils);
var simpleTestScope = {};
ChromeUtils.import("resource://specialpowers/SpecialPowersAPI.jsm", simpleTestScope);
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js", simpleTestScope);
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromePowers.js", simpleTestScope);
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/SimpleTest.js", simpleTestScope);
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/MemoryStats.js", simpleTestScope);

Просмотреть файл

@ -48,7 +48,6 @@ FINAL_TARGET_FILES.content.tests.SimpleTest += [
'../../docshell/test/chrome/docshell_helpers.js',
'../modules/StructuredLog.jsm',
'../specialpowers/content/MozillaLogger.js',
'../specialpowers/content/SpecialPowersObserverAPI.js',
'tests/SimpleTest/AsyncUtilsContent.js',
'tests/SimpleTest/ChromePowers.js',
'tests/SimpleTest/EventUtils.js',

Просмотреть файл

@ -2,6 +2,8 @@
* 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/. */
ChromeUtils.import("resource://specialpowers/SpecialPowersAPI.jsm", this);
function ChromePowers(window) {
this.window = Cu.getWeakReference(window);
@ -110,6 +112,9 @@ if ((window.parent !== null) &&
!(window.wrappedJSObject.SpecialPowers)) {
window.wrappedJSObject.SpecialPowers = window.parent.SpecialPowers;
} else {
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.scriptloader.loadSubScript("resource://specialpowers/SpecialPowersObserverAPI.js", this);
window.wrappedJSObject.SpecialPowers = new ChromePowers(window);
}