Backed out 2 changesets (bug 1750284, bug 1750634) for causing wpt failures at global.html. CLOSED TREE

Backed out changeset 00d4eefcf59b (bug 1750634)
Backed out changeset 118975879e05 (bug 1750284)
This commit is contained in:
Butkovits Atila 2022-02-02 01:40:54 +02:00
Родитель f144f24866
Коммит d9654d9638
8 изменённых файлов: 10 добавлений и 197 удалений

Просмотреть файл

@ -7,7 +7,7 @@
* https://streams.spec.whatwg.org/#rbs-controller-class-definition
*/
[Exposed=(Window,Worker,Worklet), Pref="dom.streams.readable_byte_stream_controller.enabled"]
[Exposed=(Window,Worker,Worklet), Pref="dom.streams.expose.ReadableByteStreamController"]
interface ReadableByteStreamController {
[Throws] // Throws on OOM
readonly attribute ReadableStreamBYOBRequest? byobRequest;

Просмотреть файл

@ -1,4 +1,4 @@
[Exposed=(Window,Worker,Worklet), Pref="dom.streams.readable_stream_byob_reader.enabled"]
[Exposed=(Window,Worker,Worklet), Pref="dom.streams.expose.ReadableStreamBYOBReader"]
interface ReadableStreamBYOBReader {
[Throws]
constructor(ReadableStream stream);

Просмотреть файл

@ -7,7 +7,7 @@
* https://streams.spec.whatwg.org/#rs-byob-request-class-definition
*/
[Exposed=(Window,Worker,Worklet), Pref="dom.streams.readable_stream_byob_request.enabled"]
[Exposed=(Window,Worker,Worklet), Pref="dom.streams.expose.ReadableStreamBYOBRequest"]
interface ReadableStreamBYOBRequest {
readonly attribute ArrayBufferView? view;

Просмотреть файл

@ -7,7 +7,7 @@
* https://streams.spec.whatwg.org/#rs-default-controller-class-definition
*/
[Exposed=(Window,Worker,Worklet), Pref="dom.streams.readable_stream_default_controller.enabled"]
[Exposed=(Window,Worker,Worklet), Pref="dom.streams.expose.ReadableStreamDefaultController"]
interface ReadableStreamDefaultController {
readonly attribute unrestricted double? desiredSize;

Просмотреть файл

@ -20,7 +20,7 @@ interface mixin ReadableStreamGenericReader {
};
[Exposed=(Window,Worker,Worklet),
Pref="dom.streams.readable_stream_default_reader.enabled"]
Pref="dom.streams.expose.ReadableStreamDefaultReader"]
interface ReadableStreamDefaultReader {
[Throws]
constructor(ReadableStream stream);

Просмотреть файл

@ -3595,27 +3595,27 @@
## Exposure Prefs: To ensure the DOM Streams don't expose more
# than existing JS Streams implementation, we want to hide some
# interfaces from the global until later.
- name: dom.streams.readable_byte_stream_controller.enabled
- name: dom.streams.expose.ReadableByteStreamController
type: RelaxedAtomicBool
value: false
mirror: always
- name: dom.streams.readable_stream_byob_reader.enabled
- name: dom.streams.expose.ReadableStreamBYOBReader
type: RelaxedAtomicBool
value: false
mirror: always
- name: dom.streams.readable_stream_byob_request.enabled
- name: dom.streams.expose.ReadableStreamBYOBRequest
type: RelaxedAtomicBool
value: false
mirror: always
- name: dom.streams.readable_stream_default_controller.enabled
- name: dom.streams.expose.ReadableStreamDefaultController
type: RelaxedAtomicBool
value: false
mirror: always
- name: dom.streams.readable_stream_default_reader.enabled
- name: dom.streams.expose.ReadableStreamDefaultReader
type: RelaxedAtomicBool
value: false
mirror: always

Просмотреть файл

@ -1,25 +0,0 @@
[global.html]
prefs: [dom.streams.readable_stream_default_reader.enabled:true, dom.streams.readable_stream_default_controller.enabled:true]
[Stream Objects Created in expected globals]
expected:
if not domstreams: FAIL
[Cancel promise is created in same global as stream]
expected:
if not domstreams: FAIL
[Closed Promise in correct global]
expected:
if not domstreams: FAIL
[Reader objects in correct global]
expected:
if not domstreams: FAIL
[Desired size can be grafted from one prototype to another]
expected:
if not domstreams: FAIL
[Tee Branches in correct global]
expected:
if not domstreams: FAIL

Просмотреть файл

@ -1,162 +0,0 @@
<!doctype html>
<meta charset="utf-8">
<title>Ensure Stream objects are created in expected globals. </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body></body>
<script>
// These tests are loosely derived from Gecko's readable-stream-globals.js,
// which is a test case designed around the JS Streams implementation.
//
// Unlike in JS Streams, where function calls switch realms and change
// the resulting global of the resulting objects, in WebIDL streams,
// the global of an object is (currently underspecified, but) intended
// to be the "Relevant Global" of the 'this' object.
//
// See:
// https://html.spec.whatwg.org/multipage/webappapis.html#relevant
// https://github.com/whatwg/streams/issues/1213
"use strict"
const iframe = document.createElement("iframe")
document.body.append(iframe)
const otherGlobal = iframe.contentWindow;
const OtherReadableStream = otherGlobal.ReadableStream
const OtherReadableStreamDefaultReader = otherGlobal.ReadableStreamDefaultReader;
const OtherReadableStreamDefaultController = otherGlobal.ReadableStreamDefaultController;
promise_test(async () => {
// Controllers
let controller;
let otherController;
// Get Stream Prototypes and controllers.
let streamController;
let stream = new ReadableStream({start(c) { streamController = c; }});
const callReaderThisGlobal = OtherReadableStream.prototype.getReader.call(stream);
const newReaderOtherGlobal = new OtherReadableStreamDefaultReader(new ReadableStream());
// Relevant Global Checking.
assert_equals(callReaderThisGlobal instanceof ReadableStreamDefaultReader, true, "reader was created in this global (.call)");
assert_equals(newReaderOtherGlobal instanceof ReadableStreamDefaultReader, false, "reader was created in other global (new)");
assert_equals(callReaderThisGlobal instanceof OtherReadableStreamDefaultReader, false, "reader isn't coming from other global (.call)" );
assert_equals(newReaderOtherGlobal instanceof OtherReadableStreamDefaultReader, true, "reader isn't coming from other global (new)");
assert_equals(otherController instanceof ReadableStreamDefaultController, false, "otherController should come from other gloal")
const request = callReaderThisGlobal.read();
assert_equals(request instanceof Promise, true, "Promise comes from this global");
streamController.close();
const requestResult = await request;
assert_equals(requestResult instanceof Object, true, "returned object comes from this global");
}, "Stream objects created in expected globals")
promise_test(async () => {
const stream = new ReadableStream();
const otherReader = new OtherReadableStreamDefaultReader(stream);
const cancelPromise = ReadableStreamDefaultReader.prototype.cancel.call(otherReader);
assert_equals(cancelPromise instanceof Promise, true, "Cancel promise comes from the same global as the stream");
assert_equals(await cancelPromise, undefined, "Cancel promise resolves to undefined");
}, "Cancel promise is created in same global as stream")
// Refresh the streams and controllers.
function getFreshInstances() {
let controller;
let otherController;
let stream = new ReadableStream({
start(c) {
controller = c;
}
});
new OtherReadableStream({
start(c) {
otherController = c;
}
});
return {stream, controller, otherController}
}
promise_test(async () => {
// Test closed promise on reader from another global (connected to a this-global stream)
const {stream, controller, otherController} = getFreshInstances();
const otherReader = new OtherReadableStreamDefaultReader(stream);
const closedPromise = otherReader.closed;
assert_equals(closedPromise instanceof otherGlobal.Promise, true, "Closed promise in other global.");
}, "Closed Promise in correct global");
promise_test(async () => {
const {stream, controller, otherController} = getFreshInstances();
const otherReader = OtherReadableStream.prototype.getReader.call(stream);
assert_equals(otherReader instanceof ReadableStreamDefaultReader, true, "Reader comes from this global")
const request = otherReader.read();
assert_equals(request instanceof Promise, true, "Promise still comes from stream's realm (this realm)");
otherController.close.call(controller);
assert_equals((await request) instanceof otherGlobal.Object, true, "Object comes from other realm");
}, "Reader objects in correct global");
promise_test(async () => {
const {stream, controller, otherController} = getFreshInstances();
assert_equals(controller.desiredSize, 1, "Desired size is expected");
Object.defineProperty(controller, "desiredSize",
Object.getOwnPropertyDescriptor(OtherReadableStreamDefaultController.prototype, "desiredSize"));
assert_equals(controller.desiredSize, 1, "Grafting getter from other prototype still returns desired size");
}, "Desired size can be grafted from one prototype to another");
promise_test(async () => {
const {stream, controller, otherController} = getFreshInstances();
// Make sure the controller close method returns the correct TypeError
const enqueuedError = { name: "enqueuedError" };
controller.error(enqueuedError);
assert_throws_js(TypeError, () => controller.close(), "Current Global controller");
assert_throws_js(otherGlobal.TypeError, () => otherController.close.call(controller), "Other global controller");
}, "Closing errored stream throws object in appropriate global")
promise_test(async () => {
const {otherController} = getFreshInstances();
// We can enqueue chunks from multiple globals
const chunk = { name: "chunk" };
let controller;
const stream = new ReadableStream({ start(c) { controller = c; } }, { size() {return 1} });
otherController.enqueue.call(controller, chunk);
otherController.enqueue.call(controller, new otherGlobal.Uint8Array(10));
controller.enqueue(new otherGlobal.Uint8Array(10));
}, "Can enqueue chunks from multiple globals")
promise_test(async () => {
const {stream, controller, otherController} = getFreshInstances();
const chunk = { name: "chunk" };
// We get the correct type errors out of a closed stream.
controller.close();
assert_throws_js(TypeError, () => controller.enqueue(new otherGlobal.Uint8Array(10)));
assert_throws_js(otherGlobal.TypeError, () => otherController.enqueue.call(controller, chunk));
assert_throws_js(otherGlobal.TypeError, () => otherController.enqueue.call(controller, new otherGlobal.Uint8Array(10)));
}, "Correct errors and globals for closed streams");
promise_test(async () => {
const {stream, controller, otherController} = getFreshInstances();
// Branches out of tee are in the correct global
const [branch1, branch2] = otherGlobal.ReadableStream.prototype.tee.call(stream);
assert_equals(branch1 instanceof ReadableStream, true, "Branch created in this global (as stream is in this global)");
assert_equals(branch2 instanceof ReadableStream, true, "Branch created in this global (as stream is in this global)");
}, "Tee Branches in correct global");
</script>