<!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>[160494] 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/160494">160494</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-12 10:41:35 -0800 (Thu, 12 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Test new JSContext name APIs
https://bugs.webkit.org/show_bug.cgi?id=125607
Source/JavaScriptCore:
Reviewed by Darin Adler.
* API/JSContext.h:
* API/JSContextRef.h:
Fix whitespace issues.
* API/tests/testapi.c:
(globalContextNameTest):
(main):
* API/tests/testapi.mm:
Add tests for JSContext set/get name APIs.
Tools:
* Scripts/run-javascriptcore-tests:
Remove trailing whitespace.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreAPIJSContexth">trunk/Source/JavaScriptCore/API/JSContext.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreAPIJSContextRefh">trunk/Source/JavaScriptCore/API/JSContextRef.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreAPIteststestapic">trunk/Source/JavaScriptCore/API/tests/testapi.c</a></li>
<li><a href="#trunkSourceJavaScriptCoreAPIteststestapimm">trunk/Source/JavaScriptCore/API/tests/testapi.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsrunjavascriptcoretests">trunk/Tools/Scripts/run-javascriptcore-tests</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreAPIJSContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSContext.h (160493 => 160494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSContext.h        2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Source/JavaScriptCore/API/JSContext.h        2013-12-12 18:41:35 UTC (rev 160494)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
</span><span class="cx"> * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
</span><span class="cx"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><del>- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</del><ins>+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</ins><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #ifndef JSContext_h
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> JavaScript virtual machine. Every instance of JSValue is associated with a
</span><span class="cx"> JSContext via a strong reference. The JSValue will keep the JSContext it
</span><span class="cx"> references alive so long as the JSValue remains alive. When all of the JSValues
</span><del>- that reference a particular JSContext have been deallocated the JSContext
</del><ins>+ that reference a particular JSContext have been deallocated the JSContext
</ins><span class="cx"> will be deallocated unless it has been previously retained.
</span><span class="cx"> */
</span><span class="cx"> #ifndef JSC_OBJC_API_AVAILABLE_MAC_OS_X_1080
</span><span class="lines">@@ -168,7 +168,7 @@
</span><span class="cx"> @property
</span><span class="cx"> @discussion Name of the JSContext. Exposed when remote debugging the context.
</span><span class="cx"> */
</span><del>-@property(copy) NSString *name;
</del><ins>+@property (copy) NSString *name;
</ins><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreAPIJSContextRefh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSContextRef.h (160493 => 160494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSContextRef.h        2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Source/JavaScriptCore/API/JSContextRef.h        2013-12-12 18:41:35 UTC (rev 160494)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
</span><span class="cx"> * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
</span><span class="cx"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><del>- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</del><ins>+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</ins><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #ifndef JSContextRef_h
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreAPIteststestapic"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/tests/testapi.c (160493 => 160494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/tests/testapi.c        2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Source/JavaScriptCore/API/tests/testapi.c        2013-12-12 18:41:35 UTC (rev 160494)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
</span><span class="cx"> * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
</span><span class="cx"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><del>- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</del><ins>+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</ins><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #include "JavaScriptCore.h"
</span><span class="lines">@@ -1083,6 +1083,34 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static bool globalContextNameTest()
+{
+ bool result = true;
+ JSGlobalContextRef context = JSGlobalContextCreate(0);
+
+ JSStringRef str = JSGlobalContextCopyName(context);
+ result &= assertTrue(!str, "Default context name is NULL");
+
+ JSStringRef name1 = JSStringCreateWithUTF8CString("name1");
+ JSStringRef name2 = JSStringCreateWithUTF8CString("name2");
+
+ JSGlobalContextSetName(context, name1);
+ JSStringRef fetchName1 = JSGlobalContextCopyName(context);
+ JSGlobalContextSetName(context, name2);
+ JSStringRef fetchName2 = JSGlobalContextCopyName(context);
+
+ result &= assertTrue(JSStringIsEqual(name1, fetchName1), "Unexpected Context name");
+ result &= assertTrue(JSStringIsEqual(name2, fetchName2), "Unexpected Context name");
+ result &= assertTrue(!JSStringIsEqual(fetchName1, fetchName2), "Unexpected Context name");
+
+ JSStringRelease(name1);
+ JSStringRelease(name2);
+ JSStringRelease(fetchName1);
+ JSStringRelease(fetchName2);
+
+ return result;
+}
+
</ins><span class="cx"> static void checkConstnessInJSObjectNames()
</span><span class="cx"> {
</span><span class="cx"> JSStaticFunction fun;
</span><span class="lines">@@ -2018,6 +2046,9 @@
</span><span class="cx"> if (valueToObjectExceptionTest())
</span><span class="cx"> printf("PASS: throwException did not crash when handling an error with appendMessageToError set and no codeBlock available.\n");
</span><span class="cx">
</span><ins>+ if (globalContextNameTest())
+ printf("PASS: global context name behaves as expected.\n");
+
</ins><span class="cx"> if (failed) {
</span><span class="cx"> printf("FAIL: Some tests failed.\n");
</span><span class="cx"> return 1;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreAPIteststestapimm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/tests/testapi.mm (160493 => 160494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/tests/testapi.mm        2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Source/JavaScriptCore/API/tests/testapi.mm        2013-12-12 18:41:35 UTC (rev 160494)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
</span><span class="cx"> * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
</span><span class="cx"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><del>- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</del><ins>+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</ins><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #import <JavaScriptCore/JavaScriptCore.h>
</span><span class="lines">@@ -1196,6 +1196,20 @@
</span><span class="cx"> checkResult(@"EvilAllocationObject was successfully dealloced without crashing", evilAllocationObjectWasDealloced);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ @autoreleasepool {
+ JSContext *context = [[JSContext alloc] init];
+ checkResult(@"default context.name is nil", context.name == nil);
+ NSString *name1 = @"Name1";
+ NSString *name2 = @"Name2";
+ context.name = name1;
+ NSString *fetchedName1 = context.name;
+ context.name = name2;
+ NSString *fetchedName2 = context.name;
+ checkResult(@"fetched context.name was expected", [fetchedName1 isEqualToString:name1]);
+ checkResult(@"fetched context.name was expected", [fetchedName2 isEqualToString:name2]);
+ checkResult(@"fetched context.name was expected", ![fetchedName1 isEqualToString:fetchedName2]);
+ }
+
</ins><span class="cx"> currentThisInsideBlockGetterTest();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (160493 => 160494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Source/JavaScriptCore/ChangeLog        2013-12-12 18:41:35 UTC (rev 160494)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2013-12-12 Joseph Pecoraro <pecoraro@apple.com>
+
+ Test new JSContext name APIs
+ https://bugs.webkit.org/show_bug.cgi?id=125607
+
+ Reviewed by Darin Adler.
+
+ * API/JSContext.h:
+ * API/JSContextRef.h:
+ Fix whitespace issues.
+
+ * API/tests/testapi.c:
+ (globalContextNameTest):
+ (main):
+ * API/tests/testapi.mm:
+ Add tests for JSContext set/get name APIs.
+
</ins><span class="cx"> 2013-12-11 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> ARM64: Hang running pdfjs test, suspect DFG generated code for "in"
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (160493 => 160494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Tools/ChangeLog        2013-12-12 18:41:35 UTC (rev 160494)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2013-12-12 Joseph Pecoraro <pecoraro@apple.com>
+
+ Test new JSContext name APIs
+ https://bugs.webkit.org/show_bug.cgi?id=125607
+
+ Reviewed by Darin Adler.
+
+ * Scripts/run-javascriptcore-tests:
+ Remove trailing whitespace.
+
</ins><span class="cx"> 2013-12-12 Zan Dobersek <zdobersek@igalia.com>
</span><span class="cx">
</span><span class="cx"> [Autotools] Prepend the WebCore layer archives' names with 'lib'
</span></span></pre></div>
<a id="trunkToolsScriptsrunjavascriptcoretests"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/run-javascriptcore-tests (160493 => 160494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/run-javascriptcore-tests        2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Tools/Scripts/run-javascriptcore-tests        2013-12-12 18:41:35 UTC (rev 160494)
</span><span class="lines">@@ -8,13 +8,13 @@
</span><span class="cx"> # are met:
</span><span class="cx"> #
</span><span class="cx"> # 1. Redistributions of source code must retain the above copyright
</span><del>-# notice, this list of conditions and the following disclaimer.
</del><ins>+# notice, this list of conditions and the following disclaimer.
</ins><span class="cx"> # 2. Redistributions in binary form must reproduce the above copyright
</span><span class="cx"> # notice, this list of conditions and the following disclaimer in the
</span><del>-# documentation and/or other materials provided with the distribution.
</del><ins>+# documentation and/or other materials provided with the distribution.
</ins><span class="cx"> # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
</span><span class="cx"> # its contributors may be used to endorse or promote products derived
</span><del>-# from this software without specific prior written permission.
</del><ins>+# from this software without specific prior written permission.
</ins><span class="cx"> #
</span><span class="cx"> # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
</span><span class="cx"> # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
</span></span></pre>
</div>
</div>
</body>
</html>