<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[215894] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/215894">215894</a></dd>
<dt>Author</dt> <dd>ddkilzer@apple.com</dd>
<dt>Date</dt> <dd>2017-04-27 14:29:23 -0700 (Thu, 27 Apr 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Enhance shouldBe()/shouldNotBe() to accept anonymous function arguments
<https://webkit.org/b/171362>
<rdar://problem/31867686>
Reviewed by Joseph Pecoraro.
JSTests:
* stress/resources/standalone-pre.js:
(shouldBe):
(shouldNotThrow):
(shouldThrow):
- Update shouldBe() to accept anonymous function arguments.
(The shouldNotBe() function was never copied over.)
- Also fix shouldThrow()/shouldNotThrow() to accept anonymous
function arguments (which were missed in <a href="http://trac.webkit.org/projects/webkit/changeset/202609">r202609</a> for Bug
159232).
LayoutTests:
This change makes it possible to pass either the first or second
argument (or both) as anonymous functions into shouldBe() and
shouldNotBe() to make it easy to capture local variables when
writing tests. This is similar to the change in <a href="http://trac.webkit.org/projects/webkit/changeset/202609">r202609</a> for Bug
159232 for shouldThrow() and shouldNotThrow().
Note that shouldBe()/shouldNotBe() from the following files were
NOT updated since they were imported from other projects and did
share the full WebKit history of resources/js-test-pre.js:
http/tests/webgl/1.0.2/resources/webgl_test_files/resources/js-test-pre.js
js/mozilla/resources/js-test-pre.js
webgl/1.0.2/resources/webgl_test_files/resources/js-test-pre.js
webgl/1.0.3/resources/webgl_test_files/resources/js-test-pre.js
However, these files WERE brought up-to-date with the ability to
pass anonymous functions into shouldBe()/shouldNotBe() for this
bug, and shouldThrow()/shouldNotThrow() which should have
originally been fixed with Bug 159232:
http/tests/resources/js-test-pre.js
resources/standalone-pre.js
* css3/scroll-snap/resources/iframe-content.html: Drive-by fix
to debug message for copy-paste error. Found by searching
LayoutTests directory for "expects string arguments".
* fast/canvas/webgl/array-unit-tests-expected.txt: Update test
results.
* fast/canvas/webgl/array-unit-tests.html: Fix warning by making
second argument to shouldBe() a string.
* fast/css/script-tests/image-set-parsing.js:
(testImageSetRule): Remove comment by changing second argument
to shouldBe() into an anonymous function.
* http/tests/resources/js-test-pre.js:
(evalAndLog):
(evalAndLogResult):
(shouldBe):
(shouldNotBe):
(shouldEvaluateTo):
- Made a full copy of resources/js-test-pre.js to bring this up
to speed. Needs a checker written for it to keep them in sync.
* http/tests/security/xssAuditor/block-does-not-leak-location-expected.txt:
* http/tests/security/xssAuditor/block-does-not-leak-referrer-expected.txt:
- Update line numbers after updating http/tests/resources/js-test-pre.js.
* js/function-declarations-in-switch-statement-expected.txt:
- Update results after fixing warnings.
* js/script-tests/function-declarations-in-switch-statement.js:
- Fix warnings by passing in strings to shouldBe().
* js/script-tests/stack-unwinding.js:
- Update results after fixing warnings.
* js/stack-unwinding-expected.txt:
- Fix warnings by passing in strings to shouldBe().
* resources/js-test-pre.js:
(shouldBe):
(shouldNotBe):
* resources/js-test.js:
(shouldBe):
(shouldNotBe):
- Update shouldBe()/shouldNotBe() to accept anonymous function
arguments.
* resources/standalone-pre.js:
(shouldBe):
(shouldNotBe):
(shouldNotThrow):
(shouldThrow):
- Update shouldBe()/shouldNotBe() to accept anonymous function
arguments.
- Also fix shouldThrow()/shouldNotThrow() to accept anonymous
function arguments (which were missed in <a href="http://trac.webkit.org/projects/webkit/changeset/202609">r202609</a> for Bug
159232).</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTestsstressresourcesstandaloneprejs">trunk/JSTests/stress/resources/standalone-pre.js</a></li>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscss3scrollsnapresourcesiframecontenthtml">trunk/LayoutTests/css3/scroll-snap/resources/iframe-content.html</a></li>
<li><a href="#trunkLayoutTestsfastcanvaswebglarrayunittestsexpectedtxt">trunk/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcanvaswebglarrayunittestshtml">trunk/LayoutTests/fast/canvas/webgl/array-unit-tests.html</a></li>
<li><a href="#trunkLayoutTestsfastcssscripttestsimagesetparsingjs">trunk/LayoutTests/fast/css/script-tests/image-set-parsing.js</a></li>
<li><a href="#trunkLayoutTestshttptestsresourcesjstestprejs">trunk/LayoutTests/http/tests/resources/js-test-pre.js</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityxssAuditorblockdoesnotleaklocationexpectedtxt">trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-location-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityxssAuditorblockdoesnotleakreferrerexpectedtxt">trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-referrer-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsfunctiondeclarationsinswitchstatementexpectedtxt">trunk/LayoutTests/js/function-declarations-in-switch-statement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsfunctiondeclarationsinswitchstatementjs">trunk/LayoutTests/js/script-tests/function-declarations-in-switch-statement.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsstackunwindingjs">trunk/LayoutTests/js/script-tests/stack-unwinding.js</a></li>
<li><a href="#trunkLayoutTestsjsstackunwindingexpectedtxt">trunk/LayoutTests/js/stack-unwinding-expected.txt</a></li>
<li><a href="#trunkLayoutTestsresourcesjstestprejs">trunk/LayoutTests/resources/js-test-pre.js</a></li>
<li><a href="#trunkLayoutTestsresourcesjstestjs">trunk/LayoutTests/resources/js-test.js</a></li>
<li><a href="#trunkLayoutTestsresourcesstandaloneprejs">trunk/LayoutTests/resources/standalone-pre.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/JSTests/ChangeLog 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2017-04-27 David Kilzer <ddkilzer@apple.com>
+
+ Enhance shouldBe()/shouldNotBe() to accept anonymous function arguments
+ <https://webkit.org/b/171362>
+ <rdar://problem/31867686>
+
+ Reviewed by Joseph Pecoraro.
+
+ * stress/resources/standalone-pre.js:
+ (shouldBe):
+ (shouldNotThrow):
+ (shouldThrow):
+ - Update shouldBe() to accept anonymous function arguments.
+ (The shouldNotBe() function was never copied over.)
+ - Also fix shouldThrow()/shouldNotThrow() to accept anonymous
+ function arguments (which were missed in r202609 for Bug
+ 159232).
+
</ins><span class="cx"> 2017-04-27 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> [JSC] Handle PhantomSpread in LoadVarargs as the same to the others
</span></span></pre></div>
<a id="trunkJSTestsstressresourcesstandaloneprejs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/stress/resources/standalone-pre.js (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/stress/resources/standalone-pre.js 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/JSTests/stress/resources/standalone-pre.js 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -120,24 +120,26 @@
</span><span class="cx"> return "" + v;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function shouldBe(_a, _b)
</del><ins>+function shouldBe(_a, _b, quiet)
</ins><span class="cx"> {
</span><del>- if (typeof _a != "string" || typeof _b != "string")
- debug("WARN: shouldBe() expects string arguments");
</del><ins>+ if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
+ debug("WARN: shouldBe() expects function or string arguments");
</ins><span class="cx"> var exception;
</span><span class="cx"> var _av;
</span><span class="cx"> try {
</span><del>- _av = eval(_a);
</del><ins>+ _av = (typeof _a == "function" ? _a() : eval(_a));
</ins><span class="cx"> } catch (e) {
</span><del>- exception = e;
</del><ins>+ exception = e;
</ins><span class="cx"> }
</span><del>- var _bv = eval(_b);
</del><ins>+ var _bv = (typeof _b == "function" ? _b() : eval(_b));
</ins><span class="cx">
</span><span class="cx"> if (exception)
</span><span class="cx"> testFailed(_a + " should be " + stringify(_bv) + ". Threw exception " + exception);
</span><del>- else if (isResultCorrect(_av, _bv))
- testPassed(_a + " is " + _b);
- else if (typeof(_av) == typeof(_bv))
</del><ins>+ else if (isResultCorrect(_av, _bv)) {
+ if (!quiet) {
+ testPassed(_a + " is " + (typeof _b == "function" ? _bv : _b));
+ }
+ } else if (typeof(_av) == typeof(_bv))
</ins><span class="cx"> testFailed(_a + " should be " + stringify(_bv) + ". Was " + stringify(_av) + ".");
</span><span class="cx"> else
</span><span class="cx"> testFailed(_a + " should be " + stringify(_bv) + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
</span><span class="lines">@@ -233,38 +235,38 @@
</span><span class="cx"> testFailed(_a + " should be undefined. Was " + _av);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function shouldNotThrow(_a) {
</del><ins>+function shouldNotThrow(_a, _message) {
</ins><span class="cx"> try {
</span><del>- eval(_a);
- testPassed(_a + " did not throw exception.");
</del><ins>+ typeof _a == "function" ? _a() : eval(_a);
+ testPassed((_message ? _message : _a) + " did not throw exception.");
</ins><span class="cx"> } catch (e) {
</span><del>- testFailed(_a + " should not throw exception. Threw exception " + e + ".");
</del><ins>+ testFailed((_message ? _message : _a) + " should not throw exception. Threw exception " + e + ".");
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function shouldThrow(_a, _e)
</del><ins>+function shouldThrow(_a, _e, _message)
</ins><span class="cx"> {
</span><del>- var exception;
- var _av;
- try {
- _av = eval(_a);
- } catch (e) {
- exception = e;
- }
</del><ins>+ var _exception;
+ var _av;
+ try {
+ _av = typeof _a == "function" ? _a() : eval(_a);
+ } catch (e) {
+ _exception = e;
+ }
</ins><span class="cx">
</span><del>- var _ev;
- if (_e)
- _ev = eval(_e);
</del><ins>+ var _ev;
+ if (_e)
+ _ev = eval(_e);
</ins><span class="cx">
</span><del>- if (exception) {
- if (typeof _e == "undefined" || exception == _ev)
- testPassed(_a + " threw exception " + exception + ".");
</del><ins>+ 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.");
</ins><span class="cx"> else
</span><del>- 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 + ".");
</del><ins>+ testFailed((_message ? _message : _a) + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function isSuccessfullyParsed()
</span></span></pre></div>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/ChangeLog 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -1,3 +1,89 @@
</span><ins>+2017-04-27 David Kilzer <ddkilzer@apple.com>
+
+ Enhance shouldBe()/shouldNotBe() to accept anonymous function arguments
+ <https://webkit.org/b/171362>
+ <rdar://problem/31867686>
+
+ Reviewed by Joseph Pecoraro.
+
+ This change makes it possible to pass either the first or second
+ argument (or both) as anonymous functions into shouldBe() and
+ shouldNotBe() to make it easy to capture local variables when
+ writing tests. This is similar to the change in r202609 for Bug
+ 159232 for shouldThrow() and shouldNotThrow().
+
+ Note that shouldBe()/shouldNotBe() from the following files were
+ NOT updated since they were imported from other projects and did
+ share the full WebKit history of resources/js-test-pre.js:
+
+ http/tests/webgl/1.0.2/resources/webgl_test_files/resources/js-test-pre.js
+ js/mozilla/resources/js-test-pre.js
+ webgl/1.0.2/resources/webgl_test_files/resources/js-test-pre.js
+ webgl/1.0.3/resources/webgl_test_files/resources/js-test-pre.js
+
+ However, these files WERE brought up-to-date with the ability to
+ pass anonymous functions into shouldBe()/shouldNotBe() for this
+ bug, and shouldThrow()/shouldNotThrow() which should have
+ originally been fixed with Bug 159232:
+
+ http/tests/resources/js-test-pre.js
+ resources/standalone-pre.js
+
+ * css3/scroll-snap/resources/iframe-content.html: Drive-by fix
+ to debug message for copy-paste error. Found by searching
+ LayoutTests directory for "expects string arguments".
+
+ * fast/canvas/webgl/array-unit-tests-expected.txt: Update test
+ results.
+ * fast/canvas/webgl/array-unit-tests.html: Fix warning by making
+ second argument to shouldBe() a string.
+
+ * fast/css/script-tests/image-set-parsing.js:
+ (testImageSetRule): Remove comment by changing second argument
+ to shouldBe() into an anonymous function.
+
+ * http/tests/resources/js-test-pre.js:
+ (evalAndLog):
+ (evalAndLogResult):
+ (shouldBe):
+ (shouldNotBe):
+ (shouldEvaluateTo):
+ - Made a full copy of resources/js-test-pre.js to bring this up
+ to speed. Needs a checker written for it to keep them in sync.
+ * http/tests/security/xssAuditor/block-does-not-leak-location-expected.txt:
+ * http/tests/security/xssAuditor/block-does-not-leak-referrer-expected.txt:
+ - Update line numbers after updating http/tests/resources/js-test-pre.js.
+
+ * js/function-declarations-in-switch-statement-expected.txt:
+ - Update results after fixing warnings.
+ * js/script-tests/function-declarations-in-switch-statement.js:
+ - Fix warnings by passing in strings to shouldBe().
+
+ * js/script-tests/stack-unwinding.js:
+ - Update results after fixing warnings.
+ * js/stack-unwinding-expected.txt:
+ - Fix warnings by passing in strings to shouldBe().
+
+ * resources/js-test-pre.js:
+ (shouldBe):
+ (shouldNotBe):
+ * resources/js-test.js:
+ (shouldBe):
+ (shouldNotBe):
+ - Update shouldBe()/shouldNotBe() to accept anonymous function
+ arguments.
+
+ * resources/standalone-pre.js:
+ (shouldBe):
+ (shouldNotBe):
+ (shouldNotThrow):
+ (shouldThrow):
+ - Update shouldBe()/shouldNotBe() to accept anonymous function
+ arguments.
+ - Also fix shouldThrow()/shouldNotThrow() to accept anonymous
+ function arguments (which were missed in r202609 for Bug
+ 159232).
+
</ins><span class="cx"> 2017-04-27 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
</span></span></pre></div>
<a id="trunkLayoutTestscss3scrollsnapresourcesiframecontenthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/scroll-snap/resources/iframe-content.html (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/scroll-snap/resources/iframe-content.html 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/css3/scroll-snap/resources/iframe-content.html 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> function shouldMatch(_a, _b, result)
</span><span class="cx"> {
</span><span class="cx"> if (typeof _a !== "string" || typeof _b !== "string")
</span><del>- top.debug("WARN: shouldBeEqualToString() expects string arguments");
</del><ins>+ top.debug("WARN: shouldMatch() expects string arguments");
</ins><span class="cx">
</span><span class="cx"> var _av;
</span><span class="cx"> try {
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvaswebglarrayunittestsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -5,7 +5,6 @@
</span><span class="cx"> PASS testSlice
</span><span class="cx"> test inheritance hierarchy of typed array views
</span><span class="cx"> PASS ArrayBufferView should be undefined and is
</span><del>-WARN: shouldBe() expects string arguments
</del><span class="cx"> PASS new Uint8ClampedArray(1) instanceof Uint8Array is false
</span><span class="cx"> PASS test Float32Array SetAndGetPos10ToNeg10
</span><span class="cx"> PASS test Float32Array ConstructWithArrayOfSignedValues
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvaswebglarrayunittestshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/webgl/array-unit-tests.html (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/webgl/array-unit-tests.html 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/fast/canvas/webgl/array-unit-tests.html 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx"> testPassed('ArrayBufferView should be undefined and is');
</span><span class="cx"> }
</span><span class="cx">
</span><del>- shouldBe('new Uint8ClampedArray(1) instanceof Uint8Array', false);
</del><ins>+ shouldBe('new Uint8ClampedArray(1) instanceof Uint8Array', 'false');
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> //
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssscripttestsimagesetparsingjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/script-tests/image-set-parsing.js (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/script-tests/image-set-parsing.js 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/fast/css/script-tests/image-set-parsing.js 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- shouldBe("imageSetRule.length", "" + expectedLength); // shouldBe expects string arguments
</del><ins>+ shouldBe("imageSetRule.length", function() { return expectedLength; });
</ins><span class="cx">
</span><span class="cx"> if (imageSetRule) {
</span><span class="cx"> for (var i = 0; i < expectedLength; i++) {
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsresourcesjstestprejs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/resources/js-test-pre.js (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/resources/js-test-pre.js 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/http/tests/resources/js-test-pre.js 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -193,7 +193,7 @@
</span><span class="cx"> function evalAndLog(_a, _quiet)
</span><span class="cx"> {
</span><span class="cx"> if (typeof _a != "string")
</span><del>- debug("WARN: tryAndLog() expects a string argument");
</del><ins>+ debug("WARN: evalAndLog() expects a string argument");
</ins><span class="cx">
</span><span class="cx"> // Log first in case things go horribly wrong or this causes a sync event.
</span><span class="cx"> if (!_quiet)
</span><span class="lines">@@ -208,24 +208,39 @@
</span><span class="cx"> return _av;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+function evalAndLogResult(_a)
+{
+ if (typeof _a != "string")
+ debug("WARN: evalAndLogResult() expects a string argument");
+
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ testFailed(_a + " threw exception " + e);
+ }
+
+ debug('<span>' + _a + " is " + escapeHTML(_av) + '</span>');
+}
+
</ins><span class="cx"> function shouldBe(_a, _b, quiet)
</span><span class="cx"> {
</span><del>- if (typeof _a != "string" || typeof _b != "string")
- debug("WARN: shouldBe() expects string arguments");
</del><ins>+ if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
+ debug("WARN: shouldBe() expects function or string arguments");
</ins><span class="cx"> var exception;
</span><span class="cx"> var _av;
</span><span class="cx"> try {
</span><del>- _av = eval(_a);
</del><ins>+ _av = (typeof _a == "function" ? _a() : eval(_a));
</ins><span class="cx"> } catch (e) {
</span><del>- exception = e;
</del><ins>+ exception = e;
</ins><span class="cx"> }
</span><del>- var _bv = eval(_b);
</del><ins>+ var _bv = (typeof _b == "function" ? _b() : eval(_b));
</ins><span class="cx">
</span><span class="cx"> if (exception)
</span><span class="cx"> testFailed(_a + " should be " + stringify(_bv) + ". Threw exception " + exception);
</span><span class="cx"> else if (isResultCorrect(_av, _bv)) {
</span><span class="cx"> if (!quiet) {
</span><del>- testPassed(_a + " is " + _b);
</del><ins>+ testPassed(_a + " is " + (typeof _b == "function" ? _bv : _b));
</ins><span class="cx"> }
</span><span class="cx"> } else if (typeof(_av) == typeof(_bv))
</span><span class="cx"> testFailed(_a + " should be " + stringify(_bv) + ". Was " + stringify(_av) + ".");
</span><span class="lines">@@ -375,22 +390,22 @@
</span><span class="cx">
</span><span class="cx"> function shouldNotBe(_a, _b, quiet)
</span><span class="cx"> {
</span><del>- if (typeof _a != "string" || typeof _b != "string")
- debug("WARN: shouldNotBe() expects string arguments");
</del><ins>+ if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
+ debug("WARN: shouldNotBe() expects function or string arguments");
</ins><span class="cx"> var exception;
</span><span class="cx"> var _av;
</span><span class="cx"> try {
</span><del>- _av = eval(_a);
</del><ins>+ _av = (typeof _a == "function" ? _a() : eval(_a));
</ins><span class="cx"> } catch (e) {
</span><del>- exception = e;
</del><ins>+ exception = e;
</ins><span class="cx"> }
</span><del>- var _bv = eval(_b);
</del><ins>+ var _bv = (typeof _b == "function" ? _b() : eval(_b));
</ins><span class="cx">
</span><span class="cx"> if (exception)
</span><span class="cx"> testFailed(_a + " should not be " + _bv + ". Threw exception " + exception);
</span><span class="cx"> else if (!isResultCorrect(_av, _bv)) {
</span><span class="cx"> if (!quiet) {
</span><del>- testPassed(_a + " is not " + _b);
</del><ins>+ testPassed(_a + " is not " + (typeof _b == "function" ? _bv : _b));
</ins><span class="cx"> }
</span><span class="cx"> } else
</span><span class="cx"> testFailed(_a + " should not be " + _bv + ".");
</span><span class="lines">@@ -445,7 +460,8 @@
</span><span class="cx"> }
</span><span class="cx"> function shouldBeEmptyString(_a) { shouldBeEqualToString(_a, ""); }
</span><span class="cx">
</span><del>-function shouldEvaluateTo(actual, expected) {
</del><ins>+function shouldEvaluateTo(actual, expected)
+{
</ins><span class="cx"> // A general-purpose comparator. 'actual' should be a string to be
</span><span class="cx"> // evaluated, as for shouldBe(). 'expected' may be any type and will be
</span><span class="cx"> // used without being eval'ed.
</span><span class="lines">@@ -617,6 +633,24 @@
</span><span class="cx"> testFailed((_message ? _message : _a) + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+function shouldReject(_a, _message)
+{
+ var _exception;
+ var _av;
+ try {
+ _av = typeof _a == "function" ? _a() : eval(_a);
+ } catch (e) {
+ testFailed((_message ? _message : _a) + " should not throw exception. Threw exception " + e + ".");
+ return Promise.resolve();
+ }
+
+ return _av.then(function(result) {
+ testFailed((_message ? _message : _a) + " should reject promise. Resolved with " + result + ".");
+ }, function(error) {
+ testPassed((_message ? _message : _a) + " rejected promise with " + error + ".");
+ });
+}
+
</ins><span class="cx"> function shouldThrowErrorName(_a, _name)
</span><span class="cx"> {
</span><span class="cx"> var _exception;
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityxssAuditorblockdoesnotleaklocationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-location-expected.txt (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-location-expected.txt 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-location-expected.txt 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> 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.
</span><del>-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.
</del><ins>+CONSOLE MESSAGE: line 233: 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 233: 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 237: 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.
</ins><span class="cx"> PASS xssed.contentDocument is null
</span><span class="cx"> PASS xssed.contentDocument is crossorigin.contentDocument
</span><span class="cx"> PASS xssed.contentWindow.location.href threw exception SecurityError (DOM Exception 18): 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..
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityxssAuditorblockdoesnotleakreferrerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-referrer-expected.txt (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-referrer-expected.txt 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/http/tests/security/xssAuditor/block-does-not-leak-referrer-expected.txt 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> 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.
</span><del>-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.
</del><ins>+CONSOLE MESSAGE: line 233: 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.
</ins><span class="cx"> PASS frame.contentDocument is null
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsjsfunctiondeclarationsinswitchstatementexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/function-declarations-in-switch-statement-expected.txt (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/function-declarations-in-switch-statement-expected.txt 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/js/function-declarations-in-switch-statement-expected.txt 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -1,9 +1,6 @@
</span><del>-WARN: shouldBe() expects string arguments
-PASS 20 is 20
-WARN: shouldBe() expects string arguments
-PASS 20 is 20
-WARN: shouldBe() expects string arguments
-PASS -1 is -1
</del><ins>+PASS t(1) is 20
+PASS t(2) is 20
+PASS t(3) is -1
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsfunctiondeclarationsinswitchstatementjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/function-declarations-in-switch-statement.js (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/function-declarations-in-switch-statement.js 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/js/script-tests/function-declarations-in-switch-statement.js 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -19,6 +19,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-shouldBe(t(1), '20');
-shouldBe(t(2), '20');
-shouldBe(t(3), '-1');
</del><ins>+shouldBe('t(1)', '20');
+shouldBe('t(2)', '20');
+shouldBe('t(3)', '-1');
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsstackunwindingjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/stack-unwinding.js (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/stack-unwinding.js 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/js/script-tests/stack-unwinding.js 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx">
</span><span class="cx"> twoHostFunctions();
</span><span class="cx"> myArray = hostCallsUser(myArray);
</span><del>-shouldBe(myArray, new Array( 5, 6, 7 ) );
</del><ins>+shouldBe('myArray', 'new Array( 5, 6, 7 )');
</ins><span class="cx">
</span><span class="cx"> try {
</span><span class="cx"> hostAndException();
</span></span></pre></div>
<a id="trunkLayoutTestsjsstackunwindingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/stack-unwinding-expected.txt (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/stack-unwinding-expected.txt 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/js/stack-unwinding-expected.txt 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -4,8 +4,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> PASS Two host functions called in a row.
</span><del>-WARN: shouldBe() expects string arguments
-PASS 5,6,7 is 5,6,7
</del><ins>+PASS myArray is new Array( 5, 6, 7 )
</ins><span class="cx"> PASS Exception thrown and caught
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsresourcesjstestprejs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/resources/js-test-pre.js (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/js-test-pre.js 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/resources/js-test-pre.js 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -225,22 +225,22 @@
</span><span class="cx">
</span><span class="cx"> function shouldBe(_a, _b, quiet)
</span><span class="cx"> {
</span><del>- if (typeof _a != "string" || typeof _b != "string")
- debug("WARN: shouldBe() expects string arguments");
</del><ins>+ if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
+ debug("WARN: shouldBe() expects function or string arguments");
</ins><span class="cx"> var exception;
</span><span class="cx"> var _av;
</span><span class="cx"> try {
</span><del>- _av = eval(_a);
</del><ins>+ _av = (typeof _a == "function" ? _a() : eval(_a));
</ins><span class="cx"> } catch (e) {
</span><del>- exception = e;
</del><ins>+ exception = e;
</ins><span class="cx"> }
</span><del>- var _bv = eval(_b);
</del><ins>+ var _bv = (typeof _b == "function" ? _b() : eval(_b));
</ins><span class="cx">
</span><span class="cx"> if (exception)
</span><span class="cx"> testFailed(_a + " should be " + stringify(_bv) + ". Threw exception " + exception);
</span><span class="cx"> else if (isResultCorrect(_av, _bv)) {
</span><span class="cx"> if (!quiet) {
</span><del>- testPassed(_a + " is " + _b);
</del><ins>+ testPassed(_a + " is " + (typeof _b == "function" ? _bv : _b));
</ins><span class="cx"> }
</span><span class="cx"> } else if (typeof(_av) == typeof(_bv))
</span><span class="cx"> testFailed(_a + " should be " + stringify(_bv) + ". Was " + stringify(_av) + ".");
</span><span class="lines">@@ -390,22 +390,22 @@
</span><span class="cx">
</span><span class="cx"> function shouldNotBe(_a, _b, quiet)
</span><span class="cx"> {
</span><del>- if (typeof _a != "string" || typeof _b != "string")
- debug("WARN: shouldNotBe() expects string arguments");
</del><ins>+ if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
+ debug("WARN: shouldNotBe() expects function or string arguments");
</ins><span class="cx"> var exception;
</span><span class="cx"> var _av;
</span><span class="cx"> try {
</span><del>- _av = eval(_a);
</del><ins>+ _av = (typeof _a == "function" ? _a() : eval(_a));
</ins><span class="cx"> } catch (e) {
</span><del>- exception = e;
</del><ins>+ exception = e;
</ins><span class="cx"> }
</span><del>- var _bv = eval(_b);
</del><ins>+ var _bv = (typeof _b == "function" ? _b() : eval(_b));
</ins><span class="cx">
</span><span class="cx"> if (exception)
</span><span class="cx"> testFailed(_a + " should not be " + _bv + ". Threw exception " + exception);
</span><span class="cx"> else if (!isResultCorrect(_av, _bv)) {
</span><span class="cx"> if (!quiet) {
</span><del>- testPassed(_a + " is not " + _b);
</del><ins>+ testPassed(_a + " is not " + (typeof _b == "function" ? _bv : _b));
</ins><span class="cx"> }
</span><span class="cx"> } else
</span><span class="cx"> testFailed(_a + " should not be " + _bv + ".");
</span></span></pre></div>
<a id="trunkLayoutTestsresourcesjstestjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/resources/js-test.js (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/js-test.js 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/resources/js-test.js 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -230,22 +230,22 @@
</span><span class="cx">
</span><span class="cx"> function shouldBe(_a, _b, quiet)
</span><span class="cx"> {
</span><del>- if (typeof _a != "string" || typeof _b != "string")
- debug("WARN: shouldBe() expects string arguments");
</del><ins>+ if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
+ debug("WARN: shouldBe() expects function or string arguments");
</ins><span class="cx"> var _exception;
</span><span class="cx"> var _av;
</span><span class="cx"> try {
</span><del>- _av = eval(_a);
</del><ins>+ _av = (typeof _a == "function" ? _a() : eval(_a));
</ins><span class="cx"> } catch (e) {
</span><del>- _exception = e;
</del><ins>+ _exception = e;
</ins><span class="cx"> }
</span><del>- var _bv = eval(_b);
</del><ins>+ var _bv = (typeof _b == "function" ? _b() : eval(_b));
</ins><span class="cx">
</span><span class="cx"> if (_exception)
</span><span class="cx"> testFailed(_a + " should be " + _bv + ". Threw exception " + _exception);
</span><span class="cx"> else if (isResultCorrect(_av, _bv)) {
</span><span class="cx"> if (!quiet) {
</span><del>- testPassed(_a + " is " + _b);
</del><ins>+ testPassed(_a + " is " + (typeof _b == "function" ? _bv : _b));
</ins><span class="cx"> }
</span><span class="cx"> } else if (typeof(_av) == typeof(_bv))
</span><span class="cx"> testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
</span><span class="lines">@@ -353,22 +353,22 @@
</span><span class="cx">
</span><span class="cx"> function shouldNotBe(_a, _b, _quiet)
</span><span class="cx"> {
</span><del>- if (typeof _a != "string" || typeof _b != "string")
- debug("WARN: shouldNotBe() expects string arguments");
</del><ins>+ if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
+ debug("WARN: shouldNotBe() expects function or string arguments");
</ins><span class="cx"> var _exception;
</span><span class="cx"> var _av;
</span><span class="cx"> try {
</span><del>- _av = eval(_a);
</del><ins>+ _av = (typeof _a == "function" ? _a() : eval(_a));
</ins><span class="cx"> } catch (e) {
</span><del>- _exception = e;
</del><ins>+ _exception = e;
</ins><span class="cx"> }
</span><del>- var _bv = eval(_b);
</del><ins>+ var _bv = (typeof _b == "function" ? _b() : eval(_b));
</ins><span class="cx">
</span><span class="cx"> if (_exception)
</span><span class="cx"> testFailed(_a + " should not be " + _bv + ". Threw exception " + _exception);
</span><span class="cx"> else if (!isResultCorrect(_av, _bv)) {
</span><span class="cx"> if (!_quiet) {
</span><del>- testPassed(_a + " is not " + _b);
</del><ins>+ testPassed(_a + " is not " + (typeof _b == "function" ? _bv : _b));
</ins><span class="cx"> }
</span><span class="cx"> } else
</span><span class="cx"> testFailed(_a + " should not be " + _bv + ".");
</span></span></pre></div>
<a id="trunkLayoutTestsresourcesstandaloneprejs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/resources/standalone-pre.js (215893 => 215894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/standalone-pre.js 2017-04-27 21:17:59 UTC (rev 215893)
+++ trunk/LayoutTests/resources/standalone-pre.js 2017-04-27 21:29:23 UTC (rev 215894)
</span><span class="lines">@@ -111,24 +111,26 @@
</span><span class="cx"> return "" + v;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function shouldBe(_a, _b)
</del><ins>+function shouldBe(_a, _b, quiet)
</ins><span class="cx"> {
</span><del>- if (typeof _a != "string" || typeof _b != "string")
- debug("WARN: shouldBe() expects string arguments");
</del><ins>+ if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
+ debug("WARN: shouldBe() expects function or string arguments");
</ins><span class="cx"> var exception;
</span><span class="cx"> var _av;
</span><span class="cx"> try {
</span><del>- _av = eval(_a);
</del><ins>+ _av = (typeof _a == "function" ? _a() : eval(_a));
</ins><span class="cx"> } catch (e) {
</span><del>- exception = e;
</del><ins>+ exception = e;
</ins><span class="cx"> }
</span><del>- var _bv = eval(_b);
</del><ins>+ var _bv = (typeof _b == "function" ? _b() : eval(_b));
</ins><span class="cx">
</span><span class="cx"> if (exception)
</span><span class="cx"> testFailed(_a + " should be " + stringify(_bv) + ". Threw exception " + exception);
</span><del>- else if (isResultCorrect(_av, _bv))
- testPassed(_a + " is " + _b);
- else if (typeof(_av) == typeof(_bv))
</del><ins>+ else if (isResultCorrect(_av, _bv)) {
+ if (!quiet) {
+ testPassed(_a + " is " + (typeof _b == "function" ? _bv : _b));
+ }
+ } else if (typeof(_av) == typeof(_bv))
</ins><span class="cx"> testFailed(_a + " should be " + stringify(_bv) + ". Was " + stringify(_av) + ".");
</span><span class="cx"> else
</span><span class="cx"> testFailed(_a + " should be " + stringify(_bv) + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
</span><span class="lines">@@ -195,22 +197,22 @@
</span><span class="cx">
</span><span class="cx"> function shouldNotBe(_a, _b, quiet)
</span><span class="cx"> {
</span><del>- if (typeof _a != "string" || typeof _b != "string")
- debug("WARN: shouldNotBe() expects string arguments");
</del><ins>+ if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
+ debug("WARN: shouldNotBe() expects function or string arguments");
</ins><span class="cx"> var exception;
</span><span class="cx"> var _av;
</span><span class="cx"> try {
</span><del>- _av = eval(_a);
</del><ins>+ _av = (typeof _a == "function" ? _a() : eval(_a));
</ins><span class="cx"> } catch (e) {
</span><del>- exception = e;
</del><ins>+ exception = e;
</ins><span class="cx"> }
</span><del>- var _bv = eval(_b);
</del><ins>+ var _bv = (typeof _b == "function" ? _b() : eval(_b));
</ins><span class="cx">
</span><span class="cx"> if (exception)
</span><span class="cx"> testFailed(_a + " should not be " + _bv + ". Threw exception " + exception);
</span><span class="cx"> else if (!isResultCorrect(_av, _bv)) {
</span><span class="cx"> if (!quiet) {
</span><del>- testPassed(_a + " is not " + _b);
</del><ins>+ testPassed(_a + " is not " + (typeof _b == "function" ? _bv : _b));
</ins><span class="cx"> }
</span><span class="cx"> } else
</span><span class="cx"> testFailed(_a + " should not be " + _bv + ".");
</span><span class="lines">@@ -265,38 +267,38 @@
</span><span class="cx"> testFailed(_a + " should be defined. Was " + _av);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function shouldNotThrow(_a) {
</del><ins>+function shouldNotThrow(_a, _message) {
</ins><span class="cx"> try {
</span><del>- eval(_a);
- testPassed(_a + " did not throw exception.");
</del><ins>+ typeof _a == "function" ? _a() : eval(_a);
+ testPassed((_message ? _message : _a) + " did not throw exception.");
</ins><span class="cx"> } catch (e) {
</span><del>- testFailed(_a + " should not throw exception. Threw exception " + e + ".");
</del><ins>+ testFailed((_message ? _message : _a) + " should not throw exception. Threw exception " + e + ".");
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function shouldThrow(_a, _e)
</del><ins>+function shouldThrow(_a, _e, _message)
</ins><span class="cx"> {
</span><del>- var exception;
- var _av;
- try {
- _av = eval(_a);
- } catch (e) {
- exception = e;
- }
</del><ins>+ var _exception;
+ var _av;
+ try {
+ _av = typeof _a == "function" ? _a() : eval(_a);
+ } catch (e) {
+ _exception = e;
+ }
</ins><span class="cx">
</span><del>- var _ev;
- if (_e)
- _ev = eval(_e);
</del><ins>+ var _ev;
+ if (_e)
+ _ev = eval(_e);
</ins><span class="cx">
</span><del>- if (exception) {
- if (typeof _e == "undefined" || exception == _ev)
- testPassed(_a + " threw exception " + exception + ".");
</del><ins>+ 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.");
</ins><span class="cx"> else
</span><del>- 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 + ".");
</del><ins>+ testFailed((_message ? _message : _a) + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function isSuccessfullyParsed()
</span></span></pre>
</div>
</div>
</body>
</html>