Title: [207236] trunk
- Revision
- 207236
- Author
- achristen...@apple.com
- Date
- 2016-10-12 13:23:03 -0700 (Wed, 12 Oct 2016)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (207235 => 207236)
--- trunk/Source/WebKit2/ChangeLog 2016-10-12 19:40:51 UTC (rev 207235)
+++ trunk/Source/WebKit2/ChangeLog 2016-10-12 20:23:03 UTC (rev 207236)
@@ -1,3 +1,19 @@
+2016-10-12 Alex Christensen <achristen...@webkit.org>
+
+ Fix assertion after switching to URLParser
+ https://bugs.webkit.org/show_bug.cgi?id=163350
+ rdar://problem/28739938
+
+ Reviewed by Brady Eidson.
+
+ 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.
+
2016-10-12 Anders Carlsson <ander...@apple.com>
Remove an unused function
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserStyleSheet.mm (207235 => 207236)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserStyleSheet.mm 2016-10-12 19:40:51 UTC (rev 207235)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserStyleSheet.mm 2016-10-12 20:23:03 UTC (rev 207236)
@@ -70,7 +70,7 @@
// FIXME: In the API test, we can use generateUniqueURL below before the API::Object constructor has done this... where should this really be?
WebKit::InitializeWebKit2();
- 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);
+ 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);
return self;
}
Modified: trunk/Tools/ChangeLog (207235 => 207236)
--- trunk/Tools/ChangeLog 2016-10-12 19:40:51 UTC (rev 207235)
+++ trunk/Tools/ChangeLog 2016-10-12 20:23:03 UTC (rev 207236)
@@ -1,3 +1,14 @@
+2016-10-12 Alex Christensen <achristen...@webkit.org>
+
+ Fix assertion after switching to URLParser
+ https://bugs.webkit.org/show_bug.cgi?id=163350
+ rdar://problem/28739938
+
+ Reviewed by Brady Eidson.
+
+ * TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm:
+ (TEST):
+
2016-10-11 Sam Weinig <s...@webkit.org>
Optional's move-constructor and move-assignment operator don't disengage the value being moved from
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm (207235 => 207236)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm 2016-10-12 19:40:51 UTC (rev 207235)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm 2016-10-12 20:23:03 UTC (rev 207236)
@@ -362,6 +362,12 @@
expectScriptEvaluatesToColor(webView.get(), backgroundColorScript, greenInRGB);
}
+TEST(WKUserContentController, NonCanonicalizedURL)
+{
+ RetainPtr<_WKUserContentWorld> world = adoptNS([_WKUserContentWorld worldWithName:@"TestWorld"]);
+ RetainPtr<_WKUserStyleSheet> styleSheet = adoptNS([[_WKUserStyleSheet alloc] initWithSource:styleSheetSource forMainFrameOnly:NO legacyWhitelist:@[] legacyBlacklist:@[] baseURL:[[NSURL alloc] initWithString:@"http://CamelCase/"] userContentWorld:world.get()]);
+}
+
TEST(WKUserContentController, AddUserStyleSheetAfterCreatingView)
{
RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes