[ES6] Enable Symbol in web pages
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Apr 2015 10:02:09 +0000 (10:02 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Apr 2015 10:02:09 +0000 (10:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143375

Reviewed by Ryosuke Niwa.

Source/JavaScriptCore:

Expose Symbol to web pages.
Symbol was exposed, but it was hidden since it breaks Facebook comments.
This is because at that time Symbol is implemented,
but methods for Symbol.iterator and Object.getOwnPropertySymbols are not implemented yet
and it breaks React.js and immutable.js.

Now methods for Symbol.iterator and Object.getOwnPropertySymbols are implemented
and make sure that Facebook comment input functionality is not broken with exposed Symbol.

So this patch replaces runtime flags SymbolEnabled to SymbolDisabled
and makes enabling symbols by default.

* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::finishCreation):
* runtime/CommonIdentifiers.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::finishCreation):
* runtime/RuntimeFlags.h:

Source/WebCore:

* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):

Source/WebKit/mac:

* WebView/WebPreferencesPrivate.h:

Source/WebKit/win:

* Interfaces/IWebPreferencesPrivate.idl:

Source/WebKit2:

* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* UIProcess/efl/WebInspectorProxyEfl.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182653 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/ObjectConstructor.cpp
Source/JavaScriptCore/runtime/RuntimeFlags.h
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp
Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm

index ca54d23..84999ad 100644 (file)
@@ -1,3 +1,31 @@
+2015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [ES6] Enable Symbol in web pages
+        https://bugs.webkit.org/show_bug.cgi?id=143375
+
+        Reviewed by Ryosuke Niwa.
+
+        Expose Symbol to web pages.
+        Symbol was exposed, but it was hidden since it breaks Facebook comments.
+        This is because at that time Symbol is implemented,
+        but methods for Symbol.iterator and Object.getOwnPropertySymbols are not implemented yet
+        and it breaks React.js and immutable.js.
+
+        Now methods for Symbol.iterator and Object.getOwnPropertySymbols are implemented
+        and make sure that Facebook comment input functionality is not broken with exposed Symbol.
+
+        So this patch replaces runtime flags SymbolEnabled to SymbolDisabled
+        and makes enabling symbols by default.
+
+        * runtime/ArrayPrototype.cpp:
+        (JSC::ArrayPrototype::finishCreation):
+        * runtime/CommonIdentifiers.h:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        * runtime/ObjectConstructor.cpp:
+        (JSC::ObjectConstructor::finishCreation):
+        * runtime/RuntimeFlags.h:
+
 2015-04-10  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         ES6: Iterator toString names should be consistent
index 8cece00..9267432 100644 (file)
@@ -142,7 +142,7 @@ void ArrayPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
     vm.prototypeMap.addPrototype(this);
     JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, arrayProtoFuncValues, DontEnum, 0);
 
