Bug 1311247 - Avoid using unsafe CPOWs in browser_perwindow_privateBrowsing.js; r=mrbkap

This commit is contained in:
Ehsan Akhgari 2016-10-18 22:55:12 -04:00
Родитель 9512e2b48d
Коммит 5caff82499
4 изменённых файлов: 19 добавлений и 16 удалений

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

@ -19,7 +19,7 @@
let event = yield undefined;
if (event.type == "success") {
testResult = event.target.result;
testResult = event.target.result instanceof IDBDatabase;
}
else {
testException = event.target.error.name;

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

@ -24,8 +24,8 @@ function test1()
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result instanceof IDBDatabase,
setFinishedCallback(function(isIDBDatabase, exception) {
ok(isIDBDatabase,
"First database creation was successful");
ok(!exception, "No exception");
is(getPermission(testPageURL, "indexedDB"),
@ -60,8 +60,8 @@ function test2()
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result instanceof IDBDatabase,
setFinishedCallback(function(isIDBDatabase, exception) {
ok(isIDBDatabase,
"First database creation was successful");
ok(!exception, "No exception");
is(getPermission(testPageURL, "indexedDB"),

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

@ -25,8 +25,8 @@ function test1()
}
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result instanceof IDBDatabase,
setFinishedCallback(function(isIDBDatabase, exception) {
ok(isIDBDatabase,
"First database creation was successful");
ok(!exception, "No exception");
gBrowser.removeCurrentTab();
@ -57,8 +57,8 @@ function test3(win)
}
win.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(!result, "No database");
setFinishedCallback(function(isIDBDatabase, exception) {
ok(!isIDBDatabase, "No database");
is(exception, "InvalidStateError", "Correct exception");
win.gBrowser.removeCurrentTab();

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

@ -92,13 +92,16 @@ function setFinishedCallback(callback, win)
if (!win) {
win = window;
}
let testPage = win.gBrowser.selectedBrowser.contentWindow.wrappedJSObject;
testPage.testFinishedCallback = function(result, exception) {
setTimeout(function() {
ContentTask.spawn(win.gBrowser.selectedBrowser, null, function*() {
return yield new Promise(resolve => {
content.wrappedJSObject.testFinishedCallback = (result, exception) => {
info("got finished callback");
resolve({result, exception});
};
});
}).then(({result, exception}) => {
callback(result, exception);
}, 0);
}
});
}
function dispatchEvent(eventName)