Add a runtime flag for DOM iterators
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Jul 2016 07:47:14 +0000 (07:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Jul 2016 07:47:14 +0000 (07:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=159300

Patch by Youenn Fablet <youennf@gmail.com> on 2016-07-01
Reviewed by Alex Christensen.

Source/JavaScriptCore:

* runtime/CommonIdentifiers.h:

Source/WebCore:

* Modules/fetch/FetchHeaders.idl: Making iterator runtime-enabled.
* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setDOMIteratorEnabled):
(WebCore::RuntimeEnabledFeatures::domIteratorEnabled):
* bindings/scripts/CodeGeneratorJS.pm:
(ToMethodName): Fixing dOM -> dom casing issue.
(GenerateImplementation): Using addIterableProperties new method.
(addIterableProperties): Activating property addition according runtime flag if iterator is rnutime flagged.
* bindings/scripts/IDLParser.pm:
(parseOptionalIterableInterface): Adding extendedAttributes to iterable.
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSTestNodePrototype::finishCreation):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjPrototype::finishCreation):
* bindings/scripts/test/TestNode.idl: Making iterator runtime-enabled.
* bindings/scripts/test/TestObj.idl: Ditto.
* css/FontFaceSet.idl: Ditto.
* dom/NodeList.idl: Ditto.

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(-[WebPreferences DOMIteratorEnabled]):
(-[WebPreferences setDOMIteratorEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit/win:

* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::domIteratorEnabled):
(WebPreferences::setDOMIteratorEnabled):
(WebView::notifyPreferencesChanged):
* WebPreferencesreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebPreferencesToConsistentValues):
* Scripts/webkitperl/FeatureList.pm:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setDOMIteratorEnabled):
* WebKitTestRunner/InjectedBundle/TestRunner.h:

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

35 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchHeaders.idl
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/IDLParser.pm
Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/TestNode.idl
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/css/FontFaceSet.idl
Source/WebCore/dom/NodeList.idl
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
Source/WebKit/win/WebPreferenceKeysPrivate.h
Source/WebKit/win/WebPreferences.cpp
Source/WebKit/win/WebPreferences.h
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/win/DumpRenderTree.cpp
Tools/Scripts/webkitperl/FeatureList.pm
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

index 74110ff..94bb47a 100644 (file)
@@ -1,3 +1,12 @@
+2016-07-01  Youenn Fablet  <youennf@gmail.com>
+
+        Add a runtime flag for DOM iterators
+        https://bugs.webkit.org/show_bug.cgi?id=159300
+
+        Reviewed by Alex Christensen.
+
+        * runtime/CommonIdentifiers.h:
+
 2016-06-30  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Wrong function name next to scope
index 85cebbf..12d909a 100644 (file)
@@ -38,6 +38,7 @@
     macro(Date) \
     macro(DateTimeFormat) \
     macro(DocumentTimeline) \
+    macro(DOMIterator) \
     macro(Error) \
     macro(EvalError) \
     macro(Function) \
index f05c83e..9f5f734 100644 (file)
@@ -1,3 +1,29 @@
+2016-07-01  Youenn Fablet  <youennf@gmail.com>
+
+        Add a runtime flag for DOM iterators
+        https://bugs.webkit.org/show_bug.cgi?id=159300
+
+        Reviewed by Alex Christensen.
+
+        * Modules/fetch/FetchHeaders.idl: Making iterator runtime-enabled.
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setDOMIteratorEnabled):
+        (WebCore::RuntimeEnabledFeatures::domIteratorEnabled):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (ToMethodName): Fixing dOM -> dom casing issue.
+        (GenerateImplementation): Using addIterableProperties new method.
+        (addIterableProperties): Activating property addition according runtime flag if iterator is rnutime flagged.
+        * bindings/scripts/IDLParser.pm:
+        (parseOptionalIterableInterface): Adding extendedAttributes to iterable.
+        * bindings/scripts/test/JS/JSTestNode.cpp:
+        (WebCore::JSTestNodePrototype::finishCreation):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::JSTestObjPrototype::finishCreation):
+        * bindings/scripts/test/TestNode.idl: Making iterator runtime-enabled.
+        * bindings/scripts/test/TestObj.idl: Ditto.
+        * css/FontFaceSet.idl: Ditto.
+        * dom/NodeList.idl: Ditto.
+
 2016-07-01  Frederic Wang  <fwang.igalia.com>
 
         Eliminate trailing whitespace in MathML code
