Skip to content

Commit

Permalink
Update Cordova to 3.3.1-0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
grgar committed Mar 1, 2014
1 parent aca091b commit eca19bf
Show file tree
Hide file tree
Showing 26 changed files with 794 additions and 835 deletions.
6 changes: 6 additions & 0 deletions platforms/ios/CordovaLib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build/*
*.pbxuser
*.perspectivev3
*.mode1v3
javascripts/cordova-*.js

5 changes: 4 additions & 1 deletion platforms/ios/CordovaLib/Classes/CDVAvailability.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
#define __CORDOVA_2_8_0 20800
#define __CORDOVA_2_9_0 20900
#define __CORDOVA_3_0_0 30000
#define __CORDOVA_3_1_0 30100
#define __CORDOVA_3_2_0 30200
#define __CORDOVA_3_3_0 30300
#define __CORDOVA_NA 99999 /* not available */

/*
Expand All @@ -54,7 +57,7 @@
#endif
*/
#ifndef CORDOVA_VERSION_MIN_REQUIRED
#define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_0_0
#define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_3_0
#endif

/*
Expand Down
2 changes: 1 addition & 1 deletion platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ - (NSString*)userAgent
- (BOOL)URLIsWhitelisted:(NSURL*)url
{
return ![_viewController.whitelist schemeIsAllowed:[url scheme]] ||
[_viewController.whitelist URLIsAllowed:url];
[_viewController.whitelist URLIsAllowed:url logFailure:NO];
}

- (NSDictionary*)settings
Expand Down
38 changes: 25 additions & 13 deletions platforms/ios/CordovaLib/Classes/CDVCommandQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,22 @@ - (void)enqueCommandBatch:(NSString*)batchJSON

- (void)maybeFetchCommandsFromJs:(NSNumber*)requestId
{
NSInteger rid = [requestId integerValue];

// An ID of 1 is a special case because that signifies the first request of
// the page. Since resetRequestId is called from webViewDidStartLoad, and the
// JS context at the time of webViewDidStartLoad is still that of the previous
// page, it's possible for requests from the previous page to come in after this
// point. We ignore these by enforcing that ID=1 be the first ID.
if ((_lastCommandQueueFlushRequestId == 0) && (rid != 1)) {
CDV_EXEC_LOG(@"Exec: Ignoring exec request from previous page.");
return;
}

// Use the request ID to determine if we've already flushed for this request.
// This is required only because the NSURLProtocol enqueues the same request
// multiple times.
if ([requestId integerValue] > _lastCommandQueueFlushRequestId) {
if (rid > _lastCommandQueueFlushRequestId) {
_lastCommandQueueFlushRequestId = [requestId integerValue];
[self fetchCommandsFromJs];
}
Expand All @@ -81,10 +93,8 @@ - (void)fetchCommandsFromJs
NSString* queuedCommandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:
@"cordova.require('cordova/exec').nativeFetchMessages()"];

CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
[self enqueCommandBatch:queuedCommandsJSON];
if ([queuedCommandsJSON length] > 0) {
CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by request.");
}
}

- (void)executePending
Expand All @@ -102,19 +112,21 @@ - (void)executePending

// Iterate over and execute all of the commands.
for (NSArray* jsonEntry in commandBatch) {
CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);
@autoreleasepool {
CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);

if (![self execute:command]) {
if (![self execute:command]) {
#ifdef DEBUG
NSString* commandJson = [jsonEntry JSONString];
static NSUInteger maxLogLength = 1024;
NSString* commandString = ([commandJson length] > maxLogLength) ?
[NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
commandJson;
NSString* commandJson = [jsonEntry JSONString];
static NSUInteger maxLogLength = 1024;
NSString* commandString = ([commandJson length] > maxLogLength) ?
[NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
commandJson;

DLog(@"FAILED pluginJSON = %@", commandString);
DLog(@"FAILED pluginJSON = %@", commandString);
#endif
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions platforms/ios/CordovaLib/Classes/CDVConfigParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ - (id)init
self.pluginsDict = [[NSMutableDictionary alloc] initWithCapacity:30];
self.settings = [[NSMutableDictionary alloc] initWithCapacity:30];
self.whitelistHosts = [[NSMutableArray alloc] initWithCapacity:30];
[self.whitelistHosts addObject:@"file:///*"];
[self.whitelistHosts addObject:@"content:///*"];
[self.whitelistHosts addObject:@"data:///*"];
self.startupPluginNames = [[NSMutableArray alloc] initWithCapacity:8];
featureName = nil;
}
Expand Down
23 changes: 0 additions & 23 deletions platforms/ios/CordovaLib/Classes/CDVEcho.h

This file was deleted.

61 changes: 0 additions & 61 deletions platforms/ios/CordovaLib/Classes/CDVEcho.m

This file was deleted.

2 changes: 1 addition & 1 deletion platforms/ios/CordovaLib/Classes/CDVLocalStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ - (void)pluginInitialize
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResignActive)
name:UIApplicationWillResignActiveNotification object:nil];
BOOL cloudBackup = [@"cloud" isEqualToString : self.commandDelegate.settings[@"BackupWebStorage"]];
BOOL cloudBackup = [@"cloud" isEqualToString : self.commandDelegate.settings[[@"BackupWebStorage" lowercaseString]]];

self.backupInfo = [[self class] createBackupInfoWithCloudBackup:cloudBackup];
}
Expand Down
Loading

0 comments on commit eca19bf

Please sign in to comment.