Changeset 142726 in webkit


Ignore:
Timestamp:
Feb 12, 2013 11:34:47 PM (11 years ago)
Author:
morrita@google.com
Message:

[Internals] setShadowDOMEnabled() shouldn't be used except a few tests.
https://bugs.webkit.org/show_bug.cgi?id=109642

Reviewed by Kent Tamura.

Source/WebCore:

InternalSettings.setShadowDOMEnabled() shouldn't be called after
any relevant DOM bindings are touched. However for fuzzers, it
isn't trivial to regulate its behavior.

This change whitelists the URL of running test for prevent
unintended API calls. This doesn't hurt the Internals usability
since the API is called from just a couple of tests and the number
isn't expected to grow.

Test: fast/dom/shadow/shadow-dom-enabled-flag-whitelist.html

  • testing/InternalSettings.cpp:

(WebCore::urlIsWhitelisted):
(WebCore):
(WebCore::InternalSettings::setShadowDOMEnabled):

LayoutTests:

  • fast/dom/shadow/shadow-dom-enabled-flag-whitelist-expected.txt: Added.
  • fast/dom/shadow/shadow-dom-enabled-flag-whitelist.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r142725 r142726  
     12013-02-12  Hajime Morrita  <morrita@google.com>
     2
     3        [Internals] setShadowDOMEnabled() shouldn't be used except a few tests.
     4        https://bugs.webkit.org/show_bug.cgi?id=109642
     5
     6        Reviewed by Kent Tamura.
     7
     8        * fast/dom/shadow/shadow-dom-enabled-flag-whitelist-expected.txt: Added.
     9        * fast/dom/shadow/shadow-dom-enabled-flag-whitelist.html: Added.
     10
    1112013-02-12  Vsevolod Vlasov  <vsevik@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r142725 r142726  
     12013-02-12  Hajime Morrita  <morrita@google.com>
     2
     3        [Internals] setShadowDOMEnabled() shouldn't be used except a few tests.
     4        https://bugs.webkit.org/show_bug.cgi?id=109642
     5
     6        Reviewed by Kent Tamura.
     7
     8        InternalSettings.setShadowDOMEnabled() shouldn't be called after
     9        any relevant DOM bindings are touched. However for fuzzers, it
     10        isn't trivial to regulate its behavior.
     11
     12        This change whitelists the URL of running test for prevent
     13        unintended API calls. This doesn't hurt the Internals usability
     14        since the API is called from just a couple of tests and the number
     15        isn't expected to grow.
     16
     17        Test: fast/dom/shadow/shadow-dom-enabled-flag-whitelist.html
     18
     19        * testing/InternalSettings.cpp:
     20        (WebCore::urlIsWhitelisted):
     21        (WebCore):
     22        (WebCore::InternalSettings::setShadowDOMEnabled):
     23
    1242013-02-12  Vsevolod Vlasov  <vsevik@chromium.org>
    225
  • trunk/Source/WebCore/testing/InternalSettings.cpp

    r142509 r142726  
    196196}
    197197
     198static bool urlIsWhitelistedForSetShadowDOMEnabled(const String& url)
     199{
     200    // This check is just for preventing fuzzers from crashing because of unintended API calls.
     201    // You can list your test if needed.
     202    return notFound != url.find("fast/dom/shadow/content-shadow-unknown.html")
     203        || notFound != url.find("fast/dom/shadow/insertion-points-with-shadow-disabled.html");
     204}
     205
    198206void InternalSettings::setShadowDOMEnabled(bool enabled, ExceptionCode& ec)
    199207{
     208    if (!urlIsWhitelistedForSetShadowDOMEnabled(page()->mainFrame()->document()->url().string())) {
     209        ec = INVALID_ACCESS_ERR;
     210        return;
     211    }
     212
    200213#if ENABLE(SHADOW_DOM)
    201     UNUSED_PARAM(ec);
    202214    RuntimeEnabledFeatures::setShadowDOMEnabled(enabled);
    203215#else
Note: See TracChangeset for help on using the changeset viewer.