index 42c92bf..479965c 100644 (file)
@@ -41,7 +41,7 @@ interface FetchHeaders {
     [RaisesException] boolean has(DOMString name);
     [RaisesException] void set(DOMString name, DOMString value);
 
-    iterable<DOMString, DOMString>;
+    [EnabledAtRuntime=DOMIterator] iterable<DOMString, DOMString>;
 
     [PrivateIdentifier, RaisesException, ImplementedAs=append] void appendFromJS(DOMString name, DOMString value);
     [PrivateIdentifier, ImplementedAs=fill] void fillFromJS(FetchHeaders? headers);
index 6ee33d6..65648ed 100644 (file)
@@ -58,6 +58,9 @@ public:
     void setDataTransferItemsEnabled(bool isEnabled) { m_isDataTransferItemsEnabled = isEnabled; }
     bool dataTransferItemsEnabled() const { return m_isDataTransferItemsEnabled; }
 
+    void setDOMIteratorEnabled(bool isEnabled) { m_isDOMIteratorEnabled = isEnabled; }
+    bool domIteratorEnabled() const { return m_isDOMIteratorEnabled; }
+
     void setGeolocationEnabled(bool isEnabled) { m_isGeolocationEnabled = isEnabled; }
     bool geolocationEnabled() const { return m_isGeolocationEnabled; }
 
@@ -234,6 +237,7 @@ private:
     bool m_isWebkitNotificationsEnabled;
     bool m_isApplicationCacheEnabled;
     bool m_isDataTransferItemsEnabled;
+    bool m_isDOMIteratorEnabled { true };
     bool m_isGeolocationEnabled;
     bool m_isTouchEnabled;
     bool m_isDeviceMotionEnabled;
index 046e93e..667fb23 100644 (file)
@@ -1956,12 +1956,13 @@ sub ToMethodName
 {
     my $param = shift;
     my $ret = lcfirst($param);
+    $ret =~ s/cSS/css/ if $ret =~ /^cSS/;
+    $ret =~ s/dOM/dom/ if $ret =~ /^dOM/;
     $ret =~ s/hTML/html/ if $ret =~ /^hTML/;
-    $ret =~ s/uRL/url/ if $ret =~ /^uRL/;
     $ret =~ s/jS/js/ if $ret =~ /^jS/;
+    $ret =~ s/uRL/url/ if $ret =~ /^uRL/;
     $ret =~ s/xML/xml/ if $ret =~ /^xML/;
     $ret =~ s/xSLT/xslt/ if $ret =~ /^xSLT/;
-    $ret =~ s/cSS/css/ if $ret =~ /^cSS/;
 
     # For HTML5 FileSystem API Flags attributes.
     # (create is widely used to instantiate an object and must be avoided.)
@@ -2309,8 +2310,7 @@ sub GenerateImplementation
         }
 
         if ($interface->iterable) {
-            my $functionName = GetFunctionName($interface, $className, @{$interface->iterable->functions}[0]);
-            push(@implContent, "    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\"[Symbol.Iterator]\"), $functionName), DontEnum);\n");
+            addIterableProperties($interface, $className);
         }
 
         push(@implContent, "}\n\n");
@@ -4247,6 +4247,26 @@ END
     }
 }
 
