cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bra...@apache.org
Subject [1/2] ios commit: Don't call onReset for iframe navigation
Date Tue, 12 Feb 2013 15:18:12 GMT
Don't call onReset for iframe navigation


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

Branch: refs/heads/master
Commit: 40e350eebd05d26d35df1d60733cac7d3d728907
Parents: 6e19115
Author: Braden Shepherdson <braden@chromium.org>
Authored: Tue Feb 12 10:17:04 2013 -0500
Committer: Braden Shepherdson <braden@chromium.org>
Committed: Tue Feb 12 10:17:04 2013 -0500

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/40e350ee/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index edd4299..73ea987 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -46,6 +46,7 @@
 @property (nonatomic, readwrite, strong) IBOutlet UIActivityIndicatorView* activityView;
 @property (nonatomic, readwrite, strong) UIImageView* imageView;
 @property (readwrite, assign) BOOL initialized;
+@property (nonatomic, readwrite, assign) BOOL isTopLevelNavigation;
 
 @property (atomic, strong) NSURL* openURL;
 
@@ -60,6 +61,7 @@
 @synthesize wwwFolderName, startPage, initialized, openURL;
 @synthesize commandDelegate = _commandDelegate;
 @synthesize commandQueue = _commandQueue;
+@synthesize isTopLevelNavigation;
 
 - (void)__init
 {
@@ -497,7 +499,10 @@
 - (void)webViewDidStartLoad:(UIWebView*)theWebView
 {
     [_commandQueue resetRequestId];
-    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginResetNotification
object:nil]];
+    // Only send the reset message for top-level navigation.
+    if (self.isTopLevelNavigation) {
+        [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginResetNotification
object:nil]];
+    }
 }
 
 /**
@@ -545,6 +550,9 @@
 {
     NSURL* url = [request URL];
 
+    // Set a flag on iframe navigation, which will not trigger a reset of plugins.
+    self.isTopLevelNavigation = [[[request URL] absoluteString] isEqualToString:[[request
mainDocumentURL] absoluteString]];
+
     /*
      * Execute any commands queued with cordova.exec() on the JS side.
      * The part of the URL after gap:// is irrelevant.
@@ -594,8 +602,6 @@
      * Handle all other types of urls (tel:, sms:), and requests to load a url in the main
webview.
      */
     else {
-        // BOOL isIFrame = ([theWebView.request.mainDocumentURL absoluteString] == nil);
-
         if ([self.whitelist schemeIsAllowed:[url scheme]]) {
             return [self.whitelist URLIsAllowed:url];
         } else {


Mime
View raw message