Updated Branches: refs/heads/master 1a6093513 -> ca0cb8915
Change XHR bridge mode to succeed instead of fail. It's 20% slower to use a successful request, but it prevents spamming the iOS6 web inspector console. Addresses issue: https://issues.apache.org/jira/browse/CB-1476 Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/ca0cb891 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/ca0cb891 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/ca0cb891 Branch: refs/heads/master Commit: ca0cb89150eaeaa0246981f131acd495794235de Parents: 0ac47db Author: Andrew Grieve <agri...@chromium.org> Authored: Thu Sep 27 09:49:17 2012 -0400 Committer: Andrew Grieve <agri...@chromium.org> Committed: Thu Sep 27 10:02:03 2012 -0400 ---------------------------------------------------------------------- CordovaLib/Classes/CDVURLProtocol.m | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/ca0cb891/CordovaLib/Classes/CDVURLProtocol.m ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVURLProtocol.m b/CordovaLib/Classes/CDVURLProtocol.m index a9ae519..d14b087 100644 --- a/CordovaLib/Classes/CDVURLProtocol.m +++ b/CordovaLib/Classes/CDVURLProtocol.m @@ -86,7 +86,9 @@ static NSMutableSet* gRegisteredControllers = nil; [viewController performSelectorOnMainThread:@selector(flushCommandQueue) withObject:nil waitUntilDone:NO]; } } - return NO; + // Returning NO here would be 20% faster, but it spams WebInspector's console with failure messages. + // If JS->Native bridge speed is really important for an app, they should use the iframe bridge. + return YES; } // we only care about http and https connections @@ -108,6 +110,12 @@ static NSMutableSet* gRegisteredControllers = nil; { // NSLog(@"%@ received %@ - start", self, NSStringFromSelector(_cmd)); NSURL* url = [[self request] URL]; + + if ([[url path] isEqualToString:@"/!gap_exec"]) { + [[self client] URLProtocolDidFinishLoading:self]; + return; + } + NSString* body = [gWhitelist errorStringForURL:url]; CDVHTTPURLResponse* response = [[CDVHTTPURLResponse alloc] initWithUnauthorizedURL:url];