Diff
Modified: trunk/Source/_javascript_Core/API/JSContext.h (160493 => 160494)
--- trunk/Source/_javascript_Core/API/JSContext.h 2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Source/_javascript_Core/API/JSContext.h 2013-12-12 18:41:35 UTC (rev 160494)
@@ -20,7 +20,7 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JSContext_h
@@ -40,7 +40,7 @@
_javascript_ virtual machine. Every instance of JSValue is associated with a
JSContext via a strong reference. The JSValue will keep the JSContext it
references alive so long as the JSValue remains alive. When all of the JSValues
- that reference a particular JSContext have been deallocated the JSContext
+ that reference a particular JSContext have been deallocated the JSContext
will be deallocated unless it has been previously retained.
*/
#ifndef JSC_OBJC_API_AVAILABLE_MAC_OS_X_1080
@@ -168,7 +168,7 @@
@property
@discussion Name of the JSContext. Exposed when remote debugging the context.
*/
-@property(copy) NSString *name;
+@property (copy) NSString *name;
@end
Modified: trunk/Source/_javascript_Core/API/JSContextRef.h (160493 => 160494)
--- trunk/Source/_javascript_Core/API/JSContextRef.h 2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Source/_javascript_Core/API/JSContextRef.h 2013-12-12 18:41:35 UTC (rev 160494)
@@ -20,7 +20,7 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JSContextRef_h
Modified: trunk/Source/_javascript_Core/API/tests/testapi.c (160493 => 160494)
--- trunk/Source/_javascript_Core/API/tests/testapi.c 2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Source/_javascript_Core/API/tests/testapi.c 2013-12-12 18:41:35 UTC (rev 160494)
@@ -20,7 +20,7 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "_javascript_Core.h"
@@ -1083,6 +1083,34 @@
return true;
}
+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;
+}
+
static void checkConstnessInJSObjectNames()
{
JSStaticFunction fun;
@@ -2018,6 +2046,9 @@
if (valueToObjectExceptionTest())
printf("PASS: throwException did not crash when handling an error with appendMessageToError set and no codeBlock available.\n");
+ if (globalContextNameTest())
+ printf("PASS: global context name behaves as expected.\n");
+
if (failed) {
printf("FAIL: Some tests failed.\n");
return 1;
Modified: trunk/Source/_javascript_Core/API/tests/testapi.mm (160493 => 160494)
--- trunk/Source/_javascript_Core/API/tests/testapi.mm 2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Source/_javascript_Core/API/tests/testapi.mm 2013-12-12 18:41:35 UTC (rev 160494)
@@ -20,7 +20,7 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <_javascript_Core/_javascript_Core.h>
@@ -1196,6 +1196,20 @@
checkResult(@"EvilAllocationObject was successfully dealloced without crashing", evilAllocationObjectWasDealloced);
}
+ @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]);
+ }
+
currentThisInsideBlockGetterTest();
}
Modified: trunk/Source/_javascript_Core/ChangeLog (160493 => 160494)
--- trunk/Source/_javascript_Core/ChangeLog 2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-12-12 18:41:35 UTC (rev 160494)
@@ -1,3 +1,20 @@
+2013-12-12 Joseph Pecoraro <[email protected]>
+
+ 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.
+
2013-12-11 Filip Pizlo <[email protected]>
ARM64: Hang running pdfjs test, suspect DFG generated code for "in"
Modified: trunk/Tools/ChangeLog (160493 => 160494)
--- trunk/Tools/ChangeLog 2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Tools/ChangeLog 2013-12-12 18:41:35 UTC (rev 160494)
@@ -1,3 +1,13 @@
+2013-12-12 Joseph Pecoraro <[email protected]>
+
+ Test new JSContext name APIs
+ https://bugs.webkit.org/show_bug.cgi?id=125607
+
+ Reviewed by Darin Adler.
+
+ * Scripts/run-_javascript_core-tests:
+ Remove trailing whitespace.
+
2013-12-12 Zan Dobersek <[email protected]>
[Autotools] Prepend the WebCore layer archives' names with 'lib'
Modified: trunk/Tools/Scripts/run-_javascript_core-tests (160493 => 160494)
--- trunk/Tools/Scripts/run-_javascript_core-tests 2013-12-12 18:38:39 UTC (rev 160493)
+++ trunk/Tools/Scripts/run-_javascript_core-tests 2013-12-12 18:41:35 UTC (rev 160494)
@@ -8,13 +8,13 @@
# are met:
#
# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
+# 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.
+# documentation and/or other materials provided with the distribution.
# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
+# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED