Changeset 204986 in webkit


Ignore:
Timestamp:
Aug 25, 2016 2:48:33 PM (8 years ago)
Author:
Chris Dumez
Message:

Regression(r203623): Breaks App Store application
https://bugs.webkit.org/show_bug.cgi?id=161206
<rdar://problem/28015060>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Add quirks for the App Store application so that we log an error message
when passing a Document node to Window.getComputedStyle() instead of
throwing an exception.

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::getComputedStyle):

  • page/DOMWindow.h:
  • page/DOMWindow.idl:
  • platform/RuntimeApplicationChecks.h:
  • platform/RuntimeApplicationChecks.mm:

(WebCore::MacApplication::isAppStore):

LayoutTests:

Rebaseline existing test as the exception message is slightly different.

  • fast/dom/Window/getComputedStyle-missing-parameter-expected.txt:
  • fast/dom/Window/getComputedStyle-missing-parameter.html:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r204984 r204986  
     12016-08-25  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(r203623): Breaks App Store application
     4        https://bugs.webkit.org/show_bug.cgi?id=161206
     5        <rdar://problem/28015060>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Rebaseline existing test as the exception message is slightly different.
     10
     11        * fast/dom/Window/getComputedStyle-missing-parameter-expected.txt:
     12        * fast/dom/Window/getComputedStyle-missing-parameter.html:
     13
    1142016-08-25  Jiewen Tan  <jiewen_tan@apple.com>
    215
  • trunk/LayoutTests/fast/dom/Window/getComputedStyle-missing-parameter-expected.txt

    r203858 r204986  
    55
    66PASS window.getComputedStyle() threw exception TypeError: Not enough arguments.
    7 PASS window.getComputedStyle(null) threw exception TypeError: Argument 1 ('element') to Window.getComputedStyle must be an instance of Element.
     7PASS window.getComputedStyle(null) threw exception TypeError: Type error.
    88PASS successfullyParsed is true
    99
  • trunk/LayoutTests/fast/dom/Window/getComputedStyle-missing-parameter.html

    r203858 r204986  
    66description("Test that the first parameter to Window.getComputedStyle() is mandatory and not nullable.");
    77
    8 shouldThrow("window.getComputedStyle()", "'TypeError: Not enough arguments'");
    9 shouldThrow("window.getComputedStyle(null)", "'TypeError: Argument 1 (\\'element\\') to Window.getComputedStyle must be an instance of Element'");
     8shouldThrowErrorName("window.getComputedStyle()", "TypeError");
     9shouldThrowErrorName("window.getComputedStyle(null)", "TypeError");
    1010</script>
    1111<script src="../../../resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r204983 r204986  
     12016-08-25  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(r203623): Breaks App Store application
     4        https://bugs.webkit.org/show_bug.cgi?id=161206
     5        <rdar://problem/28015060>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Add quirks for the App Store application so that we log an error message
     10        when passing a Document node to Window.getComputedStyle() instead of
     11        throwing an exception.
     12
     13        * page/DOMWindow.cpp:
     14        (WebCore::DOMWindow::getComputedStyle):
     15        * page/DOMWindow.h:
     16        * page/DOMWindow.idl:
     17        * platform/RuntimeApplicationChecks.h:
     18        * platform/RuntimeApplicationChecks.mm:
     19        (WebCore::MacApplication::isAppStore):
     20
    1212016-08-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
    222
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r204732 r204986  
    8282#include "Performance.h"
    8383#include "ResourceLoadInfo.h"
     84#include "RuntimeApplicationChecks.h"
    8485#include "RuntimeEnabledFeatures.h"
    8586#include "ScheduledAction.h"
     
    14061407}
    14071408
     1409// FIXME: Drop this overload once <rdar://problem/28016778> has been fixed.
     1410RefPtr<CSSStyleDeclaration> DOMWindow::getComputedStyle(Document&, const String&, ExceptionCode& ec)
     1411{
     1412#if PLATFORM(MAC)
     1413    if (MacApplication::isAppStore()) {
     1414        printErrorMessage(ASCIILiteral("Passing a non-Element as first parameter to window.getComputedStyle() is invalid and always returns null"));
     1415        return nullptr;
     1416    }
     1417#endif
     1418    ec = TypeError;
     1419    return nullptr;
     1420}
     1421
    14081422RefPtr<CSSRuleList> DOMWindow::getMatchedCSSRules(Element* element, const String& pseudoElement, bool authorOnly) const
    14091423{
  • trunk/Source/WebCore/page/DOMWindow.h

    r204732 r204986  
    230230
    231231        WEBCORE_EXPORT RefPtr<CSSStyleDeclaration> getComputedStyle(Element&, const String& pseudoElt) const;
     232        RefPtr<CSSStyleDeclaration> getComputedStyle(Document&, const String& pseudoElt, ExceptionCode&);
    232233
    233234        // WebKit extensions
  • trunk/Source/WebCore/page/DOMWindow.idl

    r204732 r204986  
    148148    // DOM Level 2 Style Interface
    149149    [NewObject] CSSStyleDeclaration getComputedStyle(Element element, optional DOMString? pseudoElement = null);
     150    // FIXME: Drop this overload once <rdar://problem/28016778> has been fixed.
     151    [NewObject, RaisesException] CSSStyleDeclaration getComputedStyle(Document document, optional DOMString? pseudoElement = null);
    150152
    151153    // WebKit extensions
  • trunk/Source/WebCore/platform/RuntimeApplicationChecks.h

    r203392 r204986  
    5252WEBCORE_EXPORT bool isVersions();
    5353WEBCORE_EXPORT bool isHRBlock();
     54WEBCORE_EXPORT bool isAppStore();
    5455
    5556} // MacApplication
  • trunk/Source/WebCore/platform/RuntimeApplicationChecks.mm

    r203392 r204986  
    155155}
    156156
     157bool MacApplication::isAppStore()
     158{
     159    static bool isAppStore = applicationBundleIsEqualTo("com.apple.appstore");
     160    return isAppStore;
     161}
     162
    157163#endif // PLATFORM(MAC)
    158164
Note: See TracChangeset for help on using the changeset viewer.