Changeset 182653 in webkit


Ignore:
Timestamp:
Apr 11, 2015 3:02:09 AM (9 years ago)
Author:
Yusuke Suzuki
Message:

[ES6] Enable Symbol in web pages
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):

Location:
trunk/Source
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r182647 r182653  
     12015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [ES6] Enable Symbol in web pages
     4        https://bugs.webkit.org/show_bug.cgi?id=143375
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Expose Symbol to web pages.
     9        Symbol was exposed, but it was hidden since it breaks Facebook comments.
     10        This is because at that time Symbol is implemented,
     11        but methods for Symbol.iterator and Object.getOwnPropertySymbols are not implemented yet
     12        and it breaks React.js and immutable.js.
     13
     14        Now methods for Symbol.iterator and Object.getOwnPropertySymbols are implemented
     15        and make sure that Facebook comment input functionality is not broken with exposed Symbol.
     16
     17        So this patch replaces runtime flags SymbolEnabled to SymbolDisabled
     18        and makes enabling symbols by default.
     19
     20        * runtime/ArrayPrototype.cpp:
     21        (JSC::ArrayPrototype::finishCreation):
     22        * runtime/CommonIdentifiers.h:
     23        * runtime/JSGlobalObject.cpp:
     24        (JSC::JSGlobalObject::init):
     25        * runtime/ObjectConstructor.cpp:
     26        (JSC::ObjectConstructor::finishCreation):
     27        * runtime/RuntimeFlags.h:
     28
    1292015-04-10  Yusuke Suzuki  <utatane.tea@gmail.com>
    230
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r182406 r182653  
    143143    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, arrayProtoFuncValues, DontEnum, 0);
    144144
    145     if (globalObject->runtimeFlags().isSymbolEnabled()) {
     145    if (!globalObject->runtimeFlags().isSymbolDisabled()) {
    146146        JSObject* unscopables = constructEmptyObject(globalObject->globalExec(), globalObject->nullPrototypeObjectStructure());
    147147        const char* unscopableNames[] = {
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r182495 r182653  
    224224    macro(yield)
    225225
    226 #define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(macro) \
     226#define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL_NOT_IMPLEMENTED_YET(macro)\
    227227    macro(hasInstance) \
    228228    macro(isConcatSpreadable) \
    229     macro(iterator) \
    230229    macro(match) \
    231230    macro(replace) \
     
    234233    macro(split) \
    235234    macro(toPrimitive) \
    236     macro(toStringTag) \
     235    macro(toStringTag)
     236
     237#define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(macro) \
     238    macro(iterator) \
    237239    macro(unscopables)
    238240
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r182343 r182653  
    384384    FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE)
    385385
    386     if (m_runtimeFlags.isSymbolEnabled())
     386    if (!m_runtimeFlags.isSymbolDisabled())
    387387        putDirectWithoutTransition(vm, vm.propertyNames->Symbol, symbolConstructor, DontEnum);
    388388
  • trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp

    r182343 r182653  
    9595    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
    9696
    97     if (globalObject->runtimeFlags().isSymbolEnabled())
     97    if (!globalObject->runtimeFlags().isSymbolDisabled())
    9898        JSC_NATIVE_FUNCTION("getOwnPropertySymbols", objectConstructorGetOwnPropertySymbols, DontEnum, 1);
    9999}
  • trunk/Source/JavaScriptCore/runtime/RuntimeFlags.h

    r181064 r182653  
    3333// macro(name, isEnabledFlag)
    3434#define JSC_RUNTIME_FLAG(macro) \
    35     macro(SymbolEnabled, true)\
     35    macro(SymbolDisabled, false)\
    3636    macro(PromiseDisabled, false)
    3737
  • trunk/Source/WebCore/ChangeLog

    r182652 r182653  
     12015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [ES6] Enable Symbol in web pages
     4        https://bugs.webkit.org/show_bug.cgi?id=143375
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * inspector/InspectorFrontendClientLocal.cpp:
     9        (WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
     10
    1112015-04-10  Roger Fong  <roger_fong@apple.com>
    212
  • trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp

    r180570 r182653  
    122122    m_frontendPage->settings().setAllowFileAccessFromFileURLs(true);
    123123    m_frontendPage->settings().setJavaScriptRuntimeFlags({
    124         JSC::RuntimeFlags::SymbolEnabled
    125124    });
    126125    m_dispatchTask = std::make_unique<InspectorBackendDispatchTask>(inspectorController);
  • trunk/Source/WebKit/mac/ChangeLog

    r182648 r182653  
     12015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [ES6] Enable Symbol in web pages
     4        https://bugs.webkit.org/show_bug.cgi?id=143375
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * WebView/WebPreferencesPrivate.h:
     9
    1102015-04-08  Sam Weinig  <sam@webkit.org>
    211
  • trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h

    r181064 r182653  
    5454
    5555typedef enum {
    56     WebKitJavaScriptRuntimeFlagsSymbolEnabled = 1u << 0,
     56    WebKitJavaScriptRuntimeFlagsSymbolDisabled = 1u << 0,
    5757    WebKitJavaScriptRuntimeFlagsPromiseDisabled = 1u << 1,
    58     WebKitJavaScriptRuntimeFlagsAllEnabled = WebKitJavaScriptRuntimeFlagsSymbolEnabled
     58    WebKitJavaScriptRuntimeFlagsAllEnabled = 0
    5959} WebKitJavaScriptRuntimeFlags;
    6060
  • trunk/Source/WebKit/win/ChangeLog

    r182632 r182653  
     12015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [ES6] Enable Symbol in web pages
     4        https://bugs.webkit.org/show_bug.cgi?id=143375
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * Interfaces/IWebPreferencesPrivate.idl:
     9
    1102015-04-10  Per Arne Vollan  <peavo@outlook.com>
    211
  • trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl

    r181064 r182653  
    3333
    3434typedef enum WebKitJavaScriptRuntimeFlags {
    35     WebKitJavaScriptRuntimeFlagsSymbolEnabled = 1,  // 1u << 0
     35    WebKitJavaScriptRuntimeFlagsSymbolDisabled = 1,  // 1u << 0
    3636    WebKitJavaScriptRuntimeFlagsPromiseDisabled = 2,  // 1u << 1
    37     WebKitJavaScriptRuntimeFlagsAllEnabled = WebKitJavaScriptRuntimeFlagsSymbolEnabled
     37    WebKitJavaScriptRuntimeFlagsAllEnabled = 0
    3838} WebKitJavaScriptRuntimeFlags;
    3939
  • trunk/Source/WebKit2/ChangeLog

    r182648 r182653  
     12015-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [ES6] Enable Symbol in web pages
     4        https://bugs.webkit.org/show_bug.cgi?id=143375
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * UIProcess/API/C/WKPreferencesRefPrivate.h:
     9        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
     10        * UIProcess/efl/WebInspectorProxyEfl.cpp:
     11        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
     12        * UIProcess/gtk/WebInspectorProxyGtk.cpp:
     13        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
     14        * UIProcess/mac/WebInspectorProxyMac.mm:
     15        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
     16
    1172015-04-08  Sam Weinig  <sam@webkit.org>
    218
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h

    r182491 r182653  
    5151
    5252enum WKJavaScriptRuntimeFlags {
    53     kWKJavaScriptRuntimeFlagsSymbolEnabled = 1 << 0,
     53    kWKJavaScriptRuntimeFlagsSymbolDisabled = 1 << 0,
    5454    kWKJavaScriptRuntimeFlagsPromiseDisabled = 1 << 1,
    55     kWKJavaScriptRuntimeFlagsAllEnabled = kWKJavaScriptRuntimeFlagsSymbolEnabled
     55    kWKJavaScriptRuntimeFlagsAllEnabled = 0
    5656};
    5757typedef unsigned WKJavaScriptRuntimeFlagSet;
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h

    r182491 r182653  
    4444
    4545typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
    46     _WKJavaScriptRuntimeFlagsSymbolEnabled = 1 << 0,
     46    _WKJavaScriptRuntimeFlagsSymbolDisabled = 1 << 0,
    4747    _WKJavaScriptRuntimeFlagsPromiseDisabled = 1 << 1,
    48     _WKJavaScriptRuntimeFlagsAllEnabled = _WKJavaScriptRuntimeFlagsSymbolEnabled
     48    _WKJavaScriptRuntimeFlagsAllEnabled = 0
    4949} WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
    5050
  • trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp

    r180570 r182653  
    115115    WKPreferencesRef wkPreferences = WKPageGroupGetPreferences(wkPageGroup);
    116116    WKPreferencesSetFileAccessFromFileURLsAllowed(wkPreferences, true);
    117     WKPreferencesSetJavaScriptRuntimeFlags(wkPreferences, kWKJavaScriptRuntimeFlagsSymbolEnabled);
     117    WKPreferencesSetJavaScriptRuntimeFlags(wkPreferences, 0);
    118118
    119119    return toImpl(WKViewGetPage(wkView));
  • trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp

    r180570 r182653  
    7171    preferences->setAllowFileAccessFromFileURLs(true);
    7272    preferences->setJavaScriptRuntimeFlags({
    73         JSC::RuntimeFlags::SymbolEnabled
    7473    });
    7574    RefPtr<WebPageGroup> pageGroup = WebPageGroup::create(inspectorPageGroupIdentifier(), false, false);
  • trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm

    r181927 r182653  
    502502#endif
    503503    preferences._allowFileAccessFromFileURLs = YES;
    504     preferences._javaScriptRuntimeFlags = _WKJavaScriptRuntimeFlagsSymbolEnabled;
     504    preferences._javaScriptRuntimeFlags = 0;
    505505    [configuration setProcessPool: ::WebKit::wrapper(inspectorProcessPool())];
    506506    [configuration _setGroupIdentifier:inspectorPageGroupIdentifier()];
Note: See TracChangeset for help on using the changeset viewer.