Changeset 207236 in webkit


Ignore:
Timestamp:
Oct 12, 2016 1:23:03 PM (7 years ago)
Author:
achristensen@apple.com
Message:

Fix assertion after switching to URLParser
https://bugs.webkit.org/show_bug.cgi?id=163350
rdar://problem/28739938

Reviewed by Brady Eidson.
Source/WebKit2:


Covered by a new API test.

  • UIProcess/API/Cocoa/_WKUserStyleSheet.mm:

(-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]):
The { } here is not understood by the compiler to mean WebCore::URL(), but rather the empty constructor for the enum ParsedURLStringTag.
We used to be unsafely trusting that the URL was valid and canonicalized, but with URLParser we are canonicalizing it,
and the assertion (url == m_string) in URL.cpp was failing.

Tools:

  • TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm:

(TEST):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r207224 r207236  
     12016-10-12  Alex Christensen  <achristensen@webkit.org>
     2
     3        Fix assertion after switching to URLParser
     4        https://bugs.webkit.org/show_bug.cgi?id=163350
     5        rdar://problem/28739938
     6
     7        Reviewed by Brady Eidson.
     8       
     9        Covered by a new API test.
     10
     11        * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
     12        (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]):
     13        The { } here is not understood by the compiler to mean WebCore::URL(), but rather the empty constructor for the enum ParsedURLStringTag.
     14        We used to be unsafely trusting that the URL was valid and canonicalized, but with URLParser we are canonicalizing it,
     15        and the assertion (url == m_string) in URL.cpp was failing.
     16
    1172016-10-12  Anders Carlsson  <andersca@apple.com>
    218
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserStyleSheet.mm

    r202758 r207236  
    7171    WebKit::InitializeWebKit2();
    7272
    73     API::Object::constructInWrapper<API::UserStyleSheet>(self, WebCore::UserStyleSheet { WTF::String(source), { { }, WTF::String([baseURL _web_originalDataAsWTFString]) }, API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames, WebCore::UserStyleUserLevel }, *userContentWorld->_userContentWorld);
     73    API::Object::constructInWrapper<API::UserStyleSheet>(self, WebCore::UserStyleSheet { WTF::String(source), { WebCore::URL(), WTF::String([baseURL _web_originalDataAsWTFString]) }, API::toStringVector(legacyWhitelist), API::toStringVector(legacyBlacklist), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames, WebCore::UserStyleUserLevel }, *userContentWorld->_userContentWorld);
    7474
    7575    return self;
  • trunk/Tools/ChangeLog

    r207225 r207236  
     12016-10-12  Alex Christensen  <achristensen@webkit.org>
     2
     3        Fix assertion after switching to URLParser
     4        https://bugs.webkit.org/show_bug.cgi?id=163350
     5        rdar://problem/28739938
     6
     7        Reviewed by Brady Eidson.
     8
     9        * TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm:
     10        (TEST):
     11
    1122016-10-11  Sam Weinig  <sam@webkit.org>
    213
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm

    r205329 r207236  
    363363}
    364364
     365TEST(WKUserContentController, NonCanonicalizedURL)
     366{
     367    RetainPtr<_WKUserContentWorld> world = adoptNS([_WKUserContentWorld worldWithName:@"TestWorld"]);
     368    RetainPtr<_WKUserStyleSheet> styleSheet = adoptNS([[_WKUserStyleSheet alloc] initWithSource:styleSheetSource forMainFrameOnly:NO legacyWhitelist:@[] legacyBlacklist:@[] baseURL:[[NSURL alloc] initWithString:@"http://CamelCase/"] userContentWorld:world.get()]);
     369}
     370
    365371TEST(WKUserContentController, AddUserStyleSheetAfterCreatingView)
    366372{
Note: See TracChangeset for help on using the changeset viewer.