mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1402317 - Remove dom.abortController.enabled and dom.abortController.fetch.enabled prefs, r=qdot
This commit is contained in:
parent
afe9dcf6ff
commit
04cd5ddc32
@ -22,44 +22,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AbortController)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
/* static */ bool
|
||||
AbortController::IsEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.abortController.enabled", false);
|
||||
}
|
||||
|
||||
using namespace workers;
|
||||
|
||||
// Otherwise, check the pref via the WorkerPrivate
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->AbortControllerEnabled();
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
AbortController::IsEnabledInFetch(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return IsEnabled(aCx, aGlobal) &&
|
||||
Preferences::GetBool("dom.abortController.fetch.enabled", false);
|
||||
}
|
||||
|
||||
using namespace workers;
|
||||
|
||||
// Otherwise, check the pref via the WorkerPrivate
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->AbortControllerEnabled() &&
|
||||
workerPrivate->AbortControllerEnabledInFetch();
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<AbortController>
|
||||
AbortController::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
|
||||
{
|
||||
|
@ -26,12 +26,6 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AbortController)
|
||||
|
||||
static bool
|
||||
IsEnabled(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
static bool
|
||||
IsEnabledInFetch(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
static already_AddRefed<AbortController>
|
||||
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
<script>
|
||||
function ok(a, msg) {
|
||||
parent.postMessage({ type: "check", status: !!a, message: msg }, "*");
|
||||
}
|
||||
|
||||
function is(a, b, msg) {
|
||||
ok(a === b, msg);
|
||||
}
|
||||
|
||||
function testWebIDL() {
|
||||
ok("AbortController" in self, "We have a AbortController prototype");
|
||||
ok("AbortSignal" in self, "We have a AbortSignal prototype");
|
||||
|
||||
var ac = new AbortController();
|
||||
ok(!!ac, "AbortController can be created");
|
||||
ok(ac instanceof AbortController, "AbortController is a AbortController");
|
||||
|
||||
ok(!!ac.signal, "AbortController has a signal");
|
||||
ok(ac.signal instanceof AbortSignal, "abortSignal is a AbortSignal");
|
||||
is(ac.signal.aborted, false, "By default AbortSignal.aborted is false");
|
||||
next();
|
||||
}
|
||||
|
||||
function testUpdateData() {
|
||||
var ac = new AbortController();
|
||||
|
||||
is(ac.signal.aborted, false, "By default AbortSignal.aborted is false");
|
||||
|
||||
ac.abort();
|
||||
is(ac.signal.aborted, true, "Signal is aborted");
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
function testAbortEvent() {
|
||||
var ac = new AbortController();
|
||||
ac.signal.onabort = function(e) {
|
||||
is(e.type, "abort", "Abort received");
|
||||
next();
|
||||
}
|
||||
ac.abort();
|
||||
}
|
||||
|
||||
var steps = [
|
||||
// Simple stuff
|
||||
testWebIDL,
|
||||
testUpdateData,
|
||||
|
||||
// Event propagation
|
||||
testAbortEvent,
|
||||
];
|
||||
|
||||
function next() {
|
||||
if (!steps.length) {
|
||||
parent.postMessage({ type: "finish" }, "*");
|
||||
return;
|
||||
}
|
||||
|
||||
var step = steps.shift();
|
||||
step();
|
||||
}
|
||||
|
||||
next();
|
||||
|
||||
</script>
|
@ -1,72 +0,0 @@
|
||||
<script>
|
||||
function ok(a, msg) {
|
||||
parent.postMessage({ type: "check", status: !!a, message: msg }, "*");
|
||||
}
|
||||
|
||||
function is(a, b, msg) {
|
||||
ok(a === b, msg);
|
||||
}
|
||||
|
||||
function testAbortedFetch() {
|
||||
var ac = new AbortController();
|
||||
ac.abort();
|
||||
|
||||
fetch("slow.sjs", { signal: ac.signal }).then(() => {
|
||||
ok(false, "Fetch should not return a resolved promise");
|
||||
}, e => {
|
||||
is(e.name, "AbortError", "We have an abort error");
|
||||
}).then(next);
|
||||
}
|
||||
|
||||
function testFetchAndAbort() {
|
||||
var ac = new AbortController();
|
||||
|
||||
var p = fetch("slow.sjs", { signal: ac.signal });
|
||||
ac.abort();
|
||||
|
||||
p.then(() => {
|
||||
ok(false, "Fetch should not return a resolved promise");
|
||||
}, e => {
|
||||
is(e.name, "AbortError", "We have an abort error");
|
||||
}).then(next);
|
||||
}
|
||||
|
||||
function testWorkerAbortedFetch() {
|
||||
var w = new Worker("worker_abort_controller_fetch.js");
|
||||
w.onmessage = function(e) {
|
||||
ok(e.data, "Abort + Fetch works in workers");
|
||||
next();
|
||||
}
|
||||
w.postMessage("testWorkerAbortedFetch");
|
||||
}
|
||||
|
||||
function testWorkerFetchAndAbort() {
|
||||
var w = new Worker("worker_abort_controller_fetch.js");
|
||||
w.onmessage = function(e) {
|
||||
ok(e.data, "Abort + Fetch works in workers");
|
||||
next();
|
||||
}
|
||||
w.postMessage("testWorkerFetchAndAbort");
|
||||
}
|
||||
|
||||
var steps = [
|
||||
// fetch + signaling
|
||||
testAbortedFetch,
|
||||
testFetchAndAbort,
|
||||
testWorkerAbortedFetch,
|
||||
testWorkerFetchAndAbort,
|
||||
];
|
||||
|
||||
function next() {
|
||||
if (!steps.length) {
|
||||
parent.postMessage({ type: "finish" }, "*");
|
||||
return;
|
||||
}
|
||||
|
||||
var step = steps.shift();
|
||||
step();
|
||||
}
|
||||
|
||||
next();
|
||||
|
||||
</script>
|
@ -1,7 +1,5 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
file_abort_controller.html
|
||||
file_abort_controller_fetch.html
|
||||
worker_abort_controller_fetch.js
|
||||
slow.sjs
|
||||
|
||||
|
@ -12,27 +12,61 @@
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.abortController.enabled", true ]]}, () => {
|
||||
let ifr = document.createElement("iframe");
|
||||
ifr.src = "file_abort_controller.html";
|
||||
document.body.appendChild(ifr);
|
||||
function testWebIDL() {
|
||||
ok("AbortController" in self, "We have a AbortController prototype");
|
||||
ok("AbortSignal" in self, "We have a AbortSignal prototype");
|
||||
|
||||
window.onmessage = function(e) {
|
||||
if (e.data.type == "finish") {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
var ac = new AbortController();
|
||||
ok(!!ac, "AbortController can be created");
|
||||
ok(ac instanceof AbortController, "AbortController is a AbortController");
|
||||
|
||||
if (e.data.type == "check") {
|
||||
ok(e.data.status, e.data.message);
|
||||
return;
|
||||
}
|
||||
ok(!!ac.signal, "AbortController has a signal");
|
||||
ok(ac.signal instanceof AbortSignal, "abortSignal is a AbortSignal");
|
||||
is(ac.signal.aborted, false, "By default AbortSignal.aborted is false");
|
||||
next();
|
||||
}
|
||||
|
||||
ok(false, "Something when wrong.");
|
||||
function testUpdateData() {
|
||||
var ac = new AbortController();
|
||||
|
||||
is(ac.signal.aborted, false, "By default AbortSignal.aborted is false");
|
||||
|
||||
ac.abort();
|
||||
is(ac.signal.aborted, true, "Signal is aborted");
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
function testAbortEvent() {
|
||||
var ac = new AbortController();
|
||||
ac.signal.onabort = function(e) {
|
||||
is(e.type, "abort", "Abort received");
|
||||
next();
|
||||
}
|
||||
});
|
||||
ac.abort();
|
||||
}
|
||||
|
||||
var steps = [
|
||||
// Simple stuff
|
||||
testWebIDL,
|
||||
testUpdateData,
|
||||
|
||||
// Event propagation
|
||||
testAbortEvent,
|
||||
];
|
||||
|
||||
function next() {
|
||||
if (!steps.length) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var step = steps.shift();
|
||||
step();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
next();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -12,28 +12,68 @@
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.abortController.enabled", true ],
|
||||
["dom.abortController.fetch.enabled", true]]}, () => {
|
||||
let ifr = document.createElement("iframe");
|
||||
ifr.src = "file_abort_controller_fetch.html";
|
||||
document.body.appendChild(ifr);
|
||||
function testAbortedFetch() {
|
||||
var ac = new AbortController();
|
||||
ac.abort();
|
||||
|
||||
window.onmessage = function(e) {
|
||||
if (e.data.type == "finish") {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
fetch("slow.sjs", { signal: ac.signal }).then(() => {
|
||||
ok(false, "Fetch should not return a resolved promise");
|
||||
}, e => {
|
||||
is(e.name, "AbortError", "We have an abort error");
|
||||
}).then(next);
|
||||
}
|
||||
|
||||
if (e.data.type == "check") {
|
||||
ok(e.data.status, e.data.message);
|
||||
return;
|
||||
}
|
||||
function testFetchAndAbort() {
|
||||
var ac = new AbortController();
|
||||
|
||||
ok(false, "Something when wrong.");
|
||||
var p = fetch("slow.sjs", { signal: ac.signal });
|
||||
ac.abort();
|
||||
|
||||
p.then(() => {
|
||||
ok(false, "Fetch should not return a resolved promise");
|
||||
}, e => {
|
||||
is(e.name, "AbortError", "We have an abort error");
|
||||
}).then(next);
|
||||
}
|
||||
|
||||
function testWorkerAbortedFetch() {
|
||||
var w = new Worker("worker_abort_controller_fetch.js");
|
||||
w.onmessage = function(e) {
|
||||
ok(e.data, "Abort + Fetch works in workers");
|
||||
next();
|
||||
}
|
||||
});
|
||||
w.postMessage("testWorkerAbortedFetch");
|
||||
}
|
||||
|
||||
function testWorkerFetchAndAbort() {
|
||||
var w = new Worker("worker_abort_controller_fetch.js");
|
||||
w.onmessage = function(e) {
|
||||
ok(e.data, "Abort + Fetch works in workers");
|
||||
next();
|
||||
}
|
||||
w.postMessage("testWorkerFetchAndAbort");
|
||||
}
|
||||
|
||||
var steps = [
|
||||
// fetch + signaling
|
||||
testAbortedFetch,
|
||||
testFetchAndAbort,
|
||||
testWorkerAbortedFetch,
|
||||
testWorkerFetchAndAbort,
|
||||
];
|
||||
|
||||
function next() {
|
||||
if (!steps.length) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var step = steps.shift();
|
||||
step();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
next();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -12,9 +12,7 @@
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.fetchObserver.enabled", true ],
|
||||
["dom.abortController.enabled", true ],
|
||||
["dom.abortController.fetch.enabled", true ]]}, () => {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.fetchObserver.enabled", true ]]}, () => {
|
||||
let ifr = document.createElement('iframe');
|
||||
ifr.src = "file_fetch_observer.html";
|
||||
document.body.appendChild(ifr);
|
||||
|
@ -7,8 +7,7 @@
|
||||
* https://dom.spec.whatwg.org/#abortcontroller
|
||||
*/
|
||||
|
||||
[Constructor(), Exposed=(Window,Worker),
|
||||
Func="AbortController::IsEnabled"]
|
||||
[Constructor(), Exposed=(Window,Worker)]
|
||||
interface AbortController {
|
||||
readonly attribute AbortSignal signal;
|
||||
|
||||
|
@ -7,8 +7,7 @@
|
||||
* https://dom.spec.whatwg.org/#abortsignal
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker),
|
||||
Func="AbortController::IsEnabled"]
|
||||
[Exposed=(Window,Worker)]
|
||||
interface AbortSignal : EventTarget {
|
||||
readonly attribute boolean aborted;
|
||||
|
||||
|
@ -27,8 +27,7 @@ interface Request {
|
||||
readonly attribute RequestRedirect redirect;
|
||||
readonly attribute DOMString integrity;
|
||||
|
||||
[Func="AbortController::IsEnabledInFetch",
|
||||
BinaryName="getOrCreateSignal"]
|
||||
[BinaryName="getOrCreateSignal"]
|
||||
readonly attribute AbortSignal signal;
|
||||
|
||||
[Throws,
|
||||
@ -52,7 +51,6 @@ dictionary RequestInit {
|
||||
RequestRedirect redirect;
|
||||
DOMString integrity;
|
||||
|
||||
[Func="AbortController::IsEnabledInFetch"]
|
||||
AbortSignal? signal;
|
||||
|
||||
[Func="FetchObserver::IsEnabled"]
|
||||
|
@ -42,8 +42,6 @@ WORKER_SIMPLE_PREF("dom.requestcontext.enabled", RequestContextEnabled, REQUESTC
|
||||
WORKER_SIMPLE_PREF("gfx.offscreencanvas.enabled", OffscreenCanvasEnabled, OFFSCREENCANVAS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.webkitBlink.dirPicker.enabled", WebkitBlinkDirectoryPickerEnabled, DOM_WEBKITBLINK_DIRPICKER_WEBKITBLINK)
|
||||
WORKER_SIMPLE_PREF("dom.netinfo.enabled", NetworkInformationEnabled, NETWORKINFORMATION_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.abortController.enabled", AbortControllerEnabled, ABORTCONTROLLER_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.abortController.fetch.enabled", AbortControllerEnabledInFetch, ABORTCONTROLLER_FETCH_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.fetchObserver.enabled", FetchObserverEnabled, FETCHOBSERVER_ENABLED)
|
||||
WORKER_SIMPLE_PREF("privacy.resistFingerprinting", ResistFingerprintingEnabled, RESISTFINGERPRINTING_ENABLED)
|
||||
WORKER_SIMPLE_PREF("devtools.enabled", DevToolsEnabled, DEVTOOLS_ENABLED)
|
||||
|
@ -5075,12 +5075,6 @@ pref("dom.battery.enabled", true);
|
||||
// Streams API
|
||||
pref("dom.streams.enabled", false);
|
||||
|
||||
// Abort API
|
||||
pref("dom.abortController.enabled", true);
|
||||
|
||||
// Fetch + Abort API
|
||||
pref("dom.abortController.fetch.enabled", true);
|
||||
|
||||
// Push
|
||||
|
||||
pref("dom.push.enabled", false);
|
||||
|
@ -1 +0,0 @@
|
||||
prefs: [dom.abortController.enabled:true]
|
@ -1 +0,0 @@
|
||||
prefs: [dom.abortController.enabled:true]
|
@ -1,4 +1,2 @@
|
||||
prefs: [javascript.options.streams:true,
|
||||
dom.abortController.enabled:true,
|
||||
dom.abortController.fetch.enabled:true,
|
||||
dom.streams.enabled:true]
|
||||
|
Loading…
Reference in New Issue
Block a user