Bug 834699 - Fix tests that munge dom.xbl_scopes. r=bz

This commit is contained in:
Bobby Holley 2013-05-02 16:02:04 -07:00
parent b279cd48ba
commit 23a2145399
2 changed files with 7 additions and 25 deletions

View File

@ -32,9 +32,7 @@ var url = 'data:text/html;charset=utf-8,' +
encodeURIComponent('<div id=t style="-moz-binding:url(' + location + '#xbl)"></div>');
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({set: [['dom.xbl_scopes', true]]}, test1);
});
addLoadEvent(test1);
function test1() {
var iframe = document.createElement('iframe');
@ -46,21 +44,6 @@ function test1() {
is(t.textContent, "true",
"getUserData and setUserData should be visible from XBL");
document.body.removeChild(iframe);
SpecialPowers.pushPrefEnv({set: [['dom.xbl_scopes', false]]}, test2);
};
document.body.appendChild(iframe);
}
function test2() {
var iframe = document.createElement('iframe');
iframe.src = url;
iframe.onload = function() {
var t = iframe.contentWindow.t;
is(!!(t.getUserData && t.setUserData), true,
"getUserData and setUserData is visible if XBL scopes are disabled");
is(t.textContent, "true",
"getUserData and setUserData should be visible from XBL");
document.body.removeChild(iframe);
SimpleTest.finish();
};
document.body.appendChild(iframe);

View File

@ -13,14 +13,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=821850
/** Test for XBL scope behavior. **/
SimpleTest.waitForExplicitFinish();
// The XBL scope pref is read when a global is constructed, so we need to set
// it before loading the test.
function setup() {
SpecialPowers.pushPrefEnv({set: [['dom.xbl_scopes', true]] }, continueSetup);
}
// Embed the real test. It will take care of everything else.
function continueSetup() {
//
// NB: This two-layer setup used to exist because XBL scopes were behind a
// pref, and we wanted to make sure that we properly set the pref before
// loading the real test. This stuff is no longer behind a pref, but we just
// leave the structure as-is for expediency.
function setup() {
$('ifr').setAttribute('src', 'file_bug821850.xhtml');
}