зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1171285 - Part 2: Fix test_app_protocol.html to finish both index.html and controlled.html tests; r=jdm
This commit is contained in:
Родитель
8fa914ff17
Коммит
ca699d4bcb
Двоичные данные
dom/workers/test/serviceworkers/app-protocol/application.zip
Двоичные данные
dom/workers/test/serviceworkers/app-protocol/application.zip
Двоичный файл не отображается.
|
@ -7,7 +7,6 @@
|
|||
function registerServiceWorker() {
|
||||
return new Promise((resolve, reject) => {
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
ready();
|
||||
resolve();
|
||||
});
|
||||
navigator.serviceWorker.register('sw.js', {scope: '.'})
|
||||
|
@ -22,7 +21,7 @@ function runTests() {
|
|||
return Promise.resolve()
|
||||
.then(() => { return testFetchAppResource('networkresponse'); })
|
||||
.then(registerServiceWorker)
|
||||
.then(done);
|
||||
.then(ready);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -22,7 +22,6 @@ const appManifestURL =
|
|||
let gApp;
|
||||
|
||||
function setup() {
|
||||
info('Setting up');
|
||||
return new Promise((resolve, reject) => {
|
||||
SpecialPowers.setAllAppsLaunchable(true);
|
||||
SpecialPowers.pushPrefEnv({'set': [
|
||||
|
@ -75,9 +74,15 @@ function launchApp() {
|
|||
iframe.setAttribute('mozapp', gApp.manifestURL);
|
||||
iframe.addEventListener('mozbrowsershowmodalprompt', function listener(e) {
|
||||
let message = e.detail.message;
|
||||
if (/READY/.exec(message)) {
|
||||
if (/OK/.exec(message)) {
|
||||
ok(true, "Message from app: " + message);
|
||||
} else if (/KO/.exec(message)) {
|
||||
ok(false, "Message from app: " + message);
|
||||
} else if (/READY/.exec(message)) {
|
||||
ok(true, "Message from app: " + message);
|
||||
resolve();
|
||||
} else {
|
||||
ok(false, "Unexpected message received: " + message);
|
||||
}
|
||||
}, false);
|
||||
let domParent = document.getElementById('container');
|
||||
|
@ -88,14 +93,12 @@ function launchApp() {
|
|||
}
|
||||
|
||||
function loadControlled() {
|
||||
info("reloading");
|
||||
return new Promise((resolve, reject) => {
|
||||
let iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', 'true');
|
||||
iframe.setAttribute('mozapp', gApp.manifestURL);
|
||||
iframe.addEventListener('mozbrowsershowmodalprompt', function listener(e) {
|
||||
let message = e.detail.message;
|
||||
info(message);
|
||||
if (/OK/.exec(message)) {
|
||||
ok(true, "Message from app: " + message);
|
||||
} else if (/KO/.exec(message)) {
|
||||
|
@ -106,13 +109,14 @@ function loadControlled() {
|
|||
let domParent = document.getElementById('container');
|
||||
domParent.removeChild(iframe);
|
||||
resolve();
|
||||
} else {
|
||||
ok(false, "Unexpected message received: " + message);
|
||||
}
|
||||
}, false);
|
||||
let domParent = document.getElementById('container');
|
||||
domParent.appendChild(iframe);
|
||||
SpecialPowers.wrap(iframe.contentWindow).location =
|
||||
gApp.origin + '/controlled.html';
|
||||
info("reloaded");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче