You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/09/17 23:44:18 UTC

[1/2] ios commit: CB-9558 - Blob schemes won't load in iframes

Repository: cordova-ios
Updated Branches:
  refs/heads/master 36d3b95db -> cbe21f885


CB-9558 - Blob schemes won't load in iframes


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/9d1f88d4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/9d1f88d4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/9d1f88d4

Branch: refs/heads/master
Commit: 9d1f88d4b4ba1bb29e25d412a272941472aa9927
Parents: 36d3b95
Author: voliva <vi...@slashmobility.org>
Authored: Wed Aug 26 15:40:39 2015 +0200
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Sep 17 14:47:47 2015 -0700

----------------------------------------------------------------------
 .../Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9d1f88d4/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m b/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m
index 54e2b2e..4639421 100644
--- a/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m
+++ b/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m
@@ -197,7 +197,7 @@ static NSString *stripFragment(NSString* url)
 {
     NSString* scheme = [[request URL] scheme];
 
-    if ([scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"tel"] || [scheme isEqualToString:@"sms"]) {
+    if ([scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"tel"] || [scheme isEqualToString:@"sms"] || [scheme isEqualToString:@"blob"]) {
         return YES;
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[2/2] ios commit: CB-9558 - Add blob: to allowedSchemes used by CDVUIWebViewDelegate::shouldLoadRequest (closes #163)

Posted by sh...@apache.org.
CB-9558 - Add blob: to allowedSchemes used by CDVUIWebViewDelegate::shouldLoadRequest (closes #163)

- defaultResourcePolicyForURL returns YES for blob:
- add blob:tests


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/cbe21f88
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/cbe21f88
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/cbe21f88

Branch: refs/heads/master
Commit: cbe21f88571b674f23aea2a894363be101a10276
Parents: 9d1f88d
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Mon Sep 14 16:56:01 2015 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Sep 17 14:47:55 2015 -0700

----------------------------------------------------------------------
 .../Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m       | 9 +++++----
 CordovaLib/Classes/Public/CDVViewController.m               | 6 ++++--
 tests/CordovaLibTests/CDVWebViewDelegateTests.m             | 6 ++++++
 3 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/cbe21f88/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m b/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m
index 4639421..0af97df 100644
--- a/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m
+++ b/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m
@@ -196,12 +196,13 @@ static NSString *stripFragment(NSString* url)
 - (BOOL)shouldLoadRequest:(NSURLRequest*)request
 {
     NSString* scheme = [[request URL] scheme];
-
-    if ([scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"tel"] || [scheme isEqualToString:@"sms"] || [scheme isEqualToString:@"blob"]) {
+    NSArray* allowedSchemes = [NSArray arrayWithObjects:@"mailto",@"tel",@"blob",@"sms",@"data", nil];
+    if([allowedSchemes containsObject:scheme]) {
         return YES;
     }
-
-    return [NSURLConnection canHandleRequest:request];
+    else {
+        return [NSURLConnection canHandleRequest:request];
+    }
 }
 
 - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/cbe21f88/CordovaLib/Classes/Public/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVViewController.m b/CordovaLib/Classes/Public/CDVViewController.m
index 299fb6c..a5218f0 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -502,11 +502,13 @@
     else if ([[url scheme] isEqualToString:@"about"]) {
         return NO;
     }
-
+ 
     /*
      * all data: scheme urls are handled
      */
-    else if ([[url scheme] isEqualToString:@"data"]) {
+    NSString* scheme = [url scheme];
+    NSArray* allowedSchemes = [NSArray arrayWithObjects:@"blob",@"data", nil];
+    if([allowedSchemes containsObject:scheme]) {
         return YES;
     }
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/cbe21f88/tests/CordovaLibTests/CDVWebViewDelegateTests.m
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CDVWebViewDelegateTests.m b/tests/CordovaLibTests/CDVWebViewDelegateTests.m
index 5606db6..9fe1acd 100644
--- a/tests/CordovaLibTests/CDVWebViewDelegateTests.m
+++ b/tests/CordovaLibTests/CDVWebViewDelegateTests.m
@@ -85,11 +85,17 @@
     NSURLRequest* mailtoUrl = [NSURLRequest requestWithURL:[NSURL URLWithString:@"mailto:dev@cordova.apache.org"]];
     NSURLRequest* telUrl = [NSURLRequest requestWithURL:[NSURL URLWithString:@"tel:12345"]];
     NSURLRequest* plainUrl = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://apache.org"]];
+    NSURLRequest* dataUrl = [NSURLRequest requestWithURL:[NSURL URLWithString:@"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="]];
+    NSURLRequest* blobUrl = [NSURLRequest requestWithURL:[NSURL URLWithString:@"blob:d3958f5c-0777-0845-9dcf-2cb28783acaf"]];
+
 
     XCTAssertTrue([wvd shouldLoadRequest:mailtoUrl], @"mailto urls should be allowed");
     XCTAssertTrue([wvd shouldLoadRequest:telUrl], @"tel urls should be allowed");
     // as long as this is in the whitelist it should pass
     XCTAssertTrue([wvd shouldLoadRequest:plainUrl], @"http urls should be allowed");
+
+    XCTAssertTrue([wvd shouldLoadRequest:dataUrl], @"data urls should be allowed");
+    XCTAssertTrue([wvd shouldLoadRequest:blobUrl], @"blob urls should be allowed");
 }
 
 - (void)testFragmentIdentifiersWithHttpUrl


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org