Skip to content

Commit

Permalink
[TIMOB-23327] iOS: Removed firstLoad property
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelkPetkov committed May 26, 2016
1 parent b46b397 commit 727a56f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
9 changes: 1 addition & 8 deletions apidoc/Titanium/UI/WebView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ properties:
that is loaded will not be stopped even if it matches the blacklist.
type: Array<String>
since: "5.4.0"
platforms: [android]
platforms: [android,iphone,ipad]
availability: creation

- name: data
Expand All @@ -452,13 +452,6 @@ properties:
default: false
platforms: [iphone, ipad]

- name: blacklistFirstLoad
summary: Determines if the initial webview url will be checked against the blacklist.
platforms: [iphone,iphone]
type: Boolean
default: false
since: "5.4.0"

- name: enableJavascriptInterface
summary: Enable adding javascript interfaces internally to webview prior to JELLY_BEAN_MR1 (Android 4.2)
description: |
Expand Down
1 change: 0 additions & 1 deletion iphone/Classes/TiUIWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
BOOL willHandleUrl;
NSString* lastValidLoad;
NSMutableArray* blacklistedURLs;
BOOL blacklistFirstLoad;
}

@property(nonatomic,readonly) id url;
Expand Down
12 changes: 3 additions & 9 deletions iphone/Classes/TiUIWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,6 @@ -(void)setBlacklistedURLs_:(id)value
}
}

-(void)setBlacklistFirstLoad_:(id)value
{
ENSURE_TYPE(value, [NSNumber class]);
blacklistFirstLoad = [TiUtils boolValue:value def:NO];
}

-(void)setBackgroundColor_:(id)color
{
Expand Down Expand Up @@ -717,10 +712,10 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
RELEASE_TO_NIL(lastValidLoad);
}

if (blacklistedURLs && blacklistFirstLoad) {
if (blacklistedURLs) {
for (NSString*check in blacklistedURLs)
{
if ([newUrl.absoluteString containsString:[TiUtils stringValue:check]]) {
if ([[newUrl absoluteString] rangeOfString:check options:NSCaseInsensitiveSearch].location != NSNotFound) {
if([self.proxy _hasListeners:@"onStopBlacklistedUrl"]) {
NSDictionary* evt = [NSDictionary dictionaryWithObjectsAndKeys:[TiUtils stringValue:request], @"url", @"Webview did not load blacklisted url.", @"messsage", nil];
[self.proxy fireEvent:@"onStopBlacklistedUrl" withObject:evt];
Expand All @@ -729,8 +724,7 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
}
}
}
//Once this is set to true the blacklist check will be done
blacklistFirstLoad = true;

NSString * scheme = [[newUrl scheme] lowercaseString];
if ([scheme hasPrefix:@"http"] || [scheme isEqualToString:@"ftp"]
|| [scheme isEqualToString:@"file"] || [scheme isEqualToString:@"app"]) {
Expand Down

0 comments on commit 727a56f

Please sign in to comment.