+sub addIterableProperties()
+{
+    my $interface = shift;
+    my $className = shift;
+
+    if ($interface->iterable->extendedAttributes->{"EnabledAtRuntime"}) {
+        AddToImplIncludes("RuntimeEnabledFeatures.h");
+        my $enable_function = GetRuntimeEnableFunctionName($interface->iterable);
+        push(@implContent, "    if (${enable_function}()) {\n    ");
+    }
+
+    my $functionName = GetFunctionName($interface, $className, @{$interface->iterable->functions}[0]);
+    push(@implContent, "    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\"[Symbol.Iterator]\"), $functionName), DontEnum);\n");
+
+    if ($interface->iterable->extendedAttributes->{"EnabledAtRuntime"}) {
+        push(@implContent, "    }\n");
+    }
+
+}
+
 sub GetNativeTypeFromSignature
 {
     my ($interface, $signature) = @_;
index c8d3e09..93d4f0a 100644 (file)
@@ -93,6 +93,7 @@ struct( domIterable => {
     keyType => '$',   # Key type for map iterables
     valueType => '$', # Value type for map or set iterables
     functions => '@', # Iterable functions (entries, keys, values, [Symbol.Iterator], forEach)
+    extendedAttributes => '$', # Extended attributes
 });
 
 
@@ -1408,6 +1409,7 @@ sub parseOptionalIterableInterface
     push(@{$forEachFunction->parameters}, ($forEachArgument));
 
     my $newDataNode = domIterable->new();
+    $newDataNode->extendedAttributes($extendedAttributeList);
     push(@{$newDataNode->functions}, $symbolIteratorFunction);
     push(@{$newDataNode->functions}, $entriesFunction);
     push(@{$newDataNode->functions}, $keysFunction);
index 1f5fd8c..c79f4f6 100644 (file)
@@ -25,6 +25,7 @@
 #include "JSDOMBinding.h"
 #include "JSDOMConstructor.h"
 #include "JSDOMIterator.h"
+#include "RuntimeEnabledFeatures.h"
 #include "URL.h"
 #include <runtime/Error.h>
 #include <runtime/JSString.h>
@@ -115,7 +116,29 @@ void JSTestNodePrototype::finishCreation(VM& vm)
 {
     Base::finishCreation(vm);
     reifyStaticProperties(vm, JSTestNodePrototypeTableValues, *this);
-    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestNodePrototypeFunctionSymbolIterator), DontEnum);
+    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("entries"), strlen("entries"));
+        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+    }
+    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("keys"), strlen("keys"));
+        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+    }
+    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("values"), strlen("values"));
+        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+    }
+    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("forEach"), strlen("forEach"));
+        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+    }
+    if (RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+        putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestNodePrototypeFunctionSymbolIterator), DontEnum);
+    }
 }
 
 const ClassInfo JSTestNode::s_info = { "TestNode", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestNode) };
index 7b4450e..a12548e 100644 (file)
@@ -1317,6 +1317,26 @@ void JSTestObjPrototype::finishCreation(VM& vm)
         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
     }
 #endif
+    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("entries"), strlen("entries"));
+        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+    }
+    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("keys"), strlen("keys"));
+        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+    }
+    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("values"), strlen("values"));
+        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+    }
+    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("forEach"), strlen("forEach"));
+        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+    }
 #if ENABLE(TEST_FEATURE)
     if (!RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) {
         Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledAtRuntimeAttribute"), strlen("enabledAtRuntimeAttribute"));
@@ -1327,7 +1347,9 @@ void JSTestObjPrototype::finishCreation(VM& vm)
     JSVMClientData& clientData = *static_cast<JSVMClientData*>(vm.clientData);
     putDirect(vm, clientData.builtinNames().privateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPrivateMethod), ReadOnly | DontEnum);
     putDirect(vm, clientData.builtinNames().publicAndPrivateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPublicAndPrivateMethod), ReadOnly | DontEnum);
-    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestObjPrototypeFunctionSymbolIterator), DontEnum);
+    if (RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+        putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestObjPrototypeFunctionSymbolIterator), DontEnum);
+    }
 }
 
 const ClassInfo JSTestObj::s_info = { "TestObject", &Base::s_info, &JSTestObjTable, CREATE_METHOD_TABLE(JSTestObj) };
index 1e4852a..8dc0e49 100644 (file)
@@ -24,6 +24,6 @@
 ] interface TestNode : Node {
     attribute DOMString name;
 
-    iterable<TestNode>;
+    [EnabledAtRuntime=DOMIterator] iterable<TestNode>;
 };
 
index 74015ce..61a9eee 100644 (file)
@@ -95,7 +95,7 @@ enum TestConfidence { "high", "kinda-low" };
     // TypedArray attribute
     attribute Float32Array typedArrayAttr;
 
-    iterable<DOMString, TestObj>;
+    [EnabledAtRuntime=DOMIterator] iterable<DOMString, TestObj>;
 
     // Methods
     void    voidMethod();
index ab5cb89..8edf681 100644 (file)
@@ -35,7 +35,7 @@ enum FontFaceSetLoadStatus {
     boolean has(FontFace font);
 
     // FIXME: We should add support for the setlike declaration.
-    iterable<FontFace>;
+    [EnabledAtRuntime=DOMIterator] iterable<FontFace>;
 
     readonly attribute long size;
 
index 0cd146d..998c90a 100644 (file)
@@ -27,6 +27,6 @@
 ] interface NodeList {
     getter Node item(unsigned long index);
     readonly attribute unsigned long length;
-    iterable<Node>;
+    [EnabledAtRuntime=DOMIterator] iterable<Node>;
 };
 
