22 lines
753 B
JavaScript
22 lines
753 B
JavaScript
/**
|
|
* SharedWorker test for importScripts() with absolute local:// URLs.
|
|
*/
|
|
console.log('[Abs-Import-Test] Worker script executing');
|
|
console.log('[Abs-Import-Test] self.location.href:', self.location.href);
|
|
|
|
// Try importScripts with an absolute local:// URL
|
|
try {
|
|
importScripts('local:///home/user/lt/sovereign_browser/tests/local-site/shared-worker-test.js');
|
|
console.log('[Abs-Import-Test] Absolute local:// importScripts succeeded');
|
|
} catch (e) {
|
|
console.log('[Abs-Import-Test] Absolute local:// importScripts FAILED:', e.message);
|
|
}
|
|
|
|
self.onconnect = function(e) {
|
|
var port = e.ports[0];
|
|
port.postMessage('worker_ready');
|
|
port.onmessage = function(e) {
|
|
if (e.data === 'ping') port.postMessage('pong');
|
|
};
|
|
};
|