mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Integrate service worker manager thread
This commit is contained in:
parent
e8fa02a07f
commit
1e6293ea1d
39 changed files with 764 additions and 582 deletions
BIN
tests/html/service-worker/assets/tty.gif
Normal file
BIN
tests/html/service-worker/assets/tty.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
14
tests/html/service-worker/dashboard-page.html
Normal file
14
tests/html/service-worker/dashboard-page.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Dashboard Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<a href="/">Back to home</a>
|
||||
<h3>The dashboard page</h3>
|
||||
<a href="http://github.com/servo/servo">Servo Project</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
13
tests/html/service-worker/demo_iframe.html
Normal file
13
tests/html/service-worker/demo_iframe.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>An iframe</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<a href="http://github.com/servo/servo">Servo Project</a>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
1
tests/html/service-worker/dummy.js
Normal file
1
tests/html/service-worker/dummy.js
Normal file
|
@ -0,0 +1 @@
|
|||
console.log("dummy test file");
|
1
tests/html/service-worker/iframe_sw.js
Normal file
1
tests/html/service-worker/iframe_sw.js
Normal file
|
@ -0,0 +1 @@
|
|||
console.log("iframe service worker active");
|
43
tests/html/service-worker/index.html
Normal file
43
tests/html/service-worker/index.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Service Worker Tests</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>This page tests the registration and initialization of Service Workers in Servo.</p>
|
||||
<div id="registration">
|
||||
<a href="/dashboard-page.html">Go to Dashboard</a>
|
||||
<a href="/profile.html">Go to Profile</a>
|
||||
<iframe id="iframe_sw" width="" height="200"></iframe>
|
||||
<br>
|
||||
<button onclick="register_zero()">Register for Root</button>
|
||||
<button onclick="register_one()">Register for Dashboard</button>
|
||||
<button onclick="register_two()">Register for Profile</button>
|
||||
</div>
|
||||
<script>
|
||||
var reg = navigator.serviceWorker.register('iframe_sw.js', { 'scope': '/demo_iframe.html' });
|
||||
console.log("From client worker registered: ", navigator.serviceWorker.controller);
|
||||
console.log("Registered script source: ", navigator.serviceWorker.controller.scriptURL);
|
||||
document.getElementById('iframe_sw').src = 'demo_iframe.html';
|
||||
|
||||
function register_zero() {
|
||||
var reg = navigator.serviceWorker.register('sw.js', { 'scope': './' });
|
||||
console.log("From client worker registered: ", navigator.serviceWorker.controller);
|
||||
console.log("Registered script source: ", navigator.serviceWorker.controller.scriptURL);
|
||||
}
|
||||
|
||||
function register_one() {
|
||||
var reg = navigator.serviceWorker.register('sw_dashboard.js', { 'scope': '/dashboard' });
|
||||
console.log("From client worker registered: ", navigator.serviceWorker.controller);
|
||||
console.log("Registered script source: ", navigator.serviceWorker.controller.scriptURL);
|
||||
}
|
||||
|
||||
function register_two() {
|
||||
var reg = navigator.serviceWorker.register('sw_profile.js', { 'scope': '/profile' });
|
||||
console.log("From client worker registered: ", navigator.serviceWorker.controller);
|
||||
console.log("Registered script source: ", navigator.serviceWorker.controller.scriptURL);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
14
tests/html/service-worker/profile.html
Normal file
14
tests/html/service-worker/profile.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Profile Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<a href="/">Back to home</a>
|
||||
<h3>The profile page</h3>
|
||||
<a href="http://github.com/servo/servo">Servo Project</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
1
tests/html/service-worker/sw.js
Normal file
1
tests/html/service-worker/sw.js
Normal file
|
@ -0,0 +1 @@
|
|||
console.log("root service worker: active");
|
2
tests/html/service-worker/sw_dashboard.js
Normal file
2
tests/html/service-worker/sw_dashboard.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
importScripts('dummy.js');
|
||||
console.log("dashboard service worker: active");
|
1
tests/html/service-worker/sw_profile.js
Normal file
1
tests/html/service-worker/sw_profile.js
Normal file
|
@ -0,0 +1 @@
|
|||
console.log("profile service worker: active");
|
Loading…
Add table
Add a link
Reference in a new issue