Diff
Modified: trunk/LayoutTests/ChangeLog (198888 => 198889)
--- trunk/LayoutTests/ChangeLog 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/LayoutTests/ChangeLog 2016-03-31 08:31:25 UTC (rev 198889)
@@ -1,5 +1,23 @@
2016-03-31 Youenn Fablet <[email protected]>
+ Remove forEach use from Fetch Headers builtin constructor
+ https://bugs.webkit.org/show_bug.cgi?id=155967
+
+ Reviewed by Joseph Pecoraro.
+
+ Renaming tests covering user scripts breaking some WebCore JS built ins.
+
+ * fetch/header-constructor-subclass-expected.txt: Added.
+ * fetch/header-constructor-subclass.html: Added.
+ * fetch/shadowing-forEach-expected.txt: Renamed from LayoutTests/streams/builtin-overrides-expected.txt.
+ * fetch/shadowing-forEach.html: Renamed from LayoutTests/fetch/builtin-overrides.html.
+ * streams/shadowing-Promise-expected.txt: Renamed from LayoutTests/streams/streams-promises-expected.txt.
+ * streams/shadowing-Promise.html: Renamed from LayoutTests/streams/streams-promises.html.
+ * streams/shadowing-defineProperty-expected.txt: Renamed from LayoutTests/fetch/builtin-overrides-expected.txt.
+ * streams/shadowing-defineProperty.html: Renamed from LayoutTests/streams/builtin-overrides.html.
+
+2016-03-31 Youenn Fablet <[email protected]>
+
[Fetch API] Update web-platform-test fetch API tests
https://bugs.webkit.org/show_bug.cgi?id=155969
Deleted: trunk/LayoutTests/fetch/builtin-overrides-expected.txt (198888 => 198889)
--- trunk/LayoutTests/fetch/builtin-overrides-expected.txt 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/LayoutTests/fetch/builtin-overrides-expected.txt 2016-03-31 08:31:25 UTC (rev 198889)
@@ -1,9 +0,0 @@
-This test should run without throwing an exception.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/fetch/builtin-overrides.html (198888 => 198889)
--- trunk/LayoutTests/fetch/builtin-overrides.html 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/LayoutTests/fetch/builtin-overrides.html 2016-03-31 08:31:25 UTC (rev 198889)
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<script>
-description("This test should run without throwing an exception.");
-
-Array.prototype.forEach = function() {
- throw "User overriden";
-};
-
-new Headers({a:1});
-</script>
-<script src=""
-</body>
-</html>
Copied: trunk/LayoutTests/fetch/header-constructor-subclass-expected.txt (from rev 198888, trunk/LayoutTests/streams/builtin-overrides-expected.txt) (0 => 198889)
--- trunk/LayoutTests/fetch/header-constructor-subclass-expected.txt (rev 0)
+++ trunk/LayoutTests/fetch/header-constructor-subclass-expected.txt 2016-03-31 08:31:25 UTC (rev 198889)
@@ -0,0 +1,10 @@
+This test should create a Headers from an object which is a subclass of Headers.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS otherHeaders.get('a') is "1"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fetch/header-constructor-subclass.html (0 => 198889)
--- trunk/LayoutTests/fetch/header-constructor-subclass.html (rev 0)
+++ trunk/LayoutTests/fetch/header-constructor-subclass.html 2016-03-31 08:31:25 UTC (rev 198889)
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("This test should create a Headers from an object which is a subclass of Headers.");
+
+let SpecialHeaders = class SpecialHeaders extends Headers {
+ constructor() {
+ super(...arguments);
+ }
+};
+
+let specialHeaders = new SpecialHeaders({"a": "1"});
+let otherHeaders = new Headers(specialHeaders);
+shouldBeEqualToString("otherHeaders.get('a')", "1");
+
+</script>
+<script src=""
+</body>
+</html>
Copied: trunk/LayoutTests/fetch/shadowing-forEach-expected.txt (from rev 198888, trunk/LayoutTests/streams/builtin-overrides-expected.txt) (0 => 198889)
--- trunk/LayoutTests/fetch/shadowing-forEach-expected.txt (rev 0)
+++ trunk/LayoutTests/fetch/shadowing-forEach-expected.txt 2016-03-31 08:31:25 UTC (rev 198889)
@@ -0,0 +1,9 @@
+This test should run without throwing an exception.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: trunk/LayoutTests/fetch/shadowing-forEach.html (from rev 198888, trunk/LayoutTests/fetch/builtin-overrides.html) (0 => 198889)
--- trunk/LayoutTests/fetch/shadowing-forEach.html (rev 0)
+++ trunk/LayoutTests/fetch/shadowing-forEach.html 2016-03-31 08:31:25 UTC (rev 198889)
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("This test should run without throwing an exception.");
+
+Array.prototype.forEach = function() {
+ throw "User overriden";
+};
+
+let headers = new Headers({a:1});
+let headers2 = new Headers(headers);
+
+</script>
+<script src=""
+</body>
+</html>
Deleted: trunk/LayoutTests/streams/builtin-overrides-expected.txt (198888 => 198889)
--- trunk/LayoutTests/streams/builtin-overrides-expected.txt 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/LayoutTests/streams/builtin-overrides-expected.txt 2016-03-31 08:31:25 UTC (rev 198889)
@@ -1,9 +0,0 @@
-This test should run without throwing an exception.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/streams/builtin-overrides.html (198888 => 198889)
--- trunk/LayoutTests/streams/builtin-overrides.html 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/LayoutTests/streams/builtin-overrides.html 2016-03-31 08:31:25 UTC (rev 198889)
@@ -1,19 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<script>
-description("This test should run without throwing an exception.");
-
-Object.defineProperty = function() {
- throw "User overriden";
-};
-
-new ByteLengthQueuingStrategy({});
-new CountQueuingStrategy({});
-</script>
-<script src=""
-</body>
-</html>
Copied: trunk/LayoutTests/streams/shadowing-Promise-expected.txt (from rev 198888, trunk/LayoutTests/streams/streams-promises-expected.txt) (0 => 198889)
--- trunk/LayoutTests/streams/shadowing-Promise-expected.txt (rev 0)
+++ trunk/LayoutTests/streams/shadowing-Promise-expected.txt 2016-03-31 08:31:25 UTC (rev 198889)
@@ -0,0 +1,13 @@
+
+PASS Streams and promises: replace Promise constructor
+PASS Streams and promises: replace Promise.resolve
+PASS Streams and promises: replace Promise.reject
+PASS Streams and promises: replace prototype of a promise object
+PASS Streams and promises: replace then method in Promise prototype
+PASS Streams and promises: replace catch method in Promise prototype
+PASS Streams and promises: replace then method in promise object
+PASS Streams should not directly use Number and related methods
+PASS Streams should not directly use ReadableStream public APIs
+PASS Streams should not directly use ReadableStreamReader read public API
+PASS Streams should not directly use array public APIs
+
Copied: trunk/LayoutTests/streams/shadowing-Promise.html (from rev 198888, trunk/LayoutTests/streams/streams-promises.html) (0 => 198889)
--- trunk/LayoutTests/streams/shadowing-Promise.html (rev 0)
+++ trunk/LayoutTests/streams/shadowing-Promise.html 2016-03-31 08:31:25 UTC (rev 198889)
@@ -0,0 +1,206 @@
+<!DOCTYPE html>
+<script src=''></script>
+<script src=''></script>
+<script>
+test(function() {
+ const PromiseBackup = Promise;
+
+ try {
+ Promise = function() { assert_unreached("streams should not use this Promise object"); };
+
+ new ReadableStream();
+ new WritableStream();
+ } finally {
+ Promise = PromiseBackup;
+ }
+}, 'Streams and promises: replace Promise constructor');
+
+test(function() {
+ const PromiseResolveBackup = Promise.resolve;
+
+ try {
+ Promise.resolve = function() { assert_unreached("streams should not use this Promise.resolve method"); };
+
+ new ReadableStream();
+ new WritableStream();
+ } finally {
+ Promise.resolve = PromiseResolveBackup;
+ }
+}, 'Streams and promises: replace Promise.resolve');
+
+test(function() {
+ const PromiseRejectBackup = Promise.reject;
+
+ try {
+ Promise.reject = function() { assert_unreached("streams should not use this Promise.reject method"); };
+
+ ReadableStream.prototype.cancel.call({}, "reason");
+ WritableStream.prototype.abort.call({}, "reason");
+ } finally {
+ Promise.reject = PromiseRejectBackup;
+ }
+}, 'Streams and promises: replace Promise.reject');
+
+test(function() {
+ function createMangledPromise() {
+ const promise = Promise.resolve();
+ Object.setPrototypeOf(promise, { constructor: Promise, then: function() { assert_unreached("streams should not use this promise then method"); } });
+ return promise;
+ }
+ new ReadableStream({ start: function() { return createMangledPromise(); } })
+ new WritableStream({ start: function() { return createMangledPromise(); } })
+}, 'Streams and promises: replace prototype of a promise object');
+
+test(function() {
+ const PromiseThenBackup = Promise.prototype.then;
+
+ try {
+ Promise.prototype.then = function() { assert_unreached("streams should not use this Promise.prototype.then method"); };
+
+ new ReadableStream();
+ new WritableStream();
+ } finally {
+ Promise.prototype.then = PromiseThenBackup;
+ }
+}, 'Streams and promises: replace then method in Promise prototype');
+
+test(function() {
+ const PromiseCatchBackup = Promise.prototype.catch;
+ const PromiseThenBackup = Promise.prototype.then;
+
+ try {
+ Promise.prototype.catch = function() { assert_unreached("streams should not use this Promise.prototype.catch method"); };
+ Promise.prototype.then = function() { assert_unreached("streams should not use this Promise.prototype.catch method"); };
+
+ const rs = new ReadableStream();
+ rs.tee();
+ } finally {
+ Promise.prototype.catch = PromiseCatchBackup;
+ Promise.prototype.then = PromiseThenBackup;
+ }
+}, 'Streams and promises: replace catch method in Promise prototype');
+
+test(function() {
+ function createMangledPromise() {
+ const promise = Promise.resolve();
+ promise.then = function() { assert_unreached("streams should not use this promise then method"); };
+ return promise;
+ }
+ new ReadableStream({ start: function() { return createMangledPromise(); } })
+ new WritableStream({ start: function() { return createMangledPromise(); } })
+}, 'Streams and promises: replace then method in promise object');
+
+test(function() {
+ const NumberBackup = Number;
+ const NumberIsNaNBackup = Number.isNaN;
+ const NumberIsFiniteBackup = Number.isFinite;
+
+ try {
+ Number.isNaN = function() { assert_unreached("streams should not use this Number.isNaN method"); };
+ Number.isFinite = function() { assert_unreached("streams should not use this Number.isFinite method"); };
+ Number = null;
+
+ new ReadableStream({
+ start: function(controller) {
+ controller.enqueue("small potato");
+ }
+ }, {
+ size: function(chunk) { return 2; },
+ highWaterMark: 1
+ });
+
+ } finally {
+ Number = NumberBackup;
+ Number.isNaN = NumberIsNaNBackup;
+ Number.isFinite = NumberIsFiniteBackup;
+ }
+}, 'Streams should not directly use Number and related methods');
+test(function() {
+ const ReadableStreamGetReaderBackup = ReadableStream.prototype.getReader;
+
+ try {
+ ReadableStream.prototype.getReader = function() { assert_unreached("streams should not use this ReadableStream.getReader method"); };
+ new ReadableStream().tee();
+ } finally {
+ ReadableStream.prototype.getReader = ReadableStreamGetReaderBackup;
+ }
+}, 'Streams should not directly use ReadableStream public APIs');
+
+promise_test(function() {
+ const ReadableStreamReader = new ReadableStream().getReader().constructor;
+ const ReadableStreamReaderReadBackup = ReadableStreamReader.prototype.read;
+
+ function cleanTest() {
+ ReadableStreamReader.prototype.read = ReadableStreamReaderReadBackup;
+ }
+
+ try {
+ ReadableStreamReader.prototype.read = function() { assert_unreached("streams should not use this ReadableStreamReader.read method"); };
+
+ [s1, s2] = new ReadableStream({
+ start: function(controller) {
+ controller.close();
+ }
+ }).tee();
+ return s1.getReader().closed.then(cleanTest, cleanTest);
+
+ } catch (error) {
+ cleanTest();
+ assert_unreached("test should not throw");
+ }
+}, 'Streams should not directly use ReadableStreamReader read public API');
+
+promise_test(function() {
+ const ArrayPushBackup = Array.prototype.push;
+ const ArrayShiftBackup = Array.prototype.shift;
+
+ // Use of testing variable to try not messing up testharness.js code.
+ // FIXME: this approach is far from perfect: push is used in case an assert fails.
+ // But cleanTest will not be called and we may end-up mask the real assertion failure by below assert_unreached messages.
+ // We might want to either improve testharness.js or move these tests out of testharness.js.
+ let testing = true;
+ Array.prototype.push = function() {
+ if (testing) {
+ testing = false;
+ assert_unreached("Array.prototype.push called");
+ }
+ return ArrayPushBackup.apply(this, arguments);
+ }
+
+ Array.prototype.shift = function() {
+ if (testing) {
+ testing = false;
+ assert_unreached("Array.prototype.shift called");
+ }
+ return ArrayShiftBackup.call(this, arguments);
+ }
+
+ function cleanTest() {
+ Array.prototype.push = ArrayPushBackup;
+ Array.prototype.shift = ArrayShiftBackup;
+ }
+ try {
+ let _controller;
+ const reader = new ReadableStream({
+ start: function(controller) {
+ _controller = controller;
+ }
+ }).getReader();
+ // checking whether pushing/shifting pending read promises is shielded.
+ const readPromise = reader.read().then(function(result) {
+ assert_equals(result.value, "half baked potato");
+ // checking whether pushing/shifting enqueued values is shielded.
+ _controller.enqueue("fully baked potato");
+ return reader.read().then(function(result) {
+ assert_equals(result.value, "fully baked potato");
+ cleanTest();
+ }, cleanTest);
+ }, cleanTest);
+ _controller.enqueue("half baked potato");
+ return readPromise;
+ } catch (error) {
+ cleanTest();
+ return Promise.reject(error);
+ }
+}, 'Streams should not directly use array public APIs');
+</script>
Copied: trunk/LayoutTests/streams/shadowing-defineProperty-expected.txt (from rev 198888, trunk/LayoutTests/fetch/builtin-overrides-expected.txt) (0 => 198889)
--- trunk/LayoutTests/streams/shadowing-defineProperty-expected.txt (rev 0)
+++ trunk/LayoutTests/streams/shadowing-defineProperty-expected.txt 2016-03-31 08:31:25 UTC (rev 198889)
@@ -0,0 +1,9 @@
+This test should run without throwing an exception.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: trunk/LayoutTests/streams/shadowing-defineProperty.html (from rev 198888, trunk/LayoutTests/streams/builtin-overrides.html) (0 => 198889)
--- trunk/LayoutTests/streams/shadowing-defineProperty.html (rev 0)
+++ trunk/LayoutTests/streams/shadowing-defineProperty.html 2016-03-31 08:31:25 UTC (rev 198889)
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("This test should run without throwing an exception.");
+
+Object.defineProperty = function() {
+ throw "User overriden";
+};
+
+new ByteLengthQueuingStrategy({});
+new CountQueuingStrategy({});
+</script>
+<script src=""
+</body>
+</html>
Deleted: trunk/LayoutTests/streams/streams-promises-expected.txt (198888 => 198889)
--- trunk/LayoutTests/streams/streams-promises-expected.txt 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/LayoutTests/streams/streams-promises-expected.txt 2016-03-31 08:31:25 UTC (rev 198889)
@@ -1,13 +0,0 @@
-
-PASS Streams and promises: replace Promise constructor
-PASS Streams and promises: replace Promise.resolve
-PASS Streams and promises: replace Promise.reject
-PASS Streams and promises: replace prototype of a promise object
-PASS Streams and promises: replace then method in Promise prototype
-PASS Streams and promises: replace catch method in Promise prototype
-PASS Streams and promises: replace then method in promise object
-PASS Streams should not directly use Number and related methods
-PASS Streams should not directly use ReadableStream public APIs
-PASS Streams should not directly use ReadableStreamReader read public API
-PASS Streams should not directly use array public APIs
-
Deleted: trunk/LayoutTests/streams/streams-promises.html (198888 => 198889)
--- trunk/LayoutTests/streams/streams-promises.html 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/LayoutTests/streams/streams-promises.html 2016-03-31 08:31:25 UTC (rev 198889)
@@ -1,206 +0,0 @@
-<!DOCTYPE html>
-<script src=''></script>
-<script src=''></script>
-<script>
-test(function() {
- const PromiseBackup = Promise;
-
- try {
- Promise = function() { assert_unreached("streams should not use this Promise object"); };
-
- new ReadableStream();
- new WritableStream();
- } finally {
- Promise = PromiseBackup;
- }
-}, 'Streams and promises: replace Promise constructor');
-
-test(function() {
- const PromiseResolveBackup = Promise.resolve;
-
- try {
- Promise.resolve = function() { assert_unreached("streams should not use this Promise.resolve method"); };
-
- new ReadableStream();
- new WritableStream();
- } finally {
- Promise.resolve = PromiseResolveBackup;
- }
-}, 'Streams and promises: replace Promise.resolve');
-
-test(function() {
- const PromiseRejectBackup = Promise.reject;
-
- try {
- Promise.reject = function() { assert_unreached("streams should not use this Promise.reject method"); };
-
- ReadableStream.prototype.cancel.call({}, "reason");
- WritableStream.prototype.abort.call({}, "reason");
- } finally {
- Promise.reject = PromiseRejectBackup;
- }
-}, 'Streams and promises: replace Promise.reject');
-
-test(function() {
- function createMangledPromise() {
- const promise = Promise.resolve();
- Object.setPrototypeOf(promise, { constructor: Promise, then: function() { assert_unreached("streams should not use this promise then method"); } });
- return promise;
- }
- new ReadableStream({ start: function() { return createMangledPromise(); } })
- new WritableStream({ start: function() { return createMangledPromise(); } })
-}, 'Streams and promises: replace prototype of a promise object');
-
-test(function() {
- const PromiseThenBackup = Promise.prototype.then;
-
- try {
- Promise.prototype.then = function() { assert_unreached("streams should not use this Promise.prototype.then method"); };
-
- new ReadableStream();
- new WritableStream();
- } finally {
- Promise.prototype.then = PromiseThenBackup;
- }
-}, 'Streams and promises: replace then method in Promise prototype');
-
-test(function() {
- const PromiseCatchBackup = Promise.prototype.catch;
- const PromiseThenBackup = Promise.prototype.then;
-
- try {
- Promise.prototype.catch = function() { assert_unreached("streams should not use this Promise.prototype.catch method"); };
- Promise.prototype.then = function() { assert_unreached("streams should not use this Promise.prototype.catch method"); };
-
- const rs = new ReadableStream();
- rs.tee();
- } finally {
- Promise.prototype.catch = PromiseCatchBackup;
- Promise.prototype.then = PromiseThenBackup;
- }
-}, 'Streams and promises: replace catch method in Promise prototype');
-
-test(function() {
- function createMangledPromise() {
- const promise = Promise.resolve();
- promise.then = function() { assert_unreached("streams should not use this promise then method"); };
- return promise;
- }
- new ReadableStream({ start: function() { return createMangledPromise(); } })
- new WritableStream({ start: function() { return createMangledPromise(); } })
-}, 'Streams and promises: replace then method in promise object');
-
-test(function() {
- const NumberBackup = Number;
- const NumberIsNaNBackup = Number.isNaN;
- const NumberIsFiniteBackup = Number.isFinite;
-
- try {
- Number.isNaN = function() { assert_unreached("streams should not use this Number.isNaN method"); };
- Number.isFinite = function() { assert_unreached("streams should not use this Number.isFinite method"); };
- Number = null;
-
- new ReadableStream({
- start: function(controller) {
- controller.enqueue("small potato");
- }
- }, {
- size: function(chunk) { return 2; },
- highWaterMark: 1
- });
-
- } finally {
- Number = NumberBackup;
- Number.isNaN = NumberIsNaNBackup;
- Number.isFinite = NumberIsFiniteBackup;
- }
-}, 'Streams should not directly use Number and related methods');
-test(function() {
- const ReadableStreamGetReaderBackup = ReadableStream.prototype.getReader;
-
- try {
- ReadableStream.prototype.getReader = function() { assert_unreached("streams should not use this ReadableStream.getReader method"); };
- new ReadableStream().tee();
- } finally {
- ReadableStream.prototype.getReader = ReadableStreamGetReaderBackup;
- }
-}, 'Streams should not directly use ReadableStream public APIs');
-
-promise_test(function() {
- const ReadableStreamReader = new ReadableStream().getReader().constructor;
- const ReadableStreamReaderReadBackup = ReadableStreamReader.prototype.read;
-
- function cleanTest() {
- ReadableStreamReader.prototype.read = ReadableStreamReaderReadBackup;
- }
-
- try {
- ReadableStreamReader.prototype.read = function() { assert_unreached("streams should not use this ReadableStreamReader.read method"); };
-
- [s1, s2] = new ReadableStream({
- start: function(controller) {
- controller.close();
- }
- }).tee();
- return s1.getReader().closed.then(cleanTest, cleanTest);
-
- } catch (error) {
- cleanTest();
- assert_unreached("test should not throw");
- }
-}, 'Streams should not directly use ReadableStreamReader read public API');
-
-promise_test(function() {
- const ArrayPushBackup = Array.prototype.push;
- const ArrayShiftBackup = Array.prototype.shift;
-
- // Use of testing variable to try not messing up testharness.js code.
- // FIXME: this approach is far from perfect: push is used in case an assert fails.
- // But cleanTest will not be called and we may end-up mask the real assertion failure by below assert_unreached messages.
- // We might want to either improve testharness.js or move these tests out of testharness.js.
- let testing = true;
- Array.prototype.push = function() {
- if (testing) {
- testing = false;
- assert_unreached("Array.prototype.push called");
- }
- return ArrayPushBackup.apply(this, arguments);
- }
-
- Array.prototype.shift = function() {
- if (testing) {
- testing = false;
- assert_unreached("Array.prototype.shift called");
- }
- return ArrayShiftBackup.call(this, arguments);
- }
-
- function cleanTest() {
- Array.prototype.push = ArrayPushBackup;
- Array.prototype.shift = ArrayShiftBackup;
- }
- try {
- let _controller;
- const reader = new ReadableStream({
- start: function(controller) {
- _controller = controller;
- }
- }).getReader();
- // checking whether pushing/shifting pending read promises is shielded.
- const readPromise = reader.read().then(function(result) {
- assert_equals(result.value, "half baked potato");
- // checking whether pushing/shifting enqueued values is shielded.
- _controller.enqueue("fully baked potato");
- return reader.read().then(function(result) {
- assert_equals(result.value, "fully baked potato");
- cleanTest();
- }, cleanTest);
- }, cleanTest);
- _controller.enqueue("half baked potato");
- return readPromise;
- } catch (error) {
- cleanTest();
- return Promise.reject(error);
- }
-}, 'Streams should not directly use array public APIs');
-</script>
Modified: trunk/Source/WebCore/ChangeLog (198888 => 198889)
--- trunk/Source/WebCore/ChangeLog 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/Source/WebCore/ChangeLog 2016-03-31 08:31:25 UTC (rev 198889)
@@ -1,3 +1,20 @@
+2016-03-31 Youenn Fablet <[email protected]>
+
+ Remove forEach use from Fetch Headers builtin constructor
+ https://bugs.webkit.org/show_bug.cgi?id=155967
+
+ Reviewed by Joseph Pecoraro.
+
+ Tests: fetch/shadowing-forEach.html
+ streams/shadowing-Promise.html
+ streams/shadowing-defineProperty.html
+
+ * Modules/fetch/FetchHeaders.idl: Adding fillFromJS private method.
+ * Modules/fetch/FetchHeaders.js:
+ (initializeFetchHeaders): Using fillFromJS private method. Using
+ instanceof test to check whether parameter is Headers or subclass of it.
+ * bindings/js/WebCoreBuiltinNames.h: Adding fillFromJS private symbol.
+
2016-03-30 Alex Christensen <[email protected]>
Fix Windows build.
Modified: trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl (198888 => 198889)
--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl 2016-03-31 08:31:25 UTC (rev 198889)
@@ -43,4 +43,5 @@
iterable<DOMString, DOMString>;
[Private, RaisesException, ImplementedAs=append] void appendFromJS(DOMString name, DOMString value);
+ [Private, ImplementedAs=fill] void fillFromJS(FetchHeaders? headers);
};
Modified: trunk/Source/WebCore/Modules/fetch/FetchHeaders.js (198888 => 198889)
--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.js 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.js 2016-03-31 08:31:25 UTC (rev 198889)
@@ -35,10 +35,9 @@
if (!@isObject(headersInit))
throw new @TypeError("headersInit must be an object");
- if (this.constructor === headersInit.constructor) {
- headersInit.forEach((value, name) => {
- this.@appendFromJS(name, value);
- });
+ if (headersInit instanceof this.constructor) {
+ this.@fillFromJS(headersInit);
+ return this;
}
if (headersInit instanceof @Array) {
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (198888 => 198889)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2016-03-31 08:26:29 UTC (rev 198888)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2016-03-31 08:31:25 UTC (rev 198889)
@@ -38,6 +38,7 @@
macro(controlledReadableStream) \
macro(controller) \
macro(disturbed) \
+ macro(fillFromJS) \
macro(getUserMediaFromJS) \
macro(initializeWith) \
macro(operations) \