REGRESSION(r179429): Can't type comments in Facebook
https://bugs.webkit.org/show_bug.cgi?id=141859
Reviewed by Brent Fulgham.
Source/JavaScriptCore:
When window.Symbol is exposed to user-space pages,
Facebook's JavaScript use it (maybe, for immutable-js and React.js's unique key).
However, to work with Symbols completely, it also requires
1) Object.getOwnPropertySymbols (for mixin including Symbols)
2) the latest ES6 Iterator interface that uses Iterator.next and it returns { done: boolean, value: value }.
Since they are not landed yet, comments in Facebook don't work.
This patch introduces RuntimeFlags for JavaScriptCore.
Specifying SymbolEnabled flag under test runner and inspector to continue to work with Symbol.
And drop JavaScriptExperimentsEnabled flag
because it is no longer used and use case of this is duplicated to runtime flags.
* JavaScriptCore.order:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* jsc.cpp:
(GlobalObject::javaScriptRuntimeFlags):
(GlobalObject::javaScriptExperimentsEnabled): Deleted.
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::init):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::finishCreation):
(JSC::JSGlobalObject::javaScriptRuntimeFlags):
(JSC::JSGlobalObject::javaScriptExperimentsEnabled): Deleted.
* runtime/RuntimeFlags.h: Added.
(JSC::RuntimeFlags::RuntimeFlags):
(JSC::RuntimeFlags::createAllEnabled):
Source/WebCore:
Enable SymbolEnabled runtime flag in inspector context.
* ForwardingHeaders/runtime/RuntimeFlags.h: Added.
* WebCore.order:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::javaScriptRuntimeFlags):
(WebCore::JSDOMWindowBase::javaScriptExperimentsEnabled): Deleted.
* bindings/js/JSDOMWindowBase.h:
* bindings/js/JSWorkerGlobalScopeBase.cpp:
(WebCore::JSWorkerGlobalScopeBase::javaScriptRuntimeFlags):
(WebCore::JSWorkerGlobalScopeBase::javaScriptExperimentsEnabled): Deleted.
* bindings/js/JSWorkerGlobalScopeBase.h:
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
* page/Settings.h:
* page/Settings.in:
Source/WebKit/mac:
Introduce SymbolEnabled and drop javaScriptExperimentsEnabled.
Private API, javaScriptExperimentsEnabled is dropped.
* Misc/WebNSDictionaryExtras.h:
* Misc/WebNSDictionaryExtras.m:
(-[NSMutableDictionary _webkit_setUnsignedInt:forKey:]):
* WebKit.order:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences _setUnsignedIntValue:forKey:]):
(-[WebPreferences javaScriptRuntimeFlags]):
(-[WebPreferences setJavaScriptRuntimeFlags:]):
(-[WebPreferences setJavaScriptExperimentsEnabled:]): Deleted.
(-[WebPreferences javaScriptExperimentsEnabled]): Deleted.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
Source/WebKit/win:
Added Windows support.
* Interfaces/IWebPreferences.idl:
* Interfaces/IWebPreferencesPrivate.idl:
* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
(WebPreferences::javaScriptRuntimeFlags):
(WebPreferences::setJavaScriptRuntimeFlags):
(WebPreferences::isWebSecurityEnabled):
* WebPreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):
Source/WebKit2:
Enable SymbolEnabled in inspector context.
* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetJavaScriptRuntimeFlags):
(WKPreferencesGetJavaScriptRuntimeFlags):
(WKPreferencesSetJavaScriptExperimentsEnabled): Deleted.
(WKPreferencesGetJavaScriptExperimentsEnabled): Deleted.
* UIProcess/API/C/WKPreferencesRef.h:
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _javaScriptRuntimeFlags]):
(-[WKPreferences _setJavaScriptRuntimeFlags:]):
* 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):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* mac/WebKit2.order:
Tools:
Drop javaScriptExperimentsEnabled and specify JavaScriptRuntimeFlagsAllEnabled as KJavaScriptRuntimeFlags.
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebPreferencesToConsistentValues):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@180570 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/runtime/RuntimeFlags.h b/Source/JavaScriptCore/runtime/RuntimeFlags.h
new file mode 100644
index 0000000..b0b5b37
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RuntimeFlags.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 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.
+ */
+
+#ifndef RuntimeFlags_h
+#define RuntimeFlags_h
+
+#include <initializer_list>
+
+namespace JSC {
+
+#define JSC_RUNTIME_FLAG(macro) \
+ macro(SymbolEnabled)
+
+
+class RuntimeFlags {
+private:
+ enum RuntimeFlagShiftValue : unsigned {
+#define JSC_DECLARE_RUNTIME_FLAG_SHIFT_VALUE(name) shiftValueFor##name,
+ JSC_RUNTIME_FLAG(JSC_DECLARE_RUNTIME_FLAG_SHIFT_VALUE)
+#undef JSC_DECLARE_RUNTIME_FLAG_SHIFT_VALUE
+ };
+
+public:
+ enum RuntimeFlag : unsigned {
+#define JSC_DECLARE_RUNTIME_FLAG(name) name = 1u << (shiftValueFor##name),
+ JSC_RUNTIME_FLAG(JSC_DECLARE_RUNTIME_FLAG)
+#undef JSC_DECLARE_RUNTIME_FLAG
+ };
+
+#define JSC_DECLARE_RUNTIME_FLAG_ACCESSOR(name) \
+ void set##name(bool value)\
+ {\
+ if (value)\
+ m_flags |= name;\
+ else\
+ m_flags &= (~name);\
+ }\
+ bool is##name() const\
+ {\
+ return m_flags & name;\
+ }
+ JSC_RUNTIME_FLAG(JSC_DECLARE_RUNTIME_FLAG_ACCESSOR)
+#undef JSC_DECLARE_RUNTIME_FLAG_ACCESSOR
+
+ RuntimeFlags()
+ : RuntimeFlags(0u)
+ {
+ }
+
+ RuntimeFlags(std::initializer_list<RuntimeFlag> initializerList)
+ : RuntimeFlags()
+ {
+ for (RuntimeFlag flag : initializerList)
+ m_flags |= flag;
+ }
+
+ explicit RuntimeFlags(unsigned flags)
+ : m_flags(flags)
+ {
+ }
+
+ static RuntimeFlags createAllEnabled()
+ {
+ return {
+#define JSC_USE_RUNTIME_FLAG(name) name,
+ JSC_RUNTIME_FLAG(JSC_USE_RUNTIME_FLAG)
+#undef JSC_USE_RUNTIME_FLAG
+ };
+ }
+
+private:
+ unsigned m_flags;
+};
+
+} // namespace JSC
+
+#endif // RuntimeFlags_h