mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1207635 - get rid of dom.workers.sharedWorkers.enabled pref, r=khuey
This commit is contained in:
parent
5db9fb32b7
commit
1020a98af9
@ -9,17 +9,7 @@
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
||||
"test/test-console-workers.html";
|
||||
|
||||
function pushPrefEnv() {
|
||||
let deferred = promise.defer();
|
||||
let options = {
|
||||
set: [["dom.workers.sharedWorkers.enabled", true]]
|
||||
};
|
||||
SpecialPowers.pushPrefEnv(options, deferred.resolve);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
var test = asyncTest(function*() {
|
||||
yield pushPrefEnv();
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
let hud = yield openConsole();
|
||||
|
@ -44,7 +44,7 @@ function runTests() {
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.workers.sharedWorkers.enabled", true]]}, runTests);
|
||||
runTests();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -4,8 +4,7 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[Pref="dom.workers.sharedWorkers.enabled",
|
||||
Constructor(DOMString scriptURL, optional DOMString name)]
|
||||
[Constructor(DOMString scriptURL, optional DOMString name)]
|
||||
interface SharedWorker : EventTarget {
|
||||
readonly attribute MessagePort port;
|
||||
};
|
||||
|
@ -16,23 +16,21 @@
|
||||
// This test is full of dummy debug messages. This is because I need to follow
|
||||
// an hard-to-reproduce timeout failure.
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]] }, function() {
|
||||
info("test started");
|
||||
var sw = new SharedWorker('bug1132395_sharedWorker.js');
|
||||
sw.port.onmessage = function(event) {
|
||||
info("sw.onmessage received");
|
||||
ok(true, "We didn't crash.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
info("test started");
|
||||
var sw = new SharedWorker('bug1132395_sharedWorker.js');
|
||||
sw.port.onmessage = function(event) {
|
||||
info("sw.onmessage received");
|
||||
ok(true, "We didn't crash.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
sw.onerror = function(event) {
|
||||
ok(false, "Failed to create a ServiceWorker");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
sw.onerror = function(event) {
|
||||
ok(false, "Failed to create a ServiceWorker");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
info("sw.postmessage called");
|
||||
sw.port.postMessage('go');
|
||||
});
|
||||
info("sw.postmessage called");
|
||||
sw.port.postMessage('go');
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -15,15 +15,10 @@
|
||||
<pre id="test"></pre>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]] }, function() {
|
||||
new SharedWorker('sharedWorker_sharedWorker.js');
|
||||
new SharedWorker('sharedWorker_sharedWorker.js', ':');
|
||||
new SharedWorker('sharedWorker_sharedWorker.js', '|||');
|
||||
ok(true, "3 SharedWorkers created!");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
new SharedWorker('sharedWorker_sharedWorker.js');
|
||||
new SharedWorker('sharedWorker_sharedWorker.js', ':');
|
||||
new SharedWorker('sharedWorker_sharedWorker.js', '|||');
|
||||
ok(true, "3 SharedWorkers created!");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -47,10 +47,7 @@
|
||||
}
|
||||
|
||||
var cl = new consoleListener();
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]] }, function() {
|
||||
new SharedWorker('sharedWorker_console.js');
|
||||
});
|
||||
new SharedWorker('sharedWorker_console.js');
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -11,8 +11,6 @@
|
||||
<script class="testbody" type="text/javascript;version=1.7">
|
||||
"use strict";
|
||||
|
||||
const swPref = "dom.workers.sharedWorkers.enabled";
|
||||
|
||||
const basePath =
|
||||
location.pathname.substring(0,
|
||||
location.pathname.lastIndexOf("/") + 1);
|
||||
@ -30,13 +28,6 @@
|
||||
let testGenerator = (function() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
if (!SpecialPowers.getBoolPref(swPref)) {
|
||||
ok(!("SharedWorker" in window), "No SharedWorker without pref set");
|
||||
}
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [[swPref, true]] }, sendToGenerator);
|
||||
yield undefined;
|
||||
|
||||
window.addEventListener("message", function(event) {
|
||||
if (typeof(event.data) == "string") {
|
||||
info(event.data);
|
||||
|
@ -11,7 +11,6 @@
|
||||
<script class="testbody" type="text/javascript;version=1.7">
|
||||
"use strict";
|
||||
|
||||
const swPref = "dom.workers.sharedWorkers.enabled";
|
||||
const scrollbarPref = "layout.testing.overlay-scrollbars.always-visible";
|
||||
const bfCacheEnabledPref = "browser.sessionhistory.cache_subframes";
|
||||
const bfCacheDepthPref = "browser.sessionhistory.max_total_viewers";
|
||||
@ -23,16 +22,11 @@
|
||||
let testGenerator = (function() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
if (!SpecialPowers.getBoolPref(swPref)) {
|
||||
ok(!("SharedWorker" in window), "No SharedWorker without pref set");
|
||||
}
|
||||
|
||||
// Enable SharedWorkers and force scrollbar to always be shown. The
|
||||
// scrollbar setting is necessary to avoid the fade-in/fade-out from
|
||||
// evicting our document from the BF cache below. If bug 1049277
|
||||
// is fixed, then we can stop setting the scrollbar pref here.
|
||||
SpecialPowers.pushPrefEnv({ set: [[swPref, true],
|
||||
[scrollbarPref, true]] },
|
||||
// Force scrollbar to always be shown. The scrollbar setting is
|
||||
// necessary to avoid the fade-in/fade-out from evicting our document
|
||||
// from the BF cache below. If bug 1049277 is fixed, then we can
|
||||
// stop setting the scrollbar pref here.
|
||||
SpecialPowers.pushPrefEnv({ set: [[scrollbarPref, true]] },
|
||||
sendToGenerator);
|
||||
yield undefined;
|
||||
|
||||
|
@ -17,8 +17,6 @@
|
||||
<script class="testbody">
|
||||
"use strict";
|
||||
|
||||
const swPref = "dom.workers.sharedWorkers.enabled";
|
||||
|
||||
const href = window.location.href;
|
||||
const filename = "sharedWorker_sharedWorker.js";
|
||||
const sentMessage = "ping";
|
||||
@ -27,49 +25,43 @@
|
||||
const errorLine = 86;
|
||||
const errorColumn = 0;
|
||||
|
||||
if (!SpecialPowers.getBoolPref(swPref)) {
|
||||
ok(!("SharedWorker" in window), "No SharedWorker without pref set");
|
||||
}
|
||||
var worker = new SharedWorker(filename);
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [[swPref, true]] }, function() {
|
||||
var worker = new SharedWorker(filename);
|
||||
ok(worker instanceof SharedWorker, "Got SharedWorker instance");
|
||||
ok(!("postMessage" in worker), "SharedWorker has no 'postMessage'");
|
||||
ok(worker.port instanceof MessagePort,
|
||||
"Shared worker has MessagePort");
|
||||
|
||||
ok(worker instanceof SharedWorker, "Got SharedWorker instance");
|
||||
ok(!("postMessage" in worker), "SharedWorker has no 'postMessage'");
|
||||
ok(worker.port instanceof MessagePort,
|
||||
"Shared worker has MessagePort");
|
||||
var receivedMessage;
|
||||
var receivedError;
|
||||
|
||||
var receivedMessage;
|
||||
var receivedError;
|
||||
worker.port.onmessage = function(event) {
|
||||
ok(event instanceof MessageEvent, "Got a MessageEvent");
|
||||
ok(event.target === worker.port,
|
||||
"MessageEvent has correct 'target' property");
|
||||
is(event.data, sentMessage, "Got correct message");
|
||||
ok(receivedMessage === undefined, "Haven't gotten message yet");
|
||||
receivedMessage = event.data;
|
||||
if (receivedError) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
|
||||
worker.port.onmessage = function(event) {
|
||||
ok(event instanceof MessageEvent, "Got a MessageEvent");
|
||||
ok(event.target === worker.port,
|
||||
"MessageEvent has correct 'target' property");
|
||||
is(event.data, sentMessage, "Got correct message");
|
||||
ok(receivedMessage === undefined, "Haven't gotten message yet");
|
||||
receivedMessage = event.data;
|
||||
if (receivedError) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
worker.onerror = function(event) {
|
||||
ok(event instanceof ErrorEvent, "Got an ErrorEvent");
|
||||
is(event.message, "Error: " + sentMessage, "Got correct error");
|
||||
is(event.filename, errorFilename, "Got correct filename");
|
||||
is(event.lineno, errorLine, "Got correct lineno");
|
||||
is(event.colno, errorColumn, "Got correct column");
|
||||
ok(receivedError === undefined, "Haven't gotten error yet");
|
||||
receivedError = event.message;
|
||||
event.preventDefault();
|
||||
if (receivedMessage) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
|
||||
worker.onerror = function(event) {
|
||||
ok(event instanceof ErrorEvent, "Got an ErrorEvent");
|
||||
is(event.message, "Error: " + sentMessage, "Got correct error");
|
||||
is(event.filename, errorFilename, "Got correct filename");
|
||||
is(event.lineno, errorLine, "Got correct lineno");
|
||||
is(event.colno, errorColumn, "Got correct column");
|
||||
ok(receivedError === undefined, "Haven't gotten error yet");
|
||||
receivedError = event.message;
|
||||
event.preventDefault();
|
||||
if (receivedMessage) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
|
||||
worker.port.postMessage(sentMessage);
|
||||
});
|
||||
worker.port.postMessage(sentMessage);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -13,18 +13,16 @@
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var gced = false;
|
||||
SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]]},
|
||||
function() {
|
||||
var sw = new SharedWorker('sharedWorker_lifetime.js');
|
||||
sw.port.onmessage = function(event) {
|
||||
ok(gced, "The SW is still alive also after GC");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
sw = null;
|
||||
SpecialPowers.forceGC();
|
||||
gced = true;
|
||||
});
|
||||
var sw = new SharedWorker('sharedWorker_lifetime.js');
|
||||
sw.port.onmessage = function(event) {
|
||||
ok(gced, "The SW is still alive also after GC");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
sw = null;
|
||||
SpecialPowers.forceGC();
|
||||
gced = true;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
|
@ -12,17 +12,14 @@
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]]},
|
||||
function() {
|
||||
var sw = new SharedWorker('sharedworker_performance_user_timing.js');
|
||||
sw.port.onmessage = function(event) {
|
||||
if (event.data.type == 'finish') {
|
||||
SimpleTest.finish();
|
||||
} else if (event.data.type == 'status') {
|
||||
ok(event.data.status, event.data.msg);
|
||||
}
|
||||
var sw = new SharedWorker('sharedworker_performance_user_timing.js');
|
||||
sw.port.onmessage = function(event) {
|
||||
if (event.data.type == 'finish') {
|
||||
SimpleTest.finish();
|
||||
} else if (event.data.type == 'status') {
|
||||
ok(event.data.status, event.data.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
|
@ -12,28 +12,25 @@
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]]},
|
||||
function() {
|
||||
var sw1 = new SharedWorker('sharedWorker_ports.js');
|
||||
sw1.port.onmessage = function(event) {
|
||||
if (event.data.type == "connected") {
|
||||
ok(true, "The SharedWorker is alive.");
|
||||
var sw1 = new SharedWorker('sharedWorker_ports.js');
|
||||
sw1.port.onmessage = function(event) {
|
||||
if (event.data.type == "connected") {
|
||||
ok(true, "The SharedWorker is alive.");
|
||||
|
||||
var sw2 = new SharedWorker('sharedWorker_ports.js');
|
||||
sw1.port.postMessage("Port from the main-thread!", [sw2.port]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.data.type == "status") {
|
||||
ok(event.data.test, event.data.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.data.type == "finish") {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
var sw2 = new SharedWorker('sharedWorker_ports.js');
|
||||
sw1.port.postMessage("Port from the main-thread!", [sw2.port]);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
if (event.data.type == "status") {
|
||||
ok(event.data.test, event.data.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.data.type == "finish") {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
|
@ -92,7 +92,6 @@ function runTest() {
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["dom.workers.sharedWorkers.enabled", true],
|
||||
["browser.startup.page", 0],
|
||||
["browser.startup.homepage_override.mstone", "ignore"],
|
||||
]}, runTest);
|
||||
|
@ -13,17 +13,14 @@
|
||||
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]]},
|
||||
function() {
|
||||
var sw = new SharedWorker('webSocket_sharedWorker.js');
|
||||
sw.port.onmessage = function(event) {
|
||||
if (event.data.type == 'finish') {
|
||||
SimpleTest.finish();
|
||||
} else if (event.data.type == 'status') {
|
||||
ok(event.data.status, event.data.msg);
|
||||
}
|
||||
var sw = new SharedWorker('webSocket_sharedWorker.js');
|
||||
sw.port.onmessage = function(event) {
|
||||
if (event.data.type == 'finish') {
|
||||
SimpleTest.finish();
|
||||
} else if (event.data.type == 'status') {
|
||||
ok(event.data.status, event.data.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -146,9 +146,6 @@ pref("dom.workers.enabled", true);
|
||||
// The number of workers per domain allowed to run concurrently.
|
||||
pref("dom.workers.maxPerDomain", 20);
|
||||
|
||||
// Whether or not Shared Web Workers are enabled.
|
||||
pref("dom.workers.sharedWorkers.enabled", true);
|
||||
|
||||
pref("dom.serviceWorkers.enabled", false);
|
||||
|
||||
// Allow service workers to intercept network requests using the fetch event
|
||||
|
Loading…
Reference in New Issue
Block a user