⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 169057 in webkit


Ignore:
Timestamp:
May 19, 2014, 1:05:16 PM (12 years ago)
Author:
Lucas Forschler
Message:

Merged r169000.

Location:
branches/safari-538.34.5-branch/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-538.34.5-branch/Source/WebKit2/ChangeLog

    r169056 r169057  
     12014-05-19  Lucas Forschler  <lforschler@apple.com>
     2
     3        Merge r169000
     4
     5    2014-05-17  Anders Carlsson  <andersca@apple.com>
     6
     7            Give user scripts custom URLs
     8            https://bugs.webkit.org/show_bug.cgi?id=133035
     9
     10            Reviewed by Beth Dakin.
     11
     12            * UIProcess/API/Cocoa/WKUserContentController.mm:
     13            (-[WKUserContentController addUserScript:]):
     14            Create a user-script:<number> URL for user scripts.
     15
     16            * UIProcess/API/Cocoa/WKUserScript.h:
     17            Move the init method after the properties.
     18
    1192014-05-19  Lucas Forschler  <lforschler@apple.com>
    220
  • branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm

    r169056 r169057  
    3333#import "_WKScriptWorld.h"
    3434#import <WebCore/UserScript.h>
     35#import <wtf/text/StringBuilder.h>
    3536
    3637@implementation WKUserContentController {
    … …  
    7273    [_userScripts addObject:userScript];
    7374
    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 });
    7581}
    7682
  • branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUserScript.h

    r169056 r169057  
    4545@interface WKUserScript : NSObject <NSCopying>
    4646
    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 
    5447/* @abstract The script source code. */
    5548@property (nonatomic, readonly) NSString *source;
    … …  
    6154@property (nonatomic, readonly, getter=isForMainFrameOnly) BOOL forMainFrameOnly;
    6255
     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
    6363@end
    6464
Note: See TracChangeset for help on using the changeset viewer.