index 5d25a8e..2832bcb 100644 (file)
@@ -1,3 +1,18 @@
+2016-07-01  Youenn Fablet  <youennf@gmail.com>
+
+        Add a runtime flag for DOM iterators
+        https://bugs.webkit.org/show_bug.cgi?id=159300
+
+        Reviewed by Alex Christensen.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (-[WebPreferences DOMIteratorEnabled]):
+        (-[WebPreferences setDOMIteratorEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2016-06-30  Jiewen Tan  <jiewen_tan@apple.com>
 
         Create a generic "linked-on-or-after" check for new CSP Rules
index cd186cd..82af1a1 100644 (file)
 #define WebKitMediaKeysStorageDirectoryKey @"WebKitMediaKeysStorageDirectory"
 #define WebKitShadowDOMEnabledPreferenceKey @"WebKitShadowDOMEnabled"
 #define WebKitCustomElementsEnabledPreferenceKey @"WebKitCustomElementsEnabled"
+#define WebKitDOMIteratorEnabledPreferenceKey @"WebKitDOMIteratorEnabled"
 #define WebKitFetchAPIEnabledPreferenceKey @"WebKitFetchAPIEnabled"
 #define WebKitDownloadAttributeEnabledPreferenceKey @"WebKitDownloadAttributeEnabled"
 #define WebKitCSSGridLayoutEnabledPreferenceKey @"WebKitCSSGridLayoutEnabled"
index 73f684b..52f1446 100644 (file)
@@ -2722,6 +2722,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitCustomElementsEnabledPreferenceKey];
 }
 
+- (BOOL)DOMIteratorEnabled
+{
+    return [self _boolValueForKey:WebKitDOMIteratorEnabledPreferenceKey];
+}
+
+- (void)setDOMIteratorEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitDOMIteratorEnabledPreferenceKey];
+}
+
 - (BOOL)fetchAPIEnabled
 {
     return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];
index 23994a6..c10edc0 100644 (file)
@@ -481,6 +481,9 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 - (void)setCustomElementsEnabled:(BOOL)flag;
 - (BOOL)customElementsEnabled;
 
+- (void)setDOMIteratorEnabled:(BOOL)flag;
+- (BOOL)DOMIteratorEnabled;
+
 - (void)setFetchAPIEnabled:(BOOL)flag;
 - (BOOL)fetchAPIEnabled;
 
index c045e04..7b52c33 100644 (file)
@@ -2498,6 +2498,8 @@ static bool needsSelfRetainWhileLoadingQuirk()
 
     RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled([preferences shadowDOMEnabled]);
 
+    RuntimeEnabledFeatures::sharedFeatures().setDOMIteratorEnabled([preferences DOMIteratorEnabled]);
+
 #if ENABLE(CUSTOM_ELEMENTS)
     RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled([preferences customElementsEnabled]);
 #endif
index 03cdc35..4181c92 100644 (file)
@@ -1,3 +1,19 @@
+2016-07-01  Youenn Fablet  <youennf@gmail.com>
+
+        Add a runtime flag for DOM iterators
+        https://bugs.webkit.org/show_bug.cgi?id=159300
+
+        Reviewed by Alex Christensen.
+
+        * WebPreferenceKeysPrivate.h:
+        * WebPreferences.cpp:
+        (WebPreferences::domIteratorEnabled):
+        (WebPreferences::setDOMIteratorEnabled):
+        (WebView::notifyPreferencesChanged):
+        * WebPreferencesreferences.h:
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+
 2016-06-28  Per Arne Vollan  <pvollan@apple.com>
 
         [Win] Custom elements tests are failing.
index 243620b..d7aa49d 100644 (file)
@@ -175,6 +175,8 @@ interface IWebPreferencesPrivate3 : IWebPreferencesPrivate2
 {
     HRESULT showTiledScrollingIndicator([out, retval] BOOL* enabled);
     HRESULT setShowTiledScrollingIndicator([in] BOOL enabled);
+    HRESULT domIteratorEnabled([out, retval] BOOL* enabled);
+    HRESULT setDOMIteratorEnabled([in] BOOL enabled);
     HRESULT fetchAPIEnabled([out, retval] BOOL* enabled);
     HRESULT setFetchAPIEnabled([in] BOOL enabled);
     HRESULT shadowDOMEnabled([out, retval] BOOL* enabled);
index ef88fc8..5e13774 100644 (file)
 
 #define WebKitShowTiledScrollingIndicatorPreferenceKey "WebKitShowTiledScrollingIndicator"
 
+#define WebKitDOMIteratorEnabledPreferenceKey "WebKitDOMIteratorEnabled"
+
 #define WebKitFetchAPIEnabledPreferenceKey "WebKitFetchAPIEnabled"
 
 #define WebKitShadowDOMEnabledPreferenceKey "WebKitShadowDOMEnabled"
index f945166..175b7c7 100644 (file)
@@ -1938,6 +1938,20 @@ HRESULT WebPreferences::setFetchAPIEnabled(BOOL enabled)
     return S_OK;
 }
 
+HRESULT WebPreferences::setDOMIteratorEnabled(BOOL enabled)
+{
+    setBoolValue(WebKitDOMIteratorEnabledPreferenceKey, enabled);
+    return S_OK;
+}
+
+HRESULT WebPreferences::domIteratorEnabled(_Out_ BOOL* enabled)
+{
+    if (!enabled)
+        return E_POINTER;
+    *enabled = boolValueForKey(WebKitDOMIteratorEnabledPreferenceKey);
+    return S_OK;
+}
+
 HRESULT WebPreferences::shadowDOMEnabled(_Out_ BOOL* enabled)
 {
     if (!enabled)
index a941b59..70599de 100644 (file)
@@ -235,6 +235,8 @@ public:
     virtual HRESULT STDMETHODCALLTYPE setShowTiledScrollingIndicator(BOOL);
     virtual HRESULT STDMETHODCALLTYPE fetchAPIEnabled(_Out_ BOOL*);
     virtual HRESULT STDMETHODCALLTYPE setFetchAPIEnabled(BOOL);
+    virtual HRESULT STDMETHODCALLTYPE domIteratorEnabled(_Out_ BOOL*);
+    virtual HRESULT STDMETHODCALLTYPE setDOMIteratorEnabled(BOOL);
     virtual HRESULT STDMETHODCALLTYPE shadowDOMEnabled(_Out_ BOOL*);
     virtual HRESULT STDMETHODCALLTYPE setShadowDOMEnabled(BOOL);
     virtual HRESULT STDMETHODCALLTYPE customElementsEnabled(_Out_ BOOL*);
index 0b92734..80e3b8e 100644 (file)
@@ -5040,6 +5040,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
     RuntimeEnabledFeatures::sharedFeatures().setWebkitIndexedDBEnabled(true);
 #endif
 
+    hr = prefsPrivate->domIteratorEnabled(&enabled);
+    if (FAILED(hr))
+        return hr;
+    RuntimeEnabledFeatures::sharedFeatures().setDOMIteratorEnabled(!!enabled);
+
 #if ENABLE(FETCH_API)
     hr = prefsPrivate->fetchAPIEnabled(&enabled);
     if (FAILED(hr))
index 0debbf6..3fb2042 100644 (file)
@@ -1,3 +1,16 @@
+2016-07-01  Youenn Fablet  <youennf@gmail.com>
+
+        Add a runtime flag for DOM iterators
+        https://bugs.webkit.org/show_bug.cgi?id=159300
+
+        Reviewed by Alex Christensen.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2016-07-01  Andreas Kling  <akling@apple.com>
 
         [Mac] Get rid of the old timey rubber-banding linen pattern.
index 7d9e0f0..d4b9731 100644 (file)
     macro(HTTPEquivEnabled, httpEquivEnabled, Bool, bool, true, "", "") \
     macro(MockCaptureDevicesEnabled, mockCaptureDevicesEnabled, Bool, bool, false, "", "") \
     macro(ShadowDOMEnabled, shadowDOMEnabled, Bool, bool, true, "Shadow DOM", "HTML Shadow DOM prototype") \
+    macro(DOMIteratorEnabled, domIteratorEnabled, Bool, bool, true, "", "") \
     macro(FetchAPIEnabled, fetchAPIEnabled, Bool, bool, false, "", "") \
     macro(DownloadAttributeEnabled, downloadAttributeEnabled, Bool, bool, false, "", "") \
     macro(SelectionPaintingWithoutSelectionGapsEnabled, selectionPaintingWithoutSelectionGapsEnabled, Bool, bool, DEFAULT_SELECTION_PAINTING_WITHOUT_SELECTION_GAPS_ENABLED, "", "") \
index 283a967..6f3a7ca 100644 (file)
@@ -196,6 +196,9 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page
     if (preference == "WebKitShadowDOMEnabled")
         RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled(enabled);
 
+    if (preference == "WebKitDOMIteratorEnabled")
+        RuntimeEnabledFeatures::sharedFeatures().setDOMIteratorEnabled(enabled);
+
 #if ENABLE(CSS_GRID_LAYOUT)
     if (preference == "WebKitCSSGridLayoutEnabled")
         RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(enabled);
index 2548813..da89bc7 100644 (file)
@@ -3149,6 +3149,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
 
     RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled(store.getBoolValueForKey(WebPreferencesKey::shadowDOMEnabledKey()));
 
+    RuntimeEnabledFeatures::sharedFeatures().setDOMIteratorEnabled(store.getBoolValueForKey(WebPreferencesKey::domIteratorEnabledKey()));
+
     // Experimental Features.
 
 #if ENABLE(CSS_GRID_LAYOUT)
index dea16b1..ef69942 100644 (file)
@@ -1,3 +1,21 @@
+2016-07-01  Youenn Fablet  <youennf@gmail.com>
+
+        Add a runtime flag for DOM iterators
+        https://bugs.webkit.org/show_bug.cgi?id=159300
+
+        Reviewed by Alex Christensen.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (resetWebPreferencesToConsistentValues):
+        * Scripts/webkitperl/FeatureList.pm:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setDOMIteratorEnabled):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
 2016-06-30  Tina Liu  <iting_liu@apple.com>
 
         Add an API test for WKPageRestoreFromSessionStateWithoutNavigation.
index 45a805a..5d90f5c 100644 (file)
@@ -979,6 +979,8 @@ static void resetWebPreferencesToConsistentValues()
     [preferences setShadowDOMEnabled:YES];
     [preferences setCustomElementsEnabled:YES];
 
+    [preferences setDOMIteratorEnabled:YES];
+
     [preferences setWebGL2Enabled:YES];
 
     [preferences setFetchAPIEnabled:YES];
index 6824313..e6b3e32 100644 (file)
@@ -853,6 +853,8 @@ static void resetWebPreferencesToConsistentValues(IWebPreferences* preferences)
     prefsPrivate3->setShadowDOMEnabled(TRUE);
     prefsPrivate3->setCustomElementsEnabled(TRUE);
 
+    prefsPrivate3->setDOMIteratorEnabled(TRUE);
+
     setAlwaysAcceptCookies(false);
 }
 
index d6f124d..a95086c 100644 (file)
@@ -80,6 +80,7 @@ my (
     $deviceOrientationSupport,
     $directoryUploadSupport,
     $dom4EventsConstructor,
+    $domIterator,
     $downloadAttributeSupport,
     $fetchAPISupport,
     $fontLoadEventsSupport,
index 94dc42b..0c0b8b0 100644 (file)
@@ -314,6 +314,8 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings)
     m_testRunner->setShadowDOMEnabled(true);
     m_testRunner->setCustomElementsEnabled(true);
 
+    m_testRunner->setDOMIteratorEnabled(true);
+
     m_testRunner->setWebGL2Enabled(true);
 
     m_testRunner->setFetchAPIEnabled(true);
index 880d621..c5ede37 100644 (file)
@@ -348,6 +348,13 @@ void TestRunner::setCustomElementsEnabled(bool enabled)
     WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
 }
 
+void TestRunner::setDOMIteratorEnabled(bool enabled)
+{
+    WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitDOMIteratorEnabled"));
+    auto& injectedBundle = InjectedBundle::singleton();
+    WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
+}
+
 void TestRunner::setWebGL2Enabled(bool enabled)
 {
     WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitWebGL2Enabled"));
index 2cf0bf0..d4add18 100644 (file)
@@ -102,6 +102,7 @@ public:
     void setXSSAuditorEnabled(bool);
     void setShadowDOMEnabled(bool);
     void setCustomElementsEnabled(bool);
+    void setDOMIteratorEnabled(bool);
     void setWebGL2Enabled(bool);
     void setFetchAPIEnabled(bool);
     void setAllowUniversalAccessFromFileURLs(bool);