Diff
Modified: trunk/LayoutTests/ChangeLog (204499 => 204500)
--- trunk/LayoutTests/ChangeLog 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/LayoutTests/ChangeLog 2016-08-16 06:50:58 UTC (rev 204500)
@@ -1,3 +1,23 @@
+2016-08-15 Ryosuke Niwa <[email protected]>
+
+ Conversion to sequence<T> is broken for iterable objects
+ https://bugs.webkit.org/show_bug.cgi?id=160801
+
+ Reviewed by Darin Adler.
+
+ Added test cases for converting non-JSArray objects to sequence<T> for MutationObserver, FontFaceSet, and WebSocket.
+
+ * fast/dom/MutationObserver/observe-exceptions-expected.txt:
+ * fast/dom/MutationObserver/observe-exceptions.html:
+ * fast/text/font-face-set-_javascript_-expected.txt:
+ * fast/text/font-face-set-_javascript_.html:
+ * http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt: Rebaselined due to js-test-pre.js change.
+ * http/tests/resources/js-test-pre.js: Merged ToT from resources/js-test-pre.js.
+ * http/tests/security/xssAuditor/block-does-not-leak-location-expected.txt: Rebaselined due to js-test-pre.js change.
+ * http/tests/security/xssAuditor/block-does-not-leak-referrer-expected.txt: Ditto.
+ * http/tests/websocket/tests/hybi/websocket-constructor-protocols-expected.txt: Added.
+ * http/tests/websocket/tests/hybi/websocket-constructor-protocols.html: Added.
+
2016-08-15 Daniel Bates <[email protected]>
ASSERTION FAILURE: [[videoLayer delegate] isKindOfClass:getUIViewClass()] in WebAVPlayerLayerView_videoView()
Modified: trunk/LayoutTests/fast/dom/MutationObserver/observe-exceptions-expected.txt (204499 => 204500)
--- trunk/LayoutTests/fast/dom/MutationObserver/observe-exceptions-expected.txt 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/LayoutTests/fast/dom/MutationObserver/observe-exceptions-expected.txt 2016-08-16 06:50:58 UTC (rev 204500)
@@ -18,6 +18,12 @@
PASS observer.observe(document.body, {attributes: false, attributeOldValue: true}) threw exception TypeError: Type error.
PASS observer.observe(document.body, {attributes: false, attributeFilter: ["id"]}) threw exception TypeError: Type error.
PASS observer.observe(document.body, {characterData: false, characterDataOldValue: true}) threw exception TypeError: Type error.
+PASS observer.observe(document.body, {attributeFilter: 1}) threw exception TypeError: Value is not a sequence.
+PASS observer.observe(document.body, {attributeFilter: "abc"}) threw exception TypeError: Value is not a sequence.
+PASS x = { [Symbol.iterator]: function* () { yield "foo"; } }; observer.observe(document.body, {attributeFilter: x}) did not throw exception.
+PASS x = { [Symbol.iterator]: 1 }; observer.observe(document.body, {attributeFilter: x}) threw exception TypeError: Type error.
+PASS x = { [Symbol.iterator]: null }; observer.observe(document.body, {attributeFilter: x}) threw exception TypeError: Type error.
+PASS x = { [Symbol.iterator]: function* () { throw {name: "error", toString: () => "error"}; } }; observer.observe(document.body, {attributeFilter: x}) threw exception error.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/dom/MutationObserver/observe-exceptions.html (204499 => 204500)
--- trunk/LayoutTests/fast/dom/MutationObserver/observe-exceptions.html 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/LayoutTests/fast/dom/MutationObserver/observe-exceptions.html 2016-08-16 06:50:58 UTC (rev 204500)
@@ -6,28 +6,36 @@
<title></title>
</head>
<body>
-<p id=description></p>
+<p id="description"></p>
<div id="console"></div>
<script>
function runTest() {
window.observer = new MutationObserver(function(mutations) { });
- shouldThrow('observer.observe()');
- shouldThrow('observer.observe(null)');
- shouldThrow('observer.observe(undefined)');
- shouldThrow('observer.observe(document.body)');
- shouldThrow('observer.observe(document.body, null)');
- shouldThrow('observer.observe(document.body, undefined)');
- shouldThrow('observer.observe(null, {attributes: true})');
- shouldThrow('observer.observe(undefined, {attributes: true})');
- shouldThrow('observer.observe(document.body, {subtree: true})');
+ shouldThrowErrorName('observer.observe()', 'TypeError');
+ shouldThrowErrorName('observer.observe(null)', 'TypeError');
+ shouldThrowErrorName('observer.observe(undefined)', 'TypeError');
+ shouldThrowErrorName('observer.observe(document.body)', 'TypeError');
+ shouldThrowErrorName('observer.observe(document.body, null)', 'TypeError');
+ shouldThrowErrorName('observer.observe(document.body, undefined)', 'TypeError');
+ shouldThrowErrorName('observer.observe(null, {attributes: true})', 'TypeError');
+ shouldThrowErrorName('observer.observe(undefined, {attributes: true})', 'TypeError');
+ shouldThrowErrorName('observer.observe(document.body, {subtree: true})', 'TypeError');
shouldNotThrow('observer.observe(document.body, {childList: true, attributeOldValue: true})');
shouldNotThrow('observer.observe(document.body, {attributes: true, characterDataOldValue: true})');
shouldNotThrow('observer.observe(document.body, {characterData: true, attributeFilter: ["id"]})');
- shouldThrow('observer.observe(document.body, {attributes: false, attributeOldValue: true})');
- shouldThrow('observer.observe(document.body, {attributes: false, attributeFilter: ["id"]})');
- shouldThrow('observer.observe(document.body, {characterData: false, characterDataOldValue: true})');
+ shouldThrowErrorName('observer.observe(document.body, {attributes: false, attributeOldValue: true})', 'TypeError');
+ shouldThrowErrorName('observer.observe(document.body, {attributes: false, attributeFilter: ["id"]})', 'TypeError');
+ shouldThrowErrorName('observer.observe(document.body, {characterData: false, characterDataOldValue: true})', 'TypeError');
+
+ shouldThrowErrorName('observer.observe(document.body, {attributeFilter: 1})', 'TypeError');
+ shouldThrowErrorName('observer.observe(document.body, {attributeFilter: "abc"})', 'TypeError');
+ shouldNotThrow('x = { [Symbol.iterator]: function* () { yield "foo"; } }; observer.observe(document.body, {attributeFilter: x})');
+ shouldThrowErrorName('x = { [Symbol.iterator]: 1 }; observer.observe(document.body, {attributeFilter: x})', 'TypeError');
+ shouldThrowErrorName('x = { [Symbol.iterator]: null }; observer.observe(document.body, {attributeFilter: x})', 'TypeError');
+ shouldThrowErrorName('x = { [Symbol.iterator]: function* () { throw {name: "error", toString: () => "error"}; } }; '
+ + 'observer.observe(document.body, {attributeFilter: x})', 'error');
}
description('Test that WebKitMutationObserver.observe throws exceptions appropriately');
Modified: trunk/LayoutTests/fast/text/font-face-set-_javascript_-expected.txt (204499 => 204500)
--- trunk/LayoutTests/fast/text/font-face-set-_javascript_-expected.txt 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/LayoutTests/fast/text/font-face-set-_javascript_-expected.txt 2016-08-16 06:50:58 UTC (rev 204500)
@@ -1,6 +1,13 @@
PASS new FontFaceSet() threw exception TypeError: Not enough arguments.
PASS new FontFaceSet([]).size is 0
PASS new FontFaceSet([fontFace1]).size is 1
+PASS new FontFaceSet(1) threw exception TypeError: Value is not a sequence.
+PASS new FontFaceSet('hello') threw exception TypeError: Value is not a sequence.
+PASS new FontFaceSet(new Set([fontFace1])).size is 1
+PASS x = { [Symbol.iterator]: function*() { yield fontFace1; yield fontFace2; } }; new FontFaceSet(x).size is 2
+PASS x = { [Symbol.iterator]: 1 }; new FontFaceSet(x) threw exception TypeError: Type error.
+PASS x = { [Symbol.iterator]: null }; new FontFaceSet(x) threw exception TypeError: Type error.
+PASS x = { [Symbol.iterator]: function*() { yield fontFace1; throw {name: 'SomeError', toString: () => 'Some error'}; } }; new FontFaceSet(x) threw exception Some error.
PASS fontFaceSet.status is "loaded"
PASS item.done is false
PASS item.value.length is 2
Modified: trunk/LayoutTests/fast/text/font-face-set-_javascript_.html (204499 => 204500)
--- trunk/LayoutTests/fast/text/font-face-set-_javascript_.html 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/LayoutTests/fast/text/font-face-set-_javascript_.html 2016-08-16 06:50:58 UTC (rev 204500)
@@ -16,6 +16,13 @@
shouldThrow("new FontFaceSet()");
shouldBe("new FontFaceSet([]).size", "0");
shouldBe("new FontFaceSet([fontFace1]).size", "1");
+shouldThrowErrorName("new FontFaceSet(1)", "TypeError");
+shouldThrowErrorName("new FontFaceSet('hello')", "TypeError");
+shouldBe("new FontFaceSet(new Set([fontFace1])).size", "1");
+shouldBe("x = { [Symbol.iterator]: function*() { yield fontFace1; yield fontFace2; } }; new FontFaceSet(x).size", "2");
+shouldThrowErrorName("x = { [Symbol.iterator]: 1 }; new FontFaceSet(x)", "TypeError");
+shouldThrowErrorName("x = { [Symbol.iterator]: null }; new FontFaceSet(x)", "TypeError");
+shouldThrowErrorName("x = { [Symbol.iterator]: function*() { yield fontFace1; throw {name: 'SomeError', toString: () => 'Some error'}; } }; new FontFaceSet(x)", "SomeError");
var fontFaceSet = new FontFaceSet([]);
shouldBeEqualToString("fontFaceSet.status", "loaded");
Modified: trunk/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt (204499 => 204500)
--- trunk/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt 2016-08-16 06:50:58 UTC (rev 204500)
@@ -1,6 +1,6 @@
CONSOLE MESSAGE: line 34: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "null". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "about". Protocols must match.
-CONSOLE MESSAGE: line 347: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "null". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "about". Protocols must match.
+CONSOLE MESSAGE: line 526: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "null". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "about". Protocols must match.
PASS newWindow.document is undefined.
Modified: trunk/LayoutTests/http/tests/resources/js-test-pre.js (204499 => 204500)
--- trunk/LayoutTests/http/tests/resources/js-test-pre.js 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/LayoutTests/http/tests/resources/js-test-pre.js 2016-08-16 06:50:58 UTC (rev 204500)
@@ -2,10 +2,25 @@
if (self.testRunner)
testRunner.dumpAsText(self.enablePixelTesting);
-var description, debug, successfullyParsed, errorMessage;
+var description, debug, successfullyParsed, errorMessage, silentTestPass, didPassSomeTestsSilently, didFailSomeTests;
+silentTestPass = false;
+didPassSomeTestsSilently = false;
+didFailSomeTests = false;
+
(function() {
+ function createHTMLElement(tagName)
+ {
+ // FIXME: In an XML document, document.createElement() creates an element with a null namespace URI.
+ // So, we need use document.createElementNS() to explicitly create an element with the specified
+ // tag name in the HTML namespace. We can remove this function and use document.createElement()
+ // directly once we fix <https://bugs.webkit.org/show_bug.cgi?id=131074>.
+ if (document.createElementNS)
+ return document.createElementNS("http://www.w3.org/1999/xhtml", tagName);
+ return document.createElement(tagName);
+ }
+
function getOrCreate(id, tagName)
{
var element = document.getElementById(id);
@@ -12,7 +27,7 @@
if (element)
return element;
- element = document.createElement(tagName);
+ element = createHTMLElement(tagName);
element.id = id;
var refNode;
var parent = document.body || document.documentElement;
@@ -28,7 +43,7 @@
description = function description(msg, quiet)
{
// For MSIE 6 compatibility
- var span = document.createElement("span");
+ var span = createHTMLElement("span");
if (quiet)
span.innerHTML = '<p>' + msg + '</p><p>On success, you will see no "<span class="fail">FAIL</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>';
else
@@ -43,7 +58,7 @@
debug = function debug(msg)
{
- var span = document.createElement("span");
+ var span = createHTMLElement("span");
getOrCreate("console", "div").appendChild(span); // insert it first so XHTML knows the namespace
span.innerHTML = msg + '<br />';
};
@@ -64,7 +79,7 @@
function insertStyleSheet()
{
- var styleElement = document.createElement("style");
+ var styleElement = createHTMLElement("style");
styleElement.textContent = css;
(document.head || document.documentElement).appendChild(styleElement);
}
@@ -96,14 +111,29 @@
function testPassed(msg)
{
- debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
+ if (silentTestPass)
+ didPassSomeTestsSilently = true;
+ else
+ debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
}
function testFailed(msg)
{
+ didFailSomeTests = true;
debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
}
+function areNumbersEqual(_actual, _expected)
+{
+ if (_expected === 0)
+ return _actual === _expected && (1/_actual) === (1/_expected);
+ if (_actual === _expected)
+ return true;
+ if (typeof(_expected) == "number" && isNaN(_expected))
+ return typeof(_actual) == "number" && isNaN(_actual);
+ return false;
+}
+
function areArraysEqual(_a, _b)
{
try {
@@ -110,7 +140,7 @@
if (_a.length !== _b.length)
return false;
for (var i = 0; i < _a.length; i++)
- if (_a[i] !== _b[i])
+ if (!areNumbersEqual(_a[i], _b[i]))
return false;
} catch (ex) {
return false;
@@ -125,15 +155,27 @@
return n === 0 && 1/n < 0;
}
+function isTypedArray(array)
+{
+ return array instanceof Int8Array
+ || array instanceof Int16Array
+ || array instanceof Int32Array
+ || array instanceof Uint8Array
+ || array instanceof Uint8ClampedArray
+ || array instanceof Uint16Array
+ || array instanceof Uint32Array
+ || array instanceof Float32Array
+ || array instanceof Float64Array;
+}
+
function isResultCorrect(_actual, _expected)
{
- if (_expected === 0)
- return _actual === _expected && (1/_actual) === (1/_expected);
- if (_actual === _expected)
+ if (areNumbersEqual(_actual, _expected))
return true;
- if (typeof(_expected) == "number" && isNaN(_expected))
- return typeof(_actual) == "number" && isNaN(_actual);
- if (_expected && (Object.prototype.toString.call(_expected) == Object.prototype.toString.call([])))
+ if (_expected
+ && (Object.prototype.toString.call(_expected) ==
+ Object.prototype.toString.call([])
+ || isTypedArray(_expected)))
return areArraysEqual(_actual, _expected);
return false;
}
@@ -142,16 +184,20 @@
{
if (v === 0 && 1/v < 0)
return "-0";
- else return "" + v;
+ else if (isTypedArray(v))
+ return v.__proto__.constructor.name + ":[" + Array.prototype.join.call(v, ",") + "]";
+ else
+ return "" + v;
}
-function evalAndLog(_a)
+function evalAndLog(_a, _quiet)
{
if (typeof _a != "string")
debug("WARN: tryAndLog() expects a string argument");
// Log first in case things go horribly wrong or this causes a sync event.
- debug(_a);
+ if (!_quiet)
+ debug(_a);
var _av;
try {
@@ -176,17 +222,118 @@
var _bv = eval(_b);
if (exception)
- testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
+ testFailed(_a + " should be " + stringify(_bv) + ". Threw exception " + exception);
else if (isResultCorrect(_av, _bv)) {
if (!quiet) {
testPassed(_a + " is " + _b);
}
} else if (typeof(_av) == typeof(_bv))
- testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
+ testFailed(_a + " should be " + stringify(_bv) + ". Was " + stringify(_av) + ".");
else
- testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
+ testFailed(_a + " should be " + stringify(_bv) + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
}
+function dfgShouldBe(theFunction, _a, _b)
+{
+ if (typeof theFunction != "function" || typeof _a != "string" || typeof _b != "string")
+ debug("WARN: dfgShouldBe() expects a function and two strings");
+ noInline(theFunction);
+ var exception;
+ var values = [];
+
+ // Defend against tests that muck with numeric properties on array.prototype.
+ values.__proto__ = null;
+ values.push = Array.prototype.push;
+
+ try {
+ while (!dfgCompiled({f:theFunction}))
+ values.push(eval(_a));
+ values.push(eval(_a));
+ } catch (e) {
+ exception = e;
+ }
+
+ var _bv = eval(_b);
+ if (exception)
+ testFailed(_a + " should be " + stringify(_bv) + ". On iteration " + (values.length + 1) + ", threw exception " + exception);
+ else {
+ var allPassed = true;
+ for (var i = 0; i < values.length; ++i) {
+ var _av = values[i];
+ if (isResultCorrect(_av, _bv))
+ continue;
+ if (typeof(_av) == typeof(_bv))
+ testFailed(_a + " should be " + stringify(_bv) + ". On iteration " + (i + 1) + ", was " + stringify(_av) + ".");
+ else
+ testFailed(_a + " should be " + stringify(_bv) + " (of type " + typeof _bv + "). On iteration " + (i + 1) + ", was " + _av + " (of type " + typeof _av + ").");
+ allPassed = false;
+ }
+ if (allPassed)
+ testPassed(_a + " is " + _b + " on all iterations including after DFG tier-up.");
+ }
+
+ return values.length;
+}
+
+// Execute condition every 5 milliseconds until it succeeds.
+function _waitForCondition(condition, completionHandler)
+{
+ if (condition())
+ completionHandler();
+ else
+ setTimeout(_waitForCondition, 5, condition, completionHandler);
+}
+
+function shouldBecomeEqual(_a, _b, completionHandler)
+{
+ if (typeof _a != "string" || typeof _b != "string")
+ debug("WARN: shouldBecomeEqual() expects string arguments");
+
+ function condition() {
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+ var _bv = eval(_b);
+ if (exception)
+ testFailed(_a + " should become " + _bv + ". Threw exception " + exception);
+ if (isResultCorrect(_av, _bv)) {
+ testPassed(_a + " became " + _b);
+ return true;
+ }
+ return false;
+ }
+ setTimeout(_waitForCondition, 0, condition, completionHandler);
+}
+
+function shouldBecomeEqualToString(value, reference, completionHandler)
+{
+ if (typeof value !== "string" || typeof reference !== "string")
+ debug("WARN: shouldBecomeEqualToString() expects string arguments");
+ var unevaledString = JSON.stringify(reference);
+ shouldBecomeEqual(value, unevaledString, completionHandler);
+}
+
+function shouldBeType(_a, _type) {
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ var _typev = eval(_type);
+ if (_av instanceof _typev) {
+ testPassed(_a + " is an instance of " + _type);
+ } else {
+ testFailed(_a + " is not an instance of " + _type);
+ }
+}
+
// Variant of shouldBe()--confirms that result of eval(_to_eval) is within
// numeric _tolerance of numeric _target.
function shouldBeCloseTo(_to_eval, _target, _tolerance, quiet)
@@ -249,6 +396,31 @@
testFailed(_a + " should not be " + _bv + ".");
}
+function shouldBecomeDifferent(_a, _b, completionHandler)
+{
+ if (typeof _a != "string" || typeof _b != "string")
+ debug("WARN: shouldBecomeDifferent() expects string arguments");
+
+ function condition() {
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+ var _bv = eval(_b);
+ if (exception)
+ testFailed(_a + " should became not equal to " + _bv + ". Threw exception " + exception);
+ if (!isResultCorrect(_av, _bv)) {
+ testPassed(_a + " became different from " + _b);
+ return true;
+ }
+ return false;
+ }
+ setTimeout(_waitForCondition, 0, condition, completionHandler);
+}
+
function shouldBeTrue(_a) { shouldBe(_a, "true"); }
function shouldBeTrueQuiet(_a) { shouldBe(_a, "true", true); }
function shouldBeFalse(_a) { shouldBe(_a, "false"); }
@@ -264,6 +436,13 @@
shouldBe(a, unevaledString);
}
+function shouldNotBeEqualToString(a, b)
+{
+ if (typeof a !== "string" || typeof b !== "string")
+ debug("WARN: shouldBeEqualToString() expects string arguments");
+ var unevaledString = JSON.stringify(b);
+ shouldNotBe(a, unevaledString);
+}
function shouldBeEmptyString(_a) { shouldBeEqualToString(_a, ""); }
function shouldEvaluateTo(actual, expected) {
@@ -396,40 +575,66 @@
testPassed(_a + " is >= " + _b);
}
-function shouldNotThrow(_a) {
+function expectTrue(v, msg) {
+ if (v) {
+ testPassed(msg);
+ } else {
+ testFailed(msg);
+ }
+}
+
+function shouldNotThrow(_a, _message) {
try {
- eval(_a);
- testPassed(_a + " did not throw exception.");
+ typeof _a == "function" ? _a() : eval(_a);
+ testPassed((_message ? _message : _a) + " did not throw exception.");
} catch (e) {
- testFailed(_a + " should not throw exception. Threw exception " + e + ".");
+ testFailed((_message ? _message : _a) + " should not throw exception. Threw exception " + e + ".");
}
}
-function shouldThrow(_a, _e)
+function shouldThrow(_a, _e, _message)
{
- var exception;
- var _av;
- try {
- _av = eval(_a);
- } catch (e) {
- exception = e;
- }
+ var _exception;
+ var _av;
+ try {
+ _av = typeof _a == "function" ? _a() : eval(_a);
+ } catch (e) {
+ _exception = e;
+ }
- var _ev;
- if (_e)
- _ev = eval(_e);
+ var _ev;
+ if (_e)
+ _ev = eval(_e);
- if (exception) {
- if (typeof _e == "undefined" || exception == _ev)
- testPassed(_a + " threw exception " + exception + ".");
+ if (_exception) {
+ if (typeof _e == "undefined" || _exception == _ev)
+ testPassed((_message ? _message : _a) + " threw exception " + _exception + ".");
+ else
+ testFailed((_message ? _message : _a) + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + _exception + ".");
+ } else if (typeof _av == "undefined")
+ testFailed((_message ? _message : _a) + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
else
- testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + exception + ".");
- } else if (typeof _av == "undefined")
- testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
- else
- testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
+ testFailed((_message ? _message : _a) + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
}
+function shouldThrowErrorName(_a, _name)
+{
+ var _exception;
+ try {
+ typeof _a == "function" ? _a() : eval(_a);
+ } catch (e) {
+ _exception = e;
+ }
+
+ if (_exception) {
+ if (_exception.name == _name)
+ testPassed(_a + " threw exception " + _exception + ".");
+ else
+ testFailed(_a + " should throw a " + _name + ". Threw a " + _exception.name + ".");
+ } else
+ testFailed(_a + " should throw a " + _name + ". Did not throw.");
+}
+
function shouldHaveHadError(message)
{
if (errorMessage) {
@@ -460,6 +665,51 @@
}
}
+function dfgCompiled(argument)
+{
+ var numberOfCompiles = "compiles" in argument ? argument.compiles : 1;
+
+ if (!("f" in argument))
+ throw new Error("dfgCompiled called with invalid argument.");
+
+ if (argument.f instanceof Array) {
+ for (var i = 0; i < argument.f.length; ++i) {
+ if (testRunner.numberOfDFGCompiles(argument.f[i]) < numberOfCompiles)
+ return false;
+ }
+ } else {
+ if (testRunner.numberOfDFGCompiles(argument.f) < numberOfCompiles)
+ return false;
+ }
+
+ return true;
+}
+
+function dfgIncrement(argument)
+{
+ if (!self.testRunner)
+ return argument.i;
+
+ if (argument.i < argument.n)
+ return argument.i;
+
+ if (didFailSomeTests)
+ return argument.i;
+
+ if (!dfgCompiled(argument))
+ return "start" in argument ? argument.start : 0;
+
+ return argument.i;
+}
+
+function noInline(theFunction)
+{
+ if (!self.testRunner)
+ return;
+
+ testRunner.neverInlineFunction(theFunction);
+}
+
function isSuccessfullyParsed()
{
// FIXME: Remove this and only report unexpected syntax errors.
@@ -466,6 +716,10 @@
if (!errorMessage)
successfullyParsed = true;
shouldBeTrue("successfullyParsed");
+ if (silentTestPass && didPassSomeTestsSilently)
+ debug("Passed some tests silently.");
+ if (silentTestPass && didFailSomeTests)
+ debug("Some tests failed.");
debug('<br /><span class="pass">TEST COMPLETE</span>');
}
Modified: trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-location-expected.txt (204499 => 204500)
--- trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-location-expected.txt 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-location-expected.txt 2016-08-16 06:50:58 UTC (rev 204500)
@@ -1,10 +1,10 @@
CONSOLE MESSAGE: line 7: The XSS Auditor blocked access to 'http://localhost:8000/security/xssAuditor/resources/echo-intertag.pl?test=/security/xssAuditor/block-does-not-leak-location.html&enable-full-block=1&q=%3Cscript%3Ealert(String.fromCharCode(0x58,0x53,0x53));%3C/script%3E' because the source code of a script was found within the request. The server sent an 'X-XSS-Protection' header requesting this behavior.
-CONSOLE MESSAGE: line 172: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
-CONSOLE MESSAGE: line 172: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
-CONSOLE MESSAGE: line 176: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
-CONSOLE MESSAGE: line 347: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
-CONSOLE MESSAGE: line 172: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
-CONSOLE MESSAGE: line 176: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 218: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 218: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 222: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 526: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 218: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 222: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
PASS xssed.contentDocument is null
PASS xssed.contentDocument is crossorigin.contentDocument
PASS xssed.contentWindow.location.href is undefined.
Modified: trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-referrer-expected.txt (204499 => 204500)
--- trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-referrer-expected.txt 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-referrer-expected.txt 2016-08-16 06:50:58 UTC (rev 204500)
@@ -1,5 +1,5 @@
CONSOLE MESSAGE: line 4: The XSS Auditor blocked access to 'http://localhost:8000/security/xssAuditor/resources/echo-intertag.pl?enable-full-block=1&q=%3Cscript%3Ealert(String.fromCharCode(0x58,0x53,0x53))%3C/script%3E' because the source code of a script was found within the request. The server sent an 'X-XSS-Protection' header requesting this behavior.
-CONSOLE MESSAGE: line 172: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 218: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
PASS frame.contentDocument is null
PASS successfullyParsed is true
Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/websocket-constructor-protocols-expected.txt (0 => 204500)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/websocket-constructor-protocols-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/websocket-constructor-protocols-expected.txt 2016-08-16 06:50:58 UTC (rev 204500)
@@ -0,0 +1,21 @@
+CONSOLE MESSAGE: line 1: Wrong protocol for WebSocket 'a@'
+CONSOLE MESSAGE: line 1: Wrong protocol for WebSocket 'b@'
+CONSOLE MESSAGE: line 1: Wrong protocol for WebSocket 'c@'
+CONSOLE MESSAGE: line 1: Wrong protocol for WebSocket 'd@'
+CONSOLE MESSAGE: line 1: Wrong protocol for WebSocket 'e@'
+Construct a WebSocket with multiple protocols. It should throw an appropriate exception.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new WebSocket(url, ["a@"]) threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS new WebSocket(url, new Set(["b@"])) threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS x = { toString: () => "a", [Symbol.iterator]: function* () { yield "c@"; } }; new WebSocket(url, x) threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS x = { toString: () => "d@", [Symbol.iterator]: null }; new WebSocket(url, x) threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS x = { toString: () => "a", [Symbol.iterator]: 1 }; new WebSocket(url, x) threw exception TypeError: Symbol.iterator property should be callable.
+PASS x = { [Symbol.iterator]: function* () { yield "e@"; } }; new WebSocket(url, x) threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS x = { [Symbol.iterator]: function* () { throw {name: "SomeError", toString: () => "Some error" }; } }; new WebSocket(url, x) threw exception Some error.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/websocket-constructor-protocols.html (0 => 204500)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/websocket-constructor-protocols.html (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/websocket-constructor-protocols.html 2016-08-16 06:50:58 UTC (rev 204500)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<script>
+description('Construct a WebSocket with multiple protocols. It should throw an appropriate exception.');
+
+var url = ""
+shouldThrowErrorName('new WebSocket(url, ["a@"])', 'SyntaxError');
+shouldThrowErrorName('new WebSocket(url, new Set(["b@"]))', 'SyntaxError');
+shouldThrowErrorName('x = { toString: () => "a", [Symbol.iterator]: function* () { yield "c@"; } }; new WebSocket(url, x)', 'SyntaxError');
+shouldThrowErrorName('x = { toString: () => "d@", [Symbol.iterator]: null }; new WebSocket(url, x)', 'SyntaxError');
+shouldThrowErrorName('x = { toString: () => "a", [Symbol.iterator]: 1 }; new WebSocket(url, x)', 'TypeError');
+shouldThrowErrorName('x = { [Symbol.iterator]: function* () { yield "e@"; } }; new WebSocket(url, x)', 'SyntaxError');
+shouldThrowErrorName('x = { [Symbol.iterator]: function* () { throw {name: "SomeError", toString: () => "Some error" }; } }; new WebSocket(url, x)', 'SomeError');
+
+</script>
+<script src=""
+</body>
Modified: trunk/Source/_javascript_Core/ChangeLog (204499 => 204500)
--- trunk/Source/_javascript_Core/ChangeLog 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-08-16 06:50:58 UTC (rev 204500)
@@ -1,3 +1,15 @@
+2016-08-15 Ryosuke Niwa <[email protected]>
+
+ Conversion to sequence<T> is broken for iterable objects
+ https://bugs.webkit.org/show_bug.cgi?id=160801
+
+ Reviewed by Darin Adler.
+
+ Export functions used to iterate over iterable objects.
+
+ * runtime/IteratorOperations.h:
+ (JSC::forEachInIterable):
+
2016-08-15 Benjamin Poulain <[email protected]>
[Regression 204203-204210] 32-bit ASSERTION FAILED: !m_data[index].name.isValid()
Modified: trunk/Source/_javascript_Core/runtime/IteratorOperations.h (204499 => 204500)
--- trunk/Source/_javascript_Core/runtime/IteratorOperations.h 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/Source/_javascript_Core/runtime/IteratorOperations.h 2016-08-16 06:50:58 UTC (rev 204500)
@@ -33,15 +33,15 @@
JSValue iteratorNext(ExecState*, JSValue iterator, JSValue);
JSValue iteratorNext(ExecState*, JSValue iterator);
-JSValue iteratorValue(ExecState*, JSValue iterator);
+JS_EXPORT_PRIVATE JSValue iteratorValue(ExecState*, JSValue iterator);
bool iteratorComplete(ExecState*, JSValue iterator);
-JSValue iteratorStep(ExecState*, JSValue iterator);
-void iteratorClose(ExecState*, JSValue iterator);
+JS_EXPORT_PRIVATE JSValue iteratorStep(ExecState*, JSValue iterator);
+JS_EXPORT_PRIVATE void iteratorClose(ExecState*, JSValue iterator);
JS_EXPORT_PRIVATE JSObject* createIteratorResultObject(ExecState*, JSValue, bool done);
Structure* createIteratorResultObjectStructure(VM&, JSGlobalObject&);
-JSValue iteratorForIterable(ExecState*, JSValue iterable);
+JS_EXPORT_PRIVATE JSValue iteratorForIterable(ExecState*, JSValue iterable);
template <typename CallBackType>
void forEachInIterable(ExecState* state, JSValue iterable, const CallBackType& callback)
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (204499 => 204500)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2016-08-16 06:50:58 UTC (rev 204500)
@@ -773,7 +773,7 @@
return &m_butterfly;
}
- JSValue getMethod(ExecState* exec, CallData& callData, CallType& callType, const Identifier& ident, const String& errorMessage);
+ JS_EXPORT_PRIVATE JSValue getMethod(ExecState*, CallData&, CallType&, const Identifier&, const String& errorMessage);
DECLARE_EXPORT_INFO;
Modified: trunk/Source/WebCore/ChangeLog (204499 => 204500)
--- trunk/Source/WebCore/ChangeLog 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/Source/WebCore/ChangeLog 2016-08-16 06:50:58 UTC (rev 204500)
@@ -1,3 +1,48 @@
+2016-08-15 Ryosuke Niwa <[email protected]>
+
+ Conversion to sequence<T> is broken for iterable objects
+ https://bugs.webkit.org/show_bug.cgi?id=160801
+
+ Reviewed by Darin Adler.
+
+ Added the proper iterator support for sequence<T> with one caveat that we don't check for RegExp object
+ per https://github.com/heycam/webidl/issues/145.
+
+ See http://heycam.github.io/webidl/#es-sequence and http://heycam.github.io/webidl/#es-overloads
+
+ Tests: bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl
+
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::hasIteratorMethod): Added. A helper function for checking whether a JSValue is iterable or not.
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::NativeValueTraits<unsigned>::nativeValue): Removed the check for isNumber to match the spec'ed
+ behavior at http://heycam.github.io/webidl/#es-unsigned-long which calls ToNumber first without checking
+ whether the value is a number or not.
+ (WebCore::toRefPtrNativeArray): Replaced isJSArray check by isObject check and throw a TypeError. Deployed
+ forEachInIterable to support non-JSArray iterable objects. Also removed the function pointer from the third
+ argument since we were always calling JSCT::toWrapped.
+ (WebCore::toNativeArray): Ditto.
+ * bindings/js/JSDOMConvert.h:
+ (WebCore::Converter<Vector<T>>::convert): Removed the comment about toNativeArray not throwing when value
+ is not an object.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateOverloadedFunctionOrConstructor): Removed the check for isJSArray for sequence<T> as an iterable
+ object is not necessary a JSArray.
+ (WillConvertUndefinedToDefaultParameterValue): Don't return 1 for all sequences since toNativeArray and
+ toRefPtrNativeArray now throws on undefined due to isObject check.
+ (JSValueToNative): Removed the third argument from toRefPtrNativeArray.
+
+ * bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.cpp: Added.
+ * bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.h: Added.
+ * bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequencePrivate.h: Added.
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceIsEmpty):
+ * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: Added.
+ * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h: Added.
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ (WebCore::jsTestTypedefsPrototypeFunctionFunc):
+ * bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl: Added.
+
2016-08-15 Chris Dumez <[email protected]>
Rename RegisteredEventListener::listener() to callback() for clarity
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (204499 => 204500)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2016-08-16 06:50:58 UTC (rev 204500)
@@ -365,6 +365,22 @@
#undef TRY_TO_CREATE_EXCEPTION
+bool hasIteratorMethod(JSC::ExecState& state, JSC::JSValue value)
+{
+ if (!value.isObject())
+ return false;
+
+ auto& vm = state.vm();
+ JSObject* object = JSC::asObject(value);
+ CallData callData;
+ CallType callType;
+ JSValue applyMethod = object->getMethod(&state, callData, callType, vm.propertyNames->iteratorSymbol, ASCIILiteral("Symbol.iterator property should be callable"));
+ if (vm.exception())
+ return false;
+
+ return !applyMethod.isUndefined();
+}
+
bool shouldAllowAccessToNode(ExecState* exec, Node* node)
{
return BindingSecurity::shouldAllowAccessToNode(exec, node);
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (204499 => 204500)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-08-16 06:50:58 UTC (rev 204500)
@@ -285,9 +285,10 @@
RefPtr<JSC::Float32Array> toFloat32Array(JSC::JSValue);
RefPtr<JSC::Float64Array> toFloat64Array(JSC::JSValue);
-template<typename T, typename JSType> Vector<RefPtr<T>> toRefPtrNativeArray(JSC::ExecState*, JSC::JSValue, T* (*)(JSC::JSValue));
+template<typename T, typename JSType> Vector<RefPtr<T>> toRefPtrNativeArray(JSC::ExecState*, JSC::JSValue);
template<typename T> Vector<T> toNativeArray(JSC::ExecState&, JSC::JSValue);
template<typename T> Vector<T> toNativeArguments(JSC::ExecState&, size_t startIndex = 0);
+bool hasIteratorMethod(JSC::ExecState&, JSC::JSValue);
bool shouldAllowAccessToNode(JSC::ExecState*, Node*);
bool shouldAllowAccessToFrame(JSC::ExecState*, Frame*);
@@ -674,14 +675,8 @@
template<> struct NativeValueTraits<unsigned> {
static inline bool nativeValue(JSC::ExecState& exec, JSC::JSValue jsValue, unsigned& indexedValue)
{
- if (!jsValue.isNumber())
- return false;
-
indexedValue = jsValue.toUInt32(&exec);
- if (exec.hadException())
- return false;
-
- return true;
+ return !exec.hadException();
}
};
@@ -701,50 +696,38 @@
}
};
-template<typename T, typename JST> Vector<RefPtr<T>> toRefPtrNativeArray(JSC::ExecState* exec, JSC::JSValue value, T* (*toT)(JSC::JSValue value))
+template<typename T, typename JST> Vector<RefPtr<T>> toRefPtrNativeArray(JSC::ExecState& exec, JSC::JSValue value)
{
- if (!isJSArray(value))
+ if (!value.isObject()) {
+ throwSequenceTypeError(exec);
return Vector<RefPtr<T>>();
+ }
Vector<RefPtr<T>> result;
- JSC::JSArray* array = asArray(value);
- size_t size = array->length();
- result.reserveInitialCapacity(size);
- for (size_t i = 0; i < size; ++i) {
- JSC::JSValue element = array->getIndex(exec, i);
- if (element.inherits(JST::info()))
- result.uncheckedAppend((*toT)(element));
- else {
- throwArrayElementTypeError(*exec);
- return Vector<RefPtr<T>>();
- }
- }
+ forEachInIterable(&exec, value, [&result](JSC::VM&, JSC::ExecState* state, JSC::JSValue jsValue) {
+ if (jsValue.inherits(JST::info()))
+ result.append(JST::toWrapped(jsValue));
+ else
+ throwArrayElementTypeError(*state);
+ });
return result;
}
template<typename T> Vector<T> toNativeArray(JSC::ExecState& exec, JSC::JSValue value)
{
- JSC::JSObject* object = value.getObject();
- if (!object)
+ if (!value.isObject()) {
+ throwSequenceTypeError(exec);
return Vector<T>();
+ }
- unsigned length = 0;
- if (isJSArray(value)) {
- JSC::JSArray* array = asArray(value);
- length = array->length();
- } else
- toJSSequence(exec, value, length);
-
Vector<T> result;
- result.reserveInitialCapacity(length);
- typedef NativeValueTraits<T> TraitsType;
-
- for (unsigned i = 0; i < length; ++i) {
- T indexValue;
- if (!TraitsType::nativeValue(exec, object->get(&exec, i), indexValue))
- return Vector<T>();
- result.uncheckedAppend(indexValue);
- }
+ forEachInIterable(&exec, value, [&result](JSC::VM&, JSC::ExecState* state, JSC::JSValue jsValue) {
+ T convertedValue;
+ if (!NativeValueTraits<T>::nativeValue(*state, jsValue, convertedValue))
+ return;
+ ASSERT(!state->hadException());
+ result.append(convertedValue);
+ });
return result;
}
Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (204499 => 204500)
--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h 2016-08-16 06:50:58 UTC (rev 204500)
@@ -142,7 +142,6 @@
template<typename T> struct Converter<Vector<T>> : DefaultConverter<Vector<T>> {
static Vector<T> convert(JSC::ExecState& state, JSC::JSValue value)
{
- // FIXME: The toNativeArray function doesn't throw a type error if the value is not an object. Is that OK?
return toNativeArray<T>(state, value);
}
};
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (204499 => 204500)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-08-16 06:50:58 UTC (rev 204500)
@@ -1924,8 +1924,9 @@
$overload = GetOverloadThatMatches($S, $d, \&$isObjectOrCallbackFunctionParameter);
&$generateOverloadCallIfNecessary($overload, "distinguishingArg.isFunction()");
+ # FIXME: Avoid invoking GetMethod(object, Symbol.iterator) again in toNativeArray and toRefPtrNativeArray.
$overload = GetOverloadThatMatches($S, $d, \&$isSequenceParameter);
- &$generateOverloadCallIfNecessary($overload, "distinguishingArg.isObject() && isJSArray(distinguishingArg)");
+ &$generateOverloadCallIfNecessary($overload, "hasIteratorMethod(*state, distinguishingArg)");
$overload = GetOverloadThatMatches($S, $d, \&$isDictionaryOrObjectOrCallbackInterfaceParameter);
&$generateOverloadCallIfNecessary($overload, "distinguishingArg.isObject() && asObject(distinguishingArg)->type() != RegExpObjectType");
@@ -3781,9 +3782,6 @@
my $automaticallyGeneratedDefaultValue = $automaticallyGeneratedDefaultValues{$parameterType};
return 1 if defined $automaticallyGeneratedDefaultValue && $automaticallyGeneratedDefaultValue eq $defaultValue;
- # toRefPtrNativeArray() will convert undefined to an empty Vector.
- return 1 if $defaultValue eq "[]" && $codeGenerator->GetSequenceType($parameterType);
-
return 1 if $defaultValue eq "null" && $codeGenerator->IsWrapperType($parameterType);
return 0;
@@ -4667,7 +4665,7 @@
if ($sequenceType) {
if ($codeGenerator->IsRefPtrType($sequenceType)) {
AddToImplIncludes("JS${sequenceType}.h");
- return ("(toRefPtrNativeArray<${sequenceType}, JS${sequenceType}>(state, $value, &JS${sequenceType}::toWrapped))", 1);
+ return ("toRefPtrNativeArray<${sequenceType}, JS${sequenceType}>(*state, $value)", 1);
}
return ("toNativeArray<" . GetNativeVectorInnerType($sequenceType) . ">(*state, $value)", 1);
}
Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.cpp (0 => 204500)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.cpp 2016-08-16 06:50:58 UTC (rev 204500)
@@ -0,0 +1,104 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitDOMTestOverloadedConstructorsWithSequence.h"
+
+#include "CSSImportRule.h"
+#include "DOMObjectCache.h"
+#include "Document.h"
+#include "ExceptionCode.h"
+#include "ExceptionCodeDescription.h"
+#include "JSMainThreadExecState.h"
+#include "WebKitDOMPrivate.h"
+#include "WebKitDOMTestOverloadedConstructorsWithSequencePrivate.h"
+#include "gobject/ConvertToUTF8String.h"
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+
+#define WEBKIT_DOM_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE, WebKitDOMTestOverloadedConstructorsWithSequencePrivate)
+
+typedef struct _WebKitDOMTestOverloadedConstructorsWithSequencePrivate {
+ RefPtr<WebCore::TestOverloadedConstructorsWithSequence> coreObject;
+} WebKitDOMTestOverloadedConstructorsWithSequencePrivate;
+
+namespace WebKit {
+
+WebKitDOMTestOverloadedConstructorsWithSequence* kit(WebCore::TestOverloadedConstructorsWithSequence* obj)
+{
+ if (!obj)
+ return 0;
+
+ if (gpointer ret = DOMObjectCache::get(obj))
+ return WEBKIT_DOM_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE(ret);
+
+ return wrapTestOverloadedConstructorsWithSequence(obj);
+}
+
+WebCore::TestOverloadedConstructorsWithSequence* core(WebKitDOMTestOverloadedConstructorsWithSequence* request)
+{
+ return request ? static_cast<WebCore::TestOverloadedConstructorsWithSequence*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
+}
+
+WebKitDOMTestOverloadedConstructorsWithSequence* wrapTestOverloadedConstructorsWithSequence(WebCore::TestOverloadedConstructorsWithSequence* coreObject)
+{
+ ASSERT(coreObject);
+ return WEBKIT_DOM_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE(g_object_new(WEBKIT_DOM_TYPE_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE, "core-object", coreObject, nullptr));
+}
+
+} // namespace WebKit
+
+G_DEFINE_TYPE(WebKitDOMTestOverloadedConstructorsWithSequence, webkit_dom_test_overloaded_constructors_with_sequence, WEBKIT_DOM_TYPE_OBJECT)
+
+static void webkit_dom_test_overloaded_constructors_with_sequence_finalize(GObject* object)
+{
+ WebKitDOMTestOverloadedConstructorsWithSequencePrivate* priv = WEBKIT_DOM_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE_GET_PRIVATE(object);
+
+ WebKit::DOMObjectCache::forget(priv->coreObject.get());
+
+ priv->~WebKitDOMTestOverloadedConstructorsWithSequencePrivate();
+ G_OBJECT_CLASS(webkit_dom_test_overloaded_constructors_with_sequence_parent_class)->finalize(object);
+}
+
+static GObject* webkit_dom_test_overloaded_constructors_with_sequence_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties)
+{
+ GObject* object = G_OBJECT_CLASS(webkit_dom_test_overloaded_constructors_with_sequence_parent_class)->constructor(type, constructPropertiesCount, constructProperties);
+
+ WebKitDOMTestOverloadedConstructorsWithSequencePrivate* priv = WEBKIT_DOM_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE_GET_PRIVATE(object);
+ priv->coreObject = static_cast<WebCore::TestOverloadedConstructorsWithSequence*>(WEBKIT_DOM_OBJECT(object)->coreObject);
+ WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
+
+ return object;
+}
+
+static void webkit_dom_test_overloaded_constructors_with_sequence_class_init(WebKitDOMTestOverloadedConstructorsWithSequenceClass* requestClass)
+{
+ GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
+ g_type_class_add_private(gobjectClass, sizeof(WebKitDOMTestOverloadedConstructorsWithSequencePrivate));
+ gobjectClass->constructor = webkit_dom_test_overloaded_constructors_with_sequence_constructor;
+ gobjectClass->finalize = webkit_dom_test_overloaded_constructors_with_sequence_finalize;
+}
+
+static void webkit_dom_test_overloaded_constructors_with_sequence_init(WebKitDOMTestOverloadedConstructorsWithSequence* request)
+{
+ WebKitDOMTestOverloadedConstructorsWithSequencePrivate* priv = WEBKIT_DOM_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE_GET_PRIVATE(request);
+ new (priv) WebKitDOMTestOverloadedConstructorsWithSequencePrivate();
+}
+
Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.h (0 => 204500)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.h (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.h 2016-08-16 06:50:58 UTC (rev 204500)
@@ -0,0 +1,53 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitDOMTestOverloadedConstructorsWithSequence_h
+#define WebKitDOMTestOverloadedConstructorsWithSequence_h
+
+#ifdef WEBKIT_DOM_USE_UNSTABLE_API
+
+#include <glib-object.h>
+#include <webkitdom/WebKitDOMObject.h>
+#include <webkitdom/webkitdomdefines-unstable.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_DOM_TYPE_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE (webkit_dom_test_overloaded_constructors_with_sequence_get_type())
+#define WEBKIT_DOM_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_DOM_TYPE_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE, WebKitDOMTestOverloadedConstructorsWithSequence))
+#define WEBKIT_DOM_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_DOM_TYPE_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE, WebKitDOMTestOverloadedConstructorsWithSequenceClass)
+#define WEBKIT_DOM_IS_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_DOM_TYPE_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE))
+#define WEBKIT_DOM_IS_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_DOM_TYPE_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE))
+#define WEBKIT_DOM_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_DOM_TYPE_TEST_OVERLOADED_CONSTRUCTORS_WITH_SEQUENCE, WebKitDOMTestOverloadedConstructorsWithSequenceClass))
+
+struct _WebKitDOMTestOverloadedConstructorsWithSequence {
+ WebKitDOMObject parent_instance;
+};
+
+struct _WebKitDOMTestOverloadedConstructorsWithSequenceClass {
+ WebKitDOMObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_dom_test_overloaded_constructors_with_sequence_get_type(void);
+
+G_END_DECLS
+
+#endif /* WEBKIT_DOM_USE_UNSTABLE_API */
+#endif /* WebKitDOMTestOverloadedConstructorsWithSequence_h */
Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequencePrivate.h (0 => 204500)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequencePrivate.h (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequencePrivate.h 2016-08-16 06:50:58 UTC (rev 204500)
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitDOMTestOverloadedConstructorsWithSequencePrivate_h
+#define WebKitDOMTestOverloadedConstructorsWithSequencePrivate_h
+
+#include "TestOverloadedConstructorsWithSequence.h"
+#include <webkitdom/WebKitDOMTestOverloadedConstructorsWithSequence.h>
+
+namespace WebKit {
+WebKitDOMTestOverloadedConstructorsWithSequence* wrapTestOverloadedConstructorsWithSequence(WebCore::TestOverloadedConstructorsWithSequence*);
+WebKitDOMTestOverloadedConstructorsWithSequence* kit(WebCore::TestOverloadedConstructorsWithSequence*);
+WebCore::TestOverloadedConstructorsWithSequence* core(WebKitDOMTestOverloadedConstructorsWithSequence*);
+} // namespace WebKit
+
+#endif /* WebKitDOMTestOverloadedConstructorsWithSequencePrivate_h */
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (204499 => 204500)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-08-16 06:50:58 UTC (rev 204500)
@@ -5172,7 +5172,7 @@
return throwThisTypeError(*state, "TestObject", "methodWithOptionalSequenceIsEmpty");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto array = toNativeArray<String>(*state, state->argument(0));
+ auto array = state->argument(0).isUndefined() ? Vector<String>() : toNativeArray<String>(*state, state->uncheckedArgument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalSequenceIsEmpty(WTFMove(array));
@@ -5701,7 +5701,7 @@
return jsTestObjPrototypeFunctionOverloadedMethod8(state);
if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits(JSBlob::info()))
return jsTestObjPrototypeFunctionOverloadedMethod12(state);
- if (distinguishingArg.isObject() && isJSArray(distinguishingArg))
+ if (hasIteratorMethod(*state, distinguishingArg))
return jsTestObjPrototypeFunctionOverloadedMethod7(state);
if (distinguishingArg.isObject() && asObject(distinguishingArg)->type() != RegExpObjectType)
return jsTestObjPrototypeFunctionOverloadedMethod5(state);
Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp (0 => 204500)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp 2016-08-16 06:50:58 UTC (rev 204500)
@@ -0,0 +1,243 @@
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "JSTestOverloadedConstructorsWithSequence.h"
+
+#include "ExceptionCode.h"
+#include "JSDOMBinding.h"
+#include "JSDOMConstructor.h"
+#include <runtime/Error.h>
+#include <runtime/FunctionPrototype.h>
+#include <wtf/GetPtr.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+// Attributes
+
+JSC::EncodedJSValue jsTestOverloadedConstructorsWithSequenceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestOverloadedConstructorsWithSequenceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+
+class JSTestOverloadedConstructorsWithSequencePrototype : public JSC::JSNonFinalObject {
+public:
+ typedef JSC::JSNonFinalObject Base;
+ static JSTestOverloadedConstructorsWithSequencePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
+ {
+ JSTestOverloadedConstructorsWithSequencePrototype* ptr = new (NotNull, JSC::allocateCell<JSTestOverloadedConstructorsWithSequencePrototype>(vm.heap)) JSTestOverloadedConstructorsWithSequencePrototype(vm, globalObject, structure);
+ ptr->finishCreation(vm);
+ return ptr;
+ }
+
+ DECLARE_INFO;
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+private:
+ JSTestOverloadedConstructorsWithSequencePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+ : JSC::JSNonFinalObject(vm, structure)
+ {
+ }
+
+ void finishCreation(JSC::VM&);
+};
+
+typedef JSDOMConstructor<JSTestOverloadedConstructorsWithSequence> JSTestOverloadedConstructorsWithSequenceConstructor;
+
+static inline EncodedJSValue constructJSTestOverloadedConstructorsWithSequence1(ExecState* state)
+{
+ auto* castedThis = jsCast<JSTestOverloadedConstructorsWithSequenceConstructor*>(state->callee());
+ auto sequenceOfStrings = state->argument(0).isUndefined() ? Vector<String>() : toNativeArray<String>(*state, state->uncheckedArgument(0));
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ auto object = TestOverloadedConstructorsWithSequence::create(sequenceOfStrings);
+ return JSValue::encode(asObject(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))));
+}
+
+static inline EncodedJSValue constructJSTestOverloadedConstructorsWithSequence2(ExecState* state)
+{
+ auto* castedThis = jsCast<JSTestOverloadedConstructorsWithSequenceConstructor*>(state->callee());
+ if (UNLIKELY(state->argumentCount() < 1))
+ return throwVMError(state, createNotEnoughArgumentsError(state));
+ auto string = state->argument(0).toWTFString(state);
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ auto object = TestOverloadedConstructorsWithSequence::create(string);
+ return JSValue::encode(asObject(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))));
+}
+
+template<> EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsWithSequenceConstructor::construct(ExecState* state)
+{
+ size_t argsCount = std::min<size_t>(1, state->argumentCount());
+ if (argsCount == 0) {
+ return constructJSTestOverloadedConstructorsWithSequence1(state);
+ }
+ if (argsCount == 1) {
+ JSValue distinguishingArg = state->uncheckedArgument(0);
+ if (distinguishingArg.isUndefined())
+ return constructJSTestOverloadedConstructorsWithSequence1(state);
+ if (hasIteratorMethod(*state, distinguishingArg))
+ return constructJSTestOverloadedConstructorsWithSequence1(state);
+ return constructJSTestOverloadedConstructorsWithSequence2(state);
+ }
+ return throwVMTypeError(state);
+}
+
+template<> JSValue JSTestOverloadedConstructorsWithSequenceConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
+{
+ UNUSED_PARAM(vm);
+ return globalObject.functionPrototype();
+}
+
+template<> void JSTestOverloadedConstructorsWithSequenceConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
+{
+ putDirect(vm, vm.propertyNames->prototype, JSTestOverloadedConstructorsWithSequence::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
+ putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestOverloadedConstructorsWithSequence"))), ReadOnly | DontEnum);
+ putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
+}
+
+template<> const ClassInfo JSTestOverloadedConstructorsWithSequenceConstructor::s_info = { "TestOverloadedConstructorsWithSequence", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestOverloadedConstructorsWithSequenceConstructor) };
+
+/* Hash table for prototype */
+
+static const HashTableValue JSTestOverloadedConstructorsWithSequencePrototypeTableValues[] =
+{
+ { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestOverloadedConstructorsWithSequenceConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestOverloadedConstructorsWithSequenceConstructor) } },
+};
+
+const ClassInfo JSTestOverloadedConstructorsWithSequencePrototype::s_info = { "TestOverloadedConstructorsWithSequencePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestOverloadedConstructorsWithSequencePrototype) };
+
+void JSTestOverloadedConstructorsWithSequencePrototype::finishCreation(VM& vm)
+{
+ Base::finishCreation(vm);
+ reifyStaticProperties(vm, JSTestOverloadedConstructorsWithSequencePrototypeTableValues, *this);
+}
+
+const ClassInfo JSTestOverloadedConstructorsWithSequence::s_info = { "TestOverloadedConstructorsWithSequence", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestOverloadedConstructorsWithSequence) };
+
+JSTestOverloadedConstructorsWithSequence::JSTestOverloadedConstructorsWithSequence(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestOverloadedConstructorsWithSequence>&& impl)
+ : JSDOMWrapper<TestOverloadedConstructorsWithSequence>(structure, globalObject, WTFMove(impl))
+{
+}
+
+JSObject* JSTestOverloadedConstructorsWithSequence::createPrototype(VM& vm, JSGlobalObject* globalObject)
+{
+ return JSTestOverloadedConstructorsWithSequencePrototype::create(vm, globalObject, JSTestOverloadedConstructorsWithSequencePrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
+}
+
+JSObject* JSTestOverloadedConstructorsWithSequence::prototype(VM& vm, JSGlobalObject* globalObject)
+{
+ return getDOMPrototype<JSTestOverloadedConstructorsWithSequence>(vm, globalObject);
+}
+
+void JSTestOverloadedConstructorsWithSequence::destroy(JSC::JSCell* cell)
+{
+ JSTestOverloadedConstructorsWithSequence* thisObject = static_cast<JSTestOverloadedConstructorsWithSequence*>(cell);
+ thisObject->JSTestOverloadedConstructorsWithSequence::~JSTestOverloadedConstructorsWithSequence();
+}
+
+EncodedJSValue jsTestOverloadedConstructorsWithSequenceConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ JSTestOverloadedConstructorsWithSequencePrototype* domObject = jsDynamicCast<JSTestOverloadedConstructorsWithSequencePrototype*>(JSValue::decode(thisValue));
+ if (UNLIKELY(!domObject))
+ return throwVMTypeError(state);
+ return JSValue::encode(JSTestOverloadedConstructorsWithSequence::getConstructor(state->vm(), domObject->globalObject()));
+}
+
+bool setJSTestOverloadedConstructorsWithSequenceConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ JSValue value = JSValue::decode(encodedValue);
+ JSTestOverloadedConstructorsWithSequencePrototype* domObject = jsDynamicCast<JSTestOverloadedConstructorsWithSequencePrototype*>(JSValue::decode(thisValue));
+ if (UNLIKELY(!domObject)) {
+ throwVMTypeError(state);
+ return false;
+ }
+ // Shadowing a built-in constructor
+ return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
+}
+
+JSValue JSTestOverloadedConstructorsWithSequence::getConstructor(VM& vm, const JSGlobalObject* globalObject)
+{
+ return getDOMConstructor<JSTestOverloadedConstructorsWithSequenceConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
+}
+
+bool JSTestOverloadedConstructorsWithSequenceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
+{
+ UNUSED_PARAM(handle);
+ UNUSED_PARAM(visitor);
+ return false;
+}
+
+void JSTestOverloadedConstructorsWithSequenceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
+{
+ auto* jsTestOverloadedConstructorsWithSequence = jsCast<JSTestOverloadedConstructorsWithSequence*>(handle.slot()->asCell());
+ auto& world = *static_cast<DOMWrapperWorld*>(context);
+ uncacheWrapper(world, &jsTestOverloadedConstructorsWithSequence->wrapped(), jsTestOverloadedConstructorsWithSequence);
+}
+
+#if ENABLE(BINDING_INTEGRITY)
+#if PLATFORM(WIN)
+#pragma warning(disable: 4483)
+extern "C" { extern void (*const __identifier("??_7TestOverloadedConstructorsWithSequence@WebCore@@6B@")[])(); }
+#else
+extern "C" { extern void* _ZTVN7WebCore38TestOverloadedConstructorsWithSequenceE[]; }
+#endif
+#endif
+
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestOverloadedConstructorsWithSequence>&& impl)
+{
+
+#if ENABLE(BINDING_INTEGRITY)
+ void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
+#if PLATFORM(WIN)
+ void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestOverloadedConstructorsWithSequence@WebCore@@6B@"));
+#else
+ void* expectedVTablePointer = &_ZTVN7WebCore38TestOverloadedConstructorsWithSequenceE[2];
+#if COMPILER(CLANG)
+ // If this fails TestOverloadedConstructorsWithSequence does not have a vtable, so you need to add the
+ // ImplementationLacksVTable attribute to the interface definition
+ static_assert(__is_polymorphic(TestOverloadedConstructorsWithSequence), "TestOverloadedConstructorsWithSequence is not polymorphic");
+#endif
+#endif
+ // If you hit this assertion you either have a use after free bug, or
+ // TestOverloadedConstructorsWithSequence has subclasses. If TestOverloadedConstructorsWithSequence has subclasses that get passed
+ // to toJS() we currently require TestOverloadedConstructorsWithSequence you to opt out of binding hardening
+ // by adding the SkipVTableValidation attribute to the interface IDL definition
+ RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
+#endif
+ return createWrapper<JSTestOverloadedConstructorsWithSequence, TestOverloadedConstructorsWithSequence>(globalObject, WTFMove(impl));
+}
+
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestOverloadedConstructorsWithSequence& impl)
+{
+ return wrap(state, globalObject, impl);
+}
+
+TestOverloadedConstructorsWithSequence* JSTestOverloadedConstructorsWithSequence::toWrapped(JSC::JSValue value)
+{
+ if (auto* wrapper = jsDynamicCast<JSTestOverloadedConstructorsWithSequence*>(value))
+ return &wrapper->wrapped();
+ return nullptr;
+}
+
+}
Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h (0 => 204500)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h 2016-08-16 06:50:58 UTC (rev 204500)
@@ -0,0 +1,86 @@
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#pragma once
+
+#include "JSDOMWrapper.h"
+#include "TestOverloadedConstructorsWithSequence.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+class JSTestOverloadedConstructorsWithSequence : public JSDOMWrapper<TestOverloadedConstructorsWithSequence> {
+public:
+ typedef JSDOMWrapper<TestOverloadedConstructorsWithSequence> Base;
+ static JSTestOverloadedConstructorsWithSequence* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestOverloadedConstructorsWithSequence>&& impl)
+ {
+ JSTestOverloadedConstructorsWithSequence* ptr = new (NotNull, JSC::allocateCell<JSTestOverloadedConstructorsWithSequence>(globalObject->vm().heap)) JSTestOverloadedConstructorsWithSequence(structure, *globalObject, WTFMove(impl));
+ ptr->finishCreation(globalObject->vm());
+ return ptr;
+ }
+
+ static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
+ static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject*);
+ static TestOverloadedConstructorsWithSequence* toWrapped(JSC::JSValue);
+ static void destroy(JSC::JSCell*);
+
+ DECLARE_INFO;
+
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+ static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+protected:
+ JSTestOverloadedConstructorsWithSequence(JSC::Structure*, JSDOMGlobalObject&, Ref<TestOverloadedConstructorsWithSequence>&&);
+
+ void finishCreation(JSC::VM& vm)
+ {
+ Base::finishCreation(vm);
+ ASSERT(inherits(info()));
+ }
+
+};
+
+class JSTestOverloadedConstructorsWithSequenceOwner : public JSC::WeakHandleOwner {
+public:
+ virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
+ virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
+};
+
+inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestOverloadedConstructorsWithSequence*)
+{
+ static NeverDestroyed<JSTestOverloadedConstructorsWithSequenceOwner> owner;
+ return &owner.get();
+}
+
+inline void* wrapperKey(TestOverloadedConstructorsWithSequence* wrappableObject)
+{
+ return wrappableObject;
+}
+
+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestOverloadedConstructorsWithSequence&);
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestOverloadedConstructorsWithSequence* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestOverloadedConstructorsWithSequence>&&);
+inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestOverloadedConstructorsWithSequence>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
+
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (204499 => 204500)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-08-16 06:48:34 UTC (rev 204499)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-08-16 06:50:58 UTC (rev 204500)
@@ -453,7 +453,7 @@
return throwThisTypeError(*state, "TestTypedefs", "func");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
- auto x = toNativeArray<int32_t>(*state, state->argument(0));
+ auto x = state->argument(0).isUndefined() ? Vector<int32_t>() : toNativeArray<int32_t>(*state, state->uncheckedArgument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.func(WTFMove(x));
@@ -499,7 +499,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto sequenceArg = (toRefPtrNativeArray<SerializedScriptValue, JSSerializedScriptValue>(state, state->argument(0), &JSSerializedScriptValue::toWrapped));
+ auto sequenceArg = toRefPtrNativeArray<SerializedScriptValue, JSSerializedScriptValue>(*state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsNumber(impl.methodWithSequenceArg(WTFMove(sequenceArg)));
@@ -605,7 +605,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto sequenceArg = (toRefPtrNativeArray<TestEventTarget, JSTestEventTarget>(state, state->argument(0), &JSTestEventTarget::toWrapped));
+ auto sequenceArg = toRefPtrNativeArray<TestEventTarget, JSTestEventTarget>(*state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsBoolean(impl.callWithSequenceThatRequiresInclude(WTFMove(sequenceArg)));
Added: trunk/Source/WebCore/bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl (0 => 204500)
--- trunk/Source/WebCore/bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl 2016-08-16 06:50:58 UTC (rev 204500)
@@ -0,0 +1,30 @@
+/*
+* Copyright (C) 2016 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+ Constructor(optional sequence<DOMString> sequenceOfStrings = []),
+ Constructor(DOMString string),
+] interface TestOverloadedConstructorsWithSequence {
+};