You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mm...@apache.org on 2013/02/25 14:41:02 UTC
[3/50] ios commit: Don't call onReset for iframe navigation
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/multipart_plugin_result
Commit: 40e350eebd05d26d35df1d60733cac7d3d728907
Parents: 6e19115
Author: Braden Shepherdson <br...@chromium.org>
Authored: Tue Feb 12 10:17:04 2013 -0500
Committer: Braden Shepherdson <br...@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 {