You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/06/17 04:49:41 UTC

[2/2] git commit: Replacing CacheClear with inline cache clear (simpler called on slave webview)

Replacing CacheClear with inline cache clear (simpler called on slave webview)


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

Branch: refs/heads/master
Commit: e1994aa578984f0fcced4bb4bef8ee7992aa426a
Parents: 5c82024
Author: Michal Mocny <mm...@gmail.com>
Authored: Mon Jun 16 14:24:26 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Jun 16 22:48:07 2014 -0400

----------------------------------------------------------------------
 AppHarnessUI/AppHarnessUI.java         |  2 ++
 CacheClear/README.md                   |  5 ---
 CacheClear/cacheclear.js               | 24 -------------
 CacheClear/plugin.xml                  | 52 -----------------------------
 CacheClear/src/android/CacheClear.java | 41 -----------------------
 CacheClear/src/ios/CacheClear.m        | 34 -------------------
 createproject.sh                       |  1 -
 www/cdvah/harnessmenu.html             |  1 -
 www/cdvah/js/CacheClear.js             | 32 ------------------
 www/cdvah/js/Installer.js              |  5 ++-
 10 files changed, 4 insertions(+), 193 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e1994aa5/AppHarnessUI/AppHarnessUI.java
----------------------------------------------------------------------
diff --git a/AppHarnessUI/AppHarnessUI.java b/AppHarnessUI/AppHarnessUI.java
index 624a159..b3cfc16 100644
--- a/AppHarnessUI/AppHarnessUI.java
+++ b/AppHarnessUI/AppHarnessUI.java
@@ -121,6 +121,8 @@ public class AppHarnessUI extends CordovaPlugin {
             if (activity.getBooleanProperty("DisallowOverscroll", false)) {
                 slaveWebView.setOverScrollMode(CordovaWebView.OVER_SCROLL_NEVER);
             }
+            slaveWebView.clearCache(true);
+            slaveWebView.clearHistory();
             slaveWebView.loadUrl(url);
             View newView = (View)slaveWebView.getParent();
             contentView.addView(newView);

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e1994aa5/CacheClear/README.md
----------------------------------------------------------------------
diff --git a/CacheClear/README.md b/CacheClear/README.md
deleted file mode 100644
index 8c1d0a1..0000000
--- a/CacheClear/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-CacheClear
-===========
-
-Adds an API for clearing the browser cache.
-

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e1994aa5/CacheClear/cacheclear.js
----------------------------------------------------------------------
diff --git a/CacheClear/cacheclear.js b/CacheClear/cacheclear.js
deleted file mode 100644
index 10461e1..0000000
--- a/CacheClear/cacheclear.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-var exec = cordova.require('cordova/exec');
-
-exports.clear = function(win, fail) {
-    exec(win, fail, 'CacheClear', 'clear', []);
-};

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e1994aa5/CacheClear/plugin.xml
----------------------------------------------------------------------
diff --git a/CacheClear/plugin.xml b/CacheClear/plugin.xml
deleted file mode 100644
index 30d36b7..0000000
--- a/CacheClear/plugin.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<plugin xmlns="http://phonegap.com/ns/plugins/1.0"
-    id="org.apache.cordova.CacheClear"
-    version="0.0.1">
-  <engines>
-    <engine name="cordova" version=">=3.0.0" />
-  </engines>
-
-  <name>CacheClear</name>
-
-  <js-module src="cacheclear.js" name="CacheClear">
-    <clobbers target="cordova.plugins.cacheclear" />
-  </js-module>
-
-  <platform name="android">
-    <source-file src="src/android/CacheClear.java" target-dir="src/org/apache/cordova/cacheclear" />
-
-    <config-file target="res/xml/config.xml" parent="/*">
-      <feature name="CacheClear">
-        <param name="android-package" value="org.apache.cordova.cacheclear.CacheClear"/>
-      </feature>
-    </config-file>
-  </platform>
-
-  <platform name="ios">
-    <source-file src="src/ios/CacheClear.m" />
-
-    <config-file target="config.xml" parent="/*">
-      <feature name="CacheClear">
-        <param name="ios-package" value="CacheClear"/>
-      </feature>
-    </config-file>
-  </platform>
-</plugin>

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e1994aa5/CacheClear/src/android/CacheClear.java
----------------------------------------------------------------------
diff --git a/CacheClear/src/android/CacheClear.java b/CacheClear/src/android/CacheClear.java
deleted file mode 100644
index 7185095..0000000
--- a/CacheClear/src/android/CacheClear.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you under the Apache License, Version 2.0 (the
-       "License"); you may not use this file except in compliance
-       with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing,
-       software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-       KIND, either express or implied.  See the License for the
-       specific language governing permissions and limitations
-       under the License.
-*/
-package org.apache.cordova.cacheclear;
-
-import org.apache.cordova.CallbackContext;
-import org.apache.cordova.CordovaArgs;
-import org.apache.cordova.CordovaPlugin;
-import org.json.JSONException;
-
-public class CacheClear extends CordovaPlugin {
-    @Override
-    public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
-        if ("clear".equals(action)) {
-            this.cordova.getActivity().runOnUiThread(new Runnable() {
-                public void run() {
-                    webView.clearCache(true);
-                    callbackContext.success();
-                }
-            });
-        } else {
-            return false;
-        }
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e1994aa5/CacheClear/src/ios/CacheClear.m
----------------------------------------------------------------------
diff --git a/CacheClear/src/ios/CacheClear.m b/CacheClear/src/ios/CacheClear.m
deleted file mode 100644
index 83d8671..0000000
--- a/CacheClear/src/ios/CacheClear.m
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-#import <UIKit/UIKit.h>
-#import <Cordova/CDVPlugin.h>
-
-@interface CacheClear : CDVPlugin
-@end
-
-@implementation CacheClear
-
-- (void)clear:(CDVInvokedUrlCommand*)command {
-    [[NSURLCache sharedURLCache] removeAllCachedResponses];
-    CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
-    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
-}
-
-@end
-

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e1994aa5/createproject.sh
----------------------------------------------------------------------
diff --git a/createproject.sh b/createproject.sh
index 588880b..27f47ee 100755
--- a/createproject.sh
+++ b/createproject.sh
@@ -94,7 +94,6 @@ echo Installing plugins.
 # org.apache.cordova.device isn't used directly, but is convenient to test mobilespec.
 "$CORDOVA" plugin add\
     "$AH_PATH/UrlRemap" \
-    "$AH_PATH/CacheClear" \
     "$AH_PATH/AppHarnessUI" \
     org.apache.cordova.file \
     org.apache.cordova.file-transfer \

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e1994aa5/www/cdvah/harnessmenu.html
----------------------------------------------------------------------
diff --git a/www/cdvah/harnessmenu.html b/www/cdvah/harnessmenu.html
index eb407c3..d449a38 100644
--- a/www/cdvah/harnessmenu.html
+++ b/www/cdvah/harnessmenu.html
@@ -26,7 +26,6 @@
         <script type="text/javascript" src="js/libs/moment.min.js"></script>
         <script type="text/javascript" src="js/libs/angular-moment.js"></script>
         <script type="text/javascript" src="js/app.js"></script>
-        <script type="text/javascript" src="js/CacheClear.js"></script>
         <script type="text/javascript" src="js/AppHarnessUI.js"></script>
         <script type="text/javascript" src="js/Installer.js"></script>
         <script type="text/javascript" src="js/CordovaInstaller.js"></script>

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e1994aa5/www/cdvah/js/CacheClear.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/CacheClear.js b/www/cdvah/js/CacheClear.js
deleted file mode 100644
index c07bca9..0000000
--- a/www/cdvah/js/CacheClear.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
-*/
-(function() {
-    'use strict';
-    /* global myApp */
-    myApp.factory('CacheClear', ['$q', function($q) {
-        function clear() {
-            var deferred = $q.defer();
-            cordova.plugins.cacheclear.clear(deferred.resolve, deferred.reject);
-            return deferred.promise;
-        }
-        return {
-            clear: clear
-        };
-    }]);
-})();

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e1994aa5/www/cdvah/js/Installer.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/Installer.js b/www/cdvah/js/Installer.js
index d339d33..3084bbb 100644
--- a/www/cdvah/js/Installer.js
+++ b/www/cdvah/js/Installer.js
@@ -20,7 +20,7 @@
     'use strict';
 
     /* global myApp, cordova */
-    myApp.factory('Installer', ['$q', 'UrlRemap', 'ResourcesLoader', 'PluginMetadata', 'CacheClear', 'DirectoryManager', function($q, UrlRemap, ResourcesLoader, PluginMetadata, CacheClear, DirectoryManager) {
+    myApp.factory('Installer', ['$q', 'UrlRemap', 'ResourcesLoader', 'PluginMetadata', 'DirectoryManager', function($q, UrlRemap, ResourcesLoader, PluginMetadata, DirectoryManager) {
         var platformId = cordova.require('cordova/platform').id;
 
         function Installer() {}
@@ -115,8 +115,7 @@
         };
 
         Installer.prototype._prepareForLaunch = function() {
-            // Cache clearing necessary only for Android.
-            return CacheClear.clear();
+            return $q.when();
         };
 
         Installer.prototype.launch = function() {