Title: [169057] branches/safari-538.34.5-branch/Source/WebKit2

Diff

Modified: branches/safari-538.34.5-branch/Source/WebKit2/ChangeLog (169056 => 169057)


--- branches/safari-538.34.5-branch/Source/WebKit2/ChangeLog	2014-05-19 19:58:47 UTC (rev 169056)
+++ branches/safari-538.34.5-branch/Source/WebKit2/ChangeLog	2014-05-19 20:05:16 UTC (rev 169057)
@@ -1,5 +1,23 @@
 2014-05-19  Lucas Forschler  <[email protected]>
 
+        Merge r169000
+
+    2014-05-17  Anders Carlsson  <[email protected]>
+
+            Give user scripts custom URLs
+            https://bugs.webkit.org/show_bug.cgi?id=133035
+
+            Reviewed by Beth Dakin.
+
+            * UIProcess/API/Cocoa/WKUserContentController.mm:
+            (-[WKUserContentController addUserScript:]):
+            Create a user-script:<number> URL for user scripts.
+
+            * UIProcess/API/Cocoa/WKUserScript.h:
+            Move the init method after the properties.
+
+2014-05-19  Lucas Forschler  <[email protected]>
+
         Merge r168994
 
     2014-05-16  Anders Carlsson  <[email protected]>

Modified: branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm (169056 => 169057)


--- branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm	2014-05-19 19:58:47 UTC (rev 169056)
+++ branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm	2014-05-19 20:05:16 UTC (rev 169057)
@@ -32,6 +32,7 @@
 #import "WebUserContentControllerProxy.h"
 #import "_WKScriptWorld.h"
 #import <WebCore/UserScript.h>
+#import <wtf/text/StringBuilder.h>
 
 @implementation WKUserContentController {
     RetainPtr<NSMutableArray> _userScripts;
@@ -71,7 +72,12 @@
 {
     [_userScripts addObject:userScript];
 
-    _userContentControllerProxy->addUserScript(WebCore::UserScript { userScript->_source.get(), WebCore::blankURL(), { }, { }, toWebCoreUserScriptInjectionTime(userScript->_injectionTime), userScript->_forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames });
+    StringBuilder urlStringBuilder;
+    urlStringBuilder.append("user-script:");
+    urlStringBuilder.appendNumber([_userScripts count]);
+
+    WebCore::URL url { WebCore::URL { }, urlStringBuilder.toString() };
+    _userContentControllerProxy->addUserScript(WebCore::UserScript { userScript->_source.get(), url, { }, { }, toWebCoreUserScriptInjectionTime(userScript->_injectionTime), userScript->_forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames });
 }
 
 - (void)removeAllUserScripts

Modified: branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserScript.h (169056 => 169057)


--- branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserScript.h	2014-05-19 19:58:47 UTC (rev 169056)
+++ branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserScript.h	2014-05-19 20:05:16 UTC (rev 169057)
@@ -44,13 +44,6 @@
 WK_CLASS_AVAILABLE(10_10, 8_0)
 @interface WKUserScript : NSObject <NSCopying>
 
-/*! @abstract Returns an initialized user script that can be added to a @link WKUserContentController @/link.
- @param source The script source.
- @param injectionTime When the script should be injected.
- @param forMainFrameOnly Whether the script should be injected into all frames or just the main frame.
- */
-- (instancetype)initWithSource:(NSString *)source injectionTime:(WKUserScriptInjectionTime)injectionTime forMainFrameOnly:(BOOL)forMainFrameOnly;
-
 /* @abstract The script source code. */
 @property (nonatomic, readonly) NSString *source;
 
@@ -60,6 +53,13 @@
 /* @abstract Whether the script should be injected into all frames or just the main frame. */
 @property (nonatomic, readonly, getter=isForMainFrameOnly) BOOL forMainFrameOnly;
 
+/*! @abstract Returns an initialized user script that can be added to a @link WKUserContentController @/link.
+ @param source The script source.
+ @param injectionTime When the script should be injected.
+ @param forMainFrameOnly Whether the script should be injected into all frames or just the main frame.
+ */
+- (instancetype)initWithSource:(NSString *)source injectionTime:(WKUserScriptInjectionTime)injectionTime forMainFrameOnly:(BOOL)forMainFrameOnly;
+
 @end
 
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to