Title: [236169] releases/WebKitGTK/webkit-2.22
Revision
236169
Author
carlo...@webkit.org
Date
2018-09-19 05:33:25 -0700 (Wed, 19 Sep 2018)

Log Message

Merge r235712 - [ESNext] Symbol.prototype.description
https://bugs.webkit.org/show_bug.cgi?id=186686

Reviewed by Keith Miller.

JSTests:

* stress/symbol-description.js:
Add tests for empty and null symbol cases.

* test262/config.yaml:
Enable Symbol.prototype.description tests.

Source/_javascript_Core:

Symbol.prototype.description was implemented in r232404, but has one small bug:
It should return undefined for a null symbol.

* runtime/Symbol.cpp:
(JSC::Symbol::description const):
* runtime/SymbolPrototype.cpp:
(JSC::symbolProtoGetterDescription):
Address the null symbol case.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.22/JSTests/ChangeLog (236168 => 236169)


--- releases/WebKitGTK/webkit-2.22/JSTests/ChangeLog	2018-09-19 12:33:18 UTC (rev 236168)
+++ releases/WebKitGTK/webkit-2.22/JSTests/ChangeLog	2018-09-19 12:33:25 UTC (rev 236169)
@@ -1,3 +1,16 @@
+2018-09-05  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        [ESNext] Symbol.prototype.description
+        https://bugs.webkit.org/show_bug.cgi?id=186686
+
+        Reviewed by Keith Miller.
+
+        * stress/symbol-description.js:
+        Add tests for empty and null symbol cases.
+
+        * test262/config.yaml:
+        Enable Symbol.prototype.description tests.
+
 2018-09-05  Mark Lam  <mark....@apple.com>
 
         isAsyncGeneratorMethodParseMode() should check for SourceParseMode::AsyncGeneratorWrapperMethodMode.

Modified: releases/WebKitGTK/webkit-2.22/JSTests/stress/symbol-description.js (236168 => 236169)


--- releases/WebKitGTK/webkit-2.22/JSTests/stress/symbol-description.js	2018-09-19 12:33:18 UTC (rev 236168)
+++ releases/WebKitGTK/webkit-2.22/JSTests/stress/symbol-description.js	2018-09-19 12:33:25 UTC (rev 236169)
@@ -20,19 +20,31 @@
 
 var s0 = Symbol("Cocoa");
 var s1 = Symbol("Cappuccino");
+var s2 = Symbol("");
+var s3 = Symbol();
 
 shouldBe(s0.description, "Cocoa");
 shouldBe(s0.toString(), "Symbol(Cocoa)");
 shouldBe(s1.description, "Cappuccino");
 shouldBe(s1.toString(), "Symbol(Cappuccino)");
+shouldBe(s2.description, "");
+shouldBe(s2.toString(), "Symbol()");
+shouldBe(s3.description, undefined);
+shouldBe(s3.toString(), "Symbol()");
 
 var o0 = Object(s0);
 var o1 = Object(s1);
+var o2 = Object(s2);
+var o3 = Object(s3);
 
 shouldBe(o0.description, "Cocoa");
 shouldBe(o0.toString(), "Symbol(Cocoa)");
 shouldBe(o1.description, "Cappuccino");
 shouldBe(o1.toString(), "Symbol(Cappuccino)");
+shouldBe(o2.description, "");
+shouldBe(o2.toString(), "Symbol()");
+shouldBe(o3.description, undefined);
+shouldBe(o3.toString(), "Symbol()");
 
 var descriptor = Object.getOwnPropertyDescriptor(Symbol.prototype, "description");
 shouldBe(descriptor.enumerable, false);

Modified: releases/WebKitGTK/webkit-2.22/JSTests/test262/config.yaml (236168 => 236169)


--- releases/WebKitGTK/webkit-2.22/JSTests/test262/config.yaml	2018-09-19 12:33:18 UTC (rev 236168)
+++ releases/WebKitGTK/webkit-2.22/JSTests/test262/config.yaml	2018-09-19 12:33:25 UTC (rev 236169)
@@ -11,8 +11,6 @@
     - BigInt
     # https://bugs.webkit.org/show_bug.cgi?id=166693
     - async-iteration
-    # https://bugs.webkit.org/show_bug.cgi?id=186686
-    - Symbol.prototype.description
     # https://bugs.webkit.org/show_bug.cgi?id=186694
     - String.prototype.matchAll
     - Symbol.matchAll

Modified: releases/WebKitGTK/webkit-2.22/Source/_javascript_Core/ChangeLog (236168 => 236169)


--- releases/WebKitGTK/webkit-2.22/Source/_javascript_Core/ChangeLog	2018-09-19 12:33:18 UTC (rev 236168)
+++ releases/WebKitGTK/webkit-2.22/Source/_javascript_Core/ChangeLog	2018-09-19 12:33:25 UTC (rev 236169)
@@ -1,3 +1,19 @@
+2018-09-05  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        [ESNext] Symbol.prototype.description
+        https://bugs.webkit.org/show_bug.cgi?id=186686
+
+        Reviewed by Keith Miller.
+
+        Symbol.prototype.description was implemented in r232404, but has one small bug:
+        It should return undefined for a null symbol.
+
+        * runtime/Symbol.cpp:
+        (JSC::Symbol::description const):
+        * runtime/SymbolPrototype.cpp:
+        (JSC::symbolProtoGetterDescription):
+        Address the null symbol case.
+
 2018-09-04  Keith Miller  <keith_mil...@apple.com>
 
         RELEASE_ASSERT at ../../Source/_javascript_Core/heap/MarkedSpace.h:83

Modified: releases/WebKitGTK/webkit-2.22/Source/_javascript_Core/runtime/Symbol.cpp (236168 => 236169)


--- releases/WebKitGTK/webkit-2.22/Source/_javascript_Core/runtime/Symbol.cpp	2018-09-19 12:33:18 UTC (rev 236168)
+++ releases/WebKitGTK/webkit-2.22/Source/_javascript_Core/runtime/Symbol.cpp	2018-09-19 12:33:25 UTC (rev 236169)
@@ -105,7 +105,8 @@
 
 String Symbol::description() const
 {
-    return privateName().uid();
+    auto& uid = privateName().uid();
+    return uid.isNullSymbol() ? String() : uid;
 }
 
 Symbol* Symbol::create(VM& vm)

Modified: releases/WebKitGTK/webkit-2.22/Source/_javascript_Core/runtime/SymbolPrototype.cpp (236168 => 236169)


--- releases/WebKitGTK/webkit-2.22/Source/_javascript_Core/runtime/SymbolPrototype.cpp	2018-09-19 12:33:18 UTC (rev 236168)
+++ releases/WebKitGTK/webkit-2.22/Source/_javascript_Core/runtime/SymbolPrototype.cpp	2018-09-19 12:33:25 UTC (rev 236169)
@@ -97,7 +97,8 @@
     if (!symbol)
         return throwVMTypeError(exec, scope, SymbolDescriptionTypeError);
     scope.release();
-    return JSValue::encode(jsString(&vm, symbol->description()));
+    const auto description = symbol->description();
+    return JSValue::encode(description.isNull() ? jsUndefined() : jsString(&vm, description));
 }
 
 EncodedJSValue JSC_HOST_CALL symbolProtoFuncToString(ExecState* exec)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to