-    if (globalObject->runtimeFlags().isSymbolEnabled()) {
+    if (!globalObject->runtimeFlags().isSymbolDisabled()) {
         JSObject* unscopables = constructEmptyObject(globalObject->globalExec(), globalObject->nullPrototypeObjectStructure());
         const char* unscopableNames[] = {
             "copyWithin",
index 9520869..3bccc41 100644 (file)
     macro(with) \
     macro(yield)
 
-#define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(macro) \
+#define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL_NOT_IMPLEMENTED_YET(macro)\
     macro(hasInstance) \
     macro(isConcatSpreadable) \
-    macro(iterator) \
     macro(match) \
     macro(replace) \
     macro(search) \
     macro(species) \
     macro(split) \
     macro(toPrimitive) \
-    macro(toStringTag) \
+    macro(toStringTag)
+
+#define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(macro) \
+    macro(iterator) \
     macro(unscopables)
 
 #define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \
index 1d4aed0..17949a1 100644 (file)
@@ -383,7 +383,7 @@ putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Construct
 
     FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE)
 
-    if (m_runtimeFlags.isSymbolEnabled())
+    if (!m_runtimeFlags.isSymbolDisabled())
         putDirectWithoutTransition(vm, vm.propertyNames->Symbol, symbolConstructor, DontEnum);
 
 #undef PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE
index f68aa03..827c60c 100644 (file)
@@ -94,7 +94,7 @@ void ObjectConstructor::finishCreation(VM& vm, JSGlobalObject* globalObject, Obj
     // no. of arguments for constructor
     putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
 
-    if (globalObject->runtimeFlags().isSymbolEnabled())
+    if (!globalObject->runtimeFlags().isSymbolDisabled())
         JSC_NATIVE_FUNCTION("getOwnPropertySymbols", objectConstructorGetOwnPropertySymbols, DontEnum, 1);
 }
 
index 47e7d09..edc3e75 100644 (file)
@@ -32,7 +32,7 @@ namespace JSC {
 
 // macro(name, isEnabledFlag)
 #define JSC_RUNTIME_FLAG(macro) \
-    macro(SymbolEnabled, true)\
+    macro(SymbolDisabled, false)\
     macro(PromiseDisabled, false)
 
 
index dd06d20..ea90042 100644 (file)
@@ -1,3 +1,13 @@
+2015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [ES6] Enable Symbol in web pages
+        https://bugs.webkit.org/show_bug.cgi?id=143375
+
+        Reviewed by Ryosuke Niwa.
+
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
+
 2015-04-10  Roger Fong  <roger_fong@apple.com>
 
         Hide volume controls when playing wirelessly.
index 415ff7c..b1c6972 100644 (file)
@@ -121,7 +121,6 @@ InspectorFrontendClientLocal::InspectorFrontendClientLocal(InspectorController*
 {
     m_frontendPage->settings().setAllowFileAccessFromFileURLs(true);
     m_frontendPage->settings().setJavaScriptRuntimeFlags({
-        JSC::RuntimeFlags::SymbolEnabled
     });
     m_dispatchTask = std::make_unique<InspectorBackendDispatchTask>(inspectorController);
 }
index 4d80ed8..ba4e057 100644 (file)
@@ -1,3 +1,12 @@
+2015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [ES6] Enable Symbol in web pages
+        https://bugs.webkit.org/show_bug.cgi?id=143375
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebView/WebPreferencesPrivate.h:
+
 2015-04-08  Sam Weinig  <sam@webkit.org>
 
         Allow LaunchServices to handle URLs on link navigations
index a5647e8..5455277 100644 (file)
@@ -53,9 +53,9 @@ typedef enum {
 } WebStorageBlockingPolicy;
 
 typedef enum {
-    WebKitJavaScriptRuntimeFlagsSymbolEnabled = 1u << 0,
+    WebKitJavaScriptRuntimeFlagsSymbolDisabled = 1u << 0,
     WebKitJavaScriptRuntimeFlagsPromiseDisabled = 1u << 1,
-    WebKitJavaScriptRuntimeFlagsAllEnabled = WebKitJavaScriptRuntimeFlagsSymbolEnabled
+    WebKitJavaScriptRuntimeFlagsAllEnabled = 0
 } WebKitJavaScriptRuntimeFlags;
 
 extern NSString *WebPreferencesChangedNotification;
index 13c02b6..b29e652 100644 (file)
@@ -1,3 +1,12 @@
+2015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [ES6] Enable Symbol in web pages
+        https://bugs.webkit.org/show_bug.cgi?id=143375
+
+        Reviewed by Ryosuke Niwa.
+
+        * Interfaces/IWebPreferencesPrivate.idl:
+
 2015-04-10  Per Arne Vollan  <peavo@outlook.com>
 
         [Win] Implement some methods in DOMHTMLDocument interface.
index ae6d211..e93ef79 100644 (file)
@@ -32,9 +32,9 @@ import "ocidl.idl";
 #endif
 
 typedef enum WebKitJavaScriptRuntimeFlags {
-    WebKitJavaScriptRuntimeFlagsSymbolEnabled = 1,  // 1u << 0
+    WebKitJavaScriptRuntimeFlagsSymbolDisabled = 1,  // 1u << 0
     WebKitJavaScriptRuntimeFlagsPromiseDisabled = 2,  // 1u << 1
-    WebKitJavaScriptRuntimeFlagsAllEnabled = WebKitJavaScriptRuntimeFlagsSymbolEnabled
+    WebKitJavaScriptRuntimeFlagsAllEnabled = 0
 } WebKitJavaScriptRuntimeFlags;
 
 [
index 3880d50..62d6913 100644 (file)
@@ -1,3 +1,19 @@
+2015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [ES6] Enable Symbol in web pages
+        https://bugs.webkit.org/show_bug.cgi?id=143375
+
+        Reviewed by Ryosuke Niwa.
+
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+        * UIProcess/efl/WebInspectorProxyEfl.cpp:
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+        * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+
 2015-04-08  Sam Weinig  <sam@webkit.org>
 
         Allow LaunchServices to handle URLs on link navigations
index d9068d5..a0b4279 100644 (file)
@@ -50,9 +50,9 @@ enum WKEditableLinkBehavior {
 typedef enum WKEditableLinkBehavior WKEditableLinkBehavior;
 
 enum WKJavaScriptRuntimeFlags {
-    kWKJavaScriptRuntimeFlagsSymbolEnabled = 1 << 0,
+    kWKJavaScriptRuntimeFlagsSymbolDisabled = 1 << 0,
     kWKJavaScriptRuntimeFlagsPromiseDisabled = 1 << 1,
-    kWKJavaScriptRuntimeFlagsAllEnabled = kWKJavaScriptRuntimeFlagsSymbolEnabled
+    kWKJavaScriptRuntimeFlagsAllEnabled = 0
 };
 typedef unsigned WKJavaScriptRuntimeFlagSet;
 
index dbdbe0d..71f8325 100644 (file)
@@ -43,9 +43,9 @@ typedef NS_OPTIONS(NSUInteger, _WKDebugOverlayRegions) {
 } WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
 typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
-    _WKJavaScriptRuntimeFlagsSymbolEnabled = 1 << 0,
+    _WKJavaScriptRuntimeFlagsSymbolDisabled = 1 << 0,
     _WKJavaScriptRuntimeFlagsPromiseDisabled = 1 << 1,
-    _WKJavaScriptRuntimeFlagsAllEnabled = _WKJavaScriptRuntimeFlagsSymbolEnabled
+    _WKJavaScriptRuntimeFlagsAllEnabled = 0
 } WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
 @interface WKPreferences (WKPrivate)
index b35a5f7..8110f7e 100644 (file)
@@ -114,7 +114,7 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
 
     WKPreferencesRef wkPreferences = WKPageGroupGetPreferences(wkPageGroup);
     WKPreferencesSetFileAccessFromFileURLsAllowed(wkPreferences, true);
-    WKPreferencesSetJavaScriptRuntimeFlags(wkPreferences, kWKJavaScriptRuntimeFlagsSymbolEnabled);
+    WKPreferencesSetJavaScriptRuntimeFlags(wkPreferences, 0);
 
     return toImpl(WKViewGetPage(wkView));
 }
index 9e77bd4..9679d72 100644 (file)
@@ -70,7 +70,6 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
 #endif
     preferences->setAllowFileAccessFromFileURLs(true);
     preferences->setJavaScriptRuntimeFlags({
-        JSC::RuntimeFlags::SymbolEnabled
     });
     RefPtr<WebPageGroup> pageGroup = WebPageGroup::create(inspectorPageGroupIdentifier(), false, false);
     m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(&inspectorProcessPool(), preferences.get(), pageGroup.get(), nullptr, nullptr));
index 50f09f6..1d71589 100644 (file)
@@ -501,7 +501,7 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
     preferences._logsPageMessagesToSystemConsoleEnabled = YES;
 #endif
     preferences._allowFileAccessFromFileURLs = YES;
-    preferences._javaScriptRuntimeFlags = _WKJavaScriptRuntimeFlagsSymbolEnabled;
+    preferences._javaScriptRuntimeFlags = 0;
     [configuration setProcessPool: ::WebKit::wrapper(inspectorProcessPool())];
     [configuration _setGroupIdentifier:inspectorPageGroupIdentifier()];