Changeset 169000 in webkit
- Timestamp:
- May 17, 2014, 4:24:34 PM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/API/Cocoa/WKUserContentController.mm (modified) (2 diffs)
-
UIProcess/API/Cocoa/WKUserScript.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r168999 r169000 1 2014-05-17 Anders Carlsson <andersca@apple.com> 2 3 Give user scripts custom URLs 4 https://bugs.webkit.org/show_bug.cgi?id=133035 5 6 Reviewed by Beth Dakin. 7 8 * UIProcess/API/Cocoa/WKUserContentController.mm: 9 (-[WKUserContentController addUserScript:]): 10 Create a user-script:<number> URL for user scripts. 11 12 * UIProcess/API/Cocoa/WKUserScript.h: 13 Move the init method after the properties. 14 1 15 2014-05-17 Anders Carlsson <andersca@apple.com> 2 16 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm
r168994 r169000 33 33 #import "_WKScriptWorld.h" 34 34 #import <WebCore/UserScript.h> 35 #import <wtf/text/StringBuilder.h> 35 36 36 37 @implementation WKUserContentController { … … 72 73 [_userScripts addObject:userScript]; 73 74 74 _userContentControllerProxy->addUserScript(WebCore::UserScript { userScript->_source.get(), WebCore::blankURL(), { }, { }, toWebCoreUserScriptInjectionTime(userScript->_injectionTime), userScript->_forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }); 75 StringBuilder urlStringBuilder; 76 urlStringBuilder.append("user-script:"); 77 urlStringBuilder.appendNumber([_userScripts count]); 78 79 WebCore::URL url { WebCore::URL { }, urlStringBuilder.toString() }; 80 _userContentControllerProxy->addUserScript(WebCore::UserScript { userScript->_source.get(), url, { }, { }, toWebCoreUserScriptInjectionTime(userScript->_injectionTime), userScript->_forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }); 75 81 } 76 82 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserScript.h
r168994 r169000 45 45 @interface WKUserScript : NSObject <NSCopying> 46 46 47 /*! @abstract Returns an initialized user script that can be added to a @link WKUserContentController @/link.48 @param source The script source.49 @param injectionTime When the script should be injected.50 @param forMainFrameOnly Whether the script should be injected into all frames or just the main frame.51 */52 - (instancetype)initWithSource:(NSString *)source injectionTime:(WKUserScriptInjectionTime)injectionTime forMainFrameOnly:(BOOL)forMainFrameOnly;53 54 47 /* @abstract The script source code. */ 55 48 @property (nonatomic, readonly) NSString *source; … … 61 54 @property (nonatomic, readonly, getter=isForMainFrameOnly) BOOL forMainFrameOnly; 62 55 56 /*! @abstract Returns an initialized user script that can be added to a @link WKUserContentController @/link. 57 @param source The script source. 58 @param injectionTime When the script should be injected. 59 @param forMainFrameOnly Whether the script should be injected into all frames or just the main frame. 60 */ 61 - (instancetype)initWithSource:(NSString *)source injectionTime:(WKUserScriptInjectionTime)injectionTime forMainFrameOnly:(BOOL)forMainFrameOnly; 62 63 63 @end 64 64
Note:
See TracChangeset
for help on using the changeset viewer.