⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 130657 in webkit


Ignore:
Timestamp:
Oct 8, 2012, 11:15:01 AM (14 years ago)
Author:
mkwst@chromium.org
Message:

Null-check for DOMWindow before feeding it to FeatureObserver.
​https://bugs.webkit.org/show_bug.cgi?id=98624

Reviewed by Adam Barth.

Source/WebCore:

We shouldn't call out to FeatureObserver in
ContentSecurityPolicy::didReceiveHeader if the policy's document doesn't
have a DOMWindow.

Test: http/tests/security/contentSecurityPolicy/xmlhttprequest-protected-resource-does-not-crash.html

  • page/ContentSecurityPolicy.cpp:

(WebCore::ContentSecurityPolicy::didReceiveHeader):

Null check 'document->domWindow' before passing it on.

  • page/FeatureObserver.cpp:

(WebCore::FeatureObserver::observe):

ASSERT 'domWindow'.

LayoutTests:

  • http/tests/security/contentSecurityPolicy/xmlhttprequest-protected-resource-does-not-crash-expected.txt: Added.
  • http/tests/security/contentSecurityPolicy/xmlhttprequest-protected-resource-does-not-crash.html: Added.

This test shouldn't crash.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r130655 r130657  
     12012-10-08  Mike West  <mkwst@chromium.org>
     2
     3        Null-check for DOMWindow before feeding it to FeatureObserver.
     4        https://bugs.webkit.org/show_bug.cgi?id=98624
     5
     6        Reviewed by Adam Barth.
     7
     8        * http/tests/security/contentSecurityPolicy/xmlhttprequest-protected-resource-does-not-crash-expected.txt: Added.
     9        * http/tests/security/contentSecurityPolicy/xmlhttprequest-protected-resource-does-not-crash.html: Added.
     10            This test shouldn't crash.
     11
    1122012-10-08  Tony Chang  <tony@chromium.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r130651 r130657  
     12012-10-08  Mike West  <mkwst@chromium.org>
     2
     3        Null-check for DOMWindow before feeding it to FeatureObserver.
     4        https://bugs.webkit.org/show_bug.cgi?id=98624
     5
     6        Reviewed by Adam Barth.
     7
     8        We shouldn't call out to FeatureObserver in
     9        ContentSecurityPolicy::didReceiveHeader if the policy's document doesn't
     10        have a DOMWindow.
     11
     12        Test: http/tests/security/contentSecurityPolicy/xmlhttprequest-protected-resource-does-not-crash.html
     13
     14        * page/ContentSecurityPolicy.cpp:
     15        (WebCore::ContentSecurityPolicy::didReceiveHeader):
     16            Null check 'document->domWindow' before passing it on.
     17        * page/FeatureObserver.cpp:
     18        (WebCore::FeatureObserver::observe):
     19            ASSERT 'domWindow'.
     20
    1212012-10-08  Nate Chapin  <japhet@chromium.org>
    222
  • trunk/Source/WebCore/page/ContentSecurityPolicy.cpp

    r130150 r130657  
    13071307    if (m_scriptExecutionContext->isDocument()) {
    13081308        Document* document = static_cast<Document*>(m_scriptExecutionContext);
    1309         FeatureObserver::observe(document->domWindow(), FeatureObserver::PrefixedContentSecurityPolicy);
     1309        if (document->domWindow())
     1310            FeatureObserver::observe(document->domWindow(), FeatureObserver::PrefixedContentSecurityPolicy);
    13101311    }
    13111312
  • trunk/Source/WebCore/page/FeatureObserver.cpp

    r128788 r130657  
    5555void FeatureObserver::observe(DOMWindow* domWindow, Feature feature)
    5656{
     57    ASSERT(domWindow);
     58
    5759    Document* document = domWindow->document();
    5860    if (!document)
Note: See TracChangeset for help on using the changeset viewer.