mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout f938930b3ac5 (Bug 1161684) for M4 perma-failures on opt. r=backout
This commit is contained in:
parent
5da31e3168
commit
97dc01d530
@ -1,2 +0,0 @@
|
||||
application.zip contains foo.txt, index.html, sw.js and manifest.webapp.
|
||||
Any change to one of these three files should be added to application.zip as well.
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
networkresponse
|
@ -1,58 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test app for bug 1161684</title>
|
||||
<script type='application/javascript;version=1.7'>
|
||||
function ok(aCondition, aMessage) {
|
||||
if (aCondition) {
|
||||
alert('OK: ' + aMessage);
|
||||
} else {
|
||||
alert('KO: ' + aMessage);
|
||||
}
|
||||
}
|
||||
|
||||
function done() {
|
||||
alert('DONE');
|
||||
}
|
||||
|
||||
function testFetchAppResource(aExpectedResponse) {
|
||||
return fetch('foo.txt').then(res => {
|
||||
ok(true, 'fetch should resolve');
|
||||
if (res.type == 'error') {
|
||||
ok(false, 'fetch failed');
|
||||
}
|
||||
ok(res.status == 200, 'status should be 200');
|
||||
ok(res.statusText == 'OK', 'statusText should be OK');
|
||||
return res.text().then(body => {
|
||||
ok(body == aExpectedResponse, 'body should match');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function registerServiceWorkerAndClaim() {
|
||||
return new Promise((resolve, reject) => {
|
||||
navigator.serviceWorker.register('sw.js', {scope: '.'})
|
||||
.then(registration => {
|
||||
ok(true, 'service worker registered');
|
||||
navigator.serviceWorker.oncontrollerchange = () => {
|
||||
ok(true, 'client controlled');
|
||||
resolve();
|
||||
};
|
||||
registration.active.postMessage('claim');
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
return Promise.resolve()
|
||||
.then(() => { return testFetchAppResource('networkresponse'); })
|
||||
.then(registerServiceWorkerAndClaim)
|
||||
.then(() => { return testFetchAppResource('swresponse'); })
|
||||
.then(done)
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload='runTests()'>
|
||||
</body>
|
||||
</html>
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "App",
|
||||
"launch_path": "/index.html",
|
||||
"description": "Test app for bug 1161684"
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
self.addEventListener('fetch', (event) => {
|
||||
if (event.request.url.indexOf('foo.txt') >= 0) {
|
||||
var body = 'swresponse';
|
||||
event.respondWith(new Response(body, {
|
||||
headers: {'Content-Type': 'text/plain'}
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
self.addEventListener('message', () => {
|
||||
clients.claim();
|
||||
});
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "App",
|
||||
"launch_path": "/index.html",
|
||||
"description": "Test app for bug 1161684",
|
||||
"package_path": "application.zip"
|
||||
}
|
@ -1 +0,0 @@
|
||||
Content-Type: application/manifest+json
|
@ -97,7 +97,6 @@ support-files =
|
||||
claim_worker_2.js
|
||||
claim_clients/client.html
|
||||
claim_fetch_worker.js
|
||||
app-protocol/*
|
||||
|
||||
[test_unregister.html]
|
||||
[test_installation_simple.html]
|
||||
@ -135,5 +134,4 @@ support-files =
|
||||
[test_sanitize.html]
|
||||
[test_sanitize_domain.html]
|
||||
[test_service_worker_allowed.html]
|
||||
[test_app_protocol.html]
|
||||
[test_claim_fetch.html]
|
||||
|
@ -1,124 +0,0 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1161684 - Allow JAR channels to be intercepted by service workers</title>
|
||||
<script type='text/javascript' src='/tests/SimpleTest/SimpleTest.js'></script>
|
||||
<link rel='stylesheet' type='text/css' href='/tests/SimpleTest/test.css' />
|
||||
</head>
|
||||
<body onload='runTests()'>
|
||||
<p id='display'></p>
|
||||
<div id='content' style='display: none'></div>
|
||||
<pre id='test'></pre>
|
||||
<script class='testbody' type='application/javascript;version=1.7'>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const appManifestURL =
|
||||
'http://mochi.test:8888/tests/dom/workers/test/serviceworkers/app-protocol/update.webapp';
|
||||
let gApp;
|
||||
|
||||
function setup() {
|
||||
info('Setting up');
|
||||
return new Promise((resolve, reject) => {
|
||||
SpecialPowers.setAllAppsLaunchable(true);
|
||||
SpecialPowers.pushPrefEnv({'set': [
|
||||
['dom.mozBrowserFramesEnabled', true],
|
||||
['dom.serviceWorkers.exemptFromPerDomainMax', true],
|
||||
['dom.serviceWorkers.enabled', true],
|
||||
['dom.serviceWorkers.testing.enabled', true]
|
||||
]}, () => {
|
||||
SpecialPowers.pushPermissions([
|
||||
{ 'type': 'webapps-manage', 'allow': 1, 'context': document },
|
||||
{ 'type': 'browser', 'allow': 1, 'context': document },
|
||||
{ 'type': 'embed-apps', 'allow': 1, 'context': document }
|
||||
], () => {
|
||||
SpecialPowers.autoConfirmAppInstall(() => {
|
||||
SpecialPowers.autoConfirmAppUninstall(resolve);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function installApp() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let req = navigator.mozApps.installPackage(appManifestURL);
|
||||
req.onsuccess = function() {
|
||||
gApp = req.result;
|
||||
is(req.result.manifestURL, appManifestURL, 'app installed');
|
||||
if (req.result.installState == 'installed') {
|
||||
is(req.result.installState, 'installed', 'app downloaded');
|
||||
resolve()
|
||||
} else {
|
||||
req.result.ondownloadapplied = function() {
|
||||
is(req.result.installState, 'installed', 'app downloaded');
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
}
|
||||
req.onerror = reject;
|
||||
});
|
||||
}
|
||||
|
||||
function launchApp() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!gApp) {
|
||||
ok(false, 'No test application to launch');
|
||||
reject();
|
||||
}
|
||||
|
||||
let iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', 'true');
|
||||
iframe.setAttribute('mozapp', gApp.manifestURL);
|
||||
let domParent = document.getElementById('container');
|
||||
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)) {
|
||||
ok(false, "Message from app: " + message);
|
||||
} else if (/DONE/.exec(message)) {
|
||||
ok(true, "Messaging from app complete");
|
||||
iframe.removeEventListener('mozbrowsershowmodalprompt', listener);
|
||||
domParent.removeChild(iframe);
|
||||
resolve();
|
||||
}
|
||||
}, false);
|
||||
domParent.appendChild(iframe);
|
||||
SpecialPowers.wrap(iframe.contentWindow).location =
|
||||
gApp.origin + gApp.manifest.launch_path;
|
||||
});
|
||||
}
|
||||
|
||||
function uninstallApp() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!gApp) {
|
||||
return reject();
|
||||
}
|
||||
let req = navigator.mozApps.mgmt.uninstall(gApp);
|
||||
req.onsuccess = resolve;
|
||||
req.onerror = reject;
|
||||
});
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
setup()
|
||||
.then(installApp)
|
||||
.then(launchApp)
|
||||
.then(uninstallApp)
|
||||
.then(SimpleTest.finish)
|
||||
.catch((e) => {
|
||||
ok(false, 'Unexpected error ' + e.target.error.name);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
<div id='container'></div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user