cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lorinb...@apache.org
Subject webworks commit: [CB-3914] updated bb platform javascript
Date Thu, 20 Jun 2013 17:56:41 GMT
Updated Branches:
  refs/heads/2.9.x 041e44819 -> 132d48f1d


[CB-3914] updated bb platform javascript

updated version strings missed by coho with new dir structure


Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/132d48f1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/132d48f1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/132d48f1

Branch: refs/heads/2.9.x
Commit: 132d48f1dbbbb55c5ae2d06b538959408b6444fb
Parents: 041e448
Author: lorinbeer <lorin@adobe.com>
Authored: Thu Jun 20 10:43:15 2013 -0700
Committer: lorinbeer <lorin@adobe.com>
Committed: Thu Jun 20 10:56:30 2013 -0700

----------------------------------------------------------------------
 bbos/bin/templates/project/www/VERSION          |   2 +-
 bbos/javascript/cordova.blackberry.js           | 121 +++++++++++++++----
 blackberry10/bin/templates/project/www/VERSION  |   2 +-
 blackberry10/javascript/cordova.blackberry10.js |  95 +++++++++++----
 playbook/VERSION                                |   2 +-
 playbook/bin/templates/project/www/VERSION      |   2 +-
 playbook/javascript/cordova.blackberry.js       | 121 +++++++++++++++----
 7 files changed, 265 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/132d48f1/bbos/bin/templates/project/www/VERSION
----------------------------------------------------------------------
diff --git a/bbos/bin/templates/project/www/VERSION b/bbos/bin/templates/project/www/VERSION
index 834f262..3af205c 100644
--- a/bbos/bin/templates/project/www/VERSION
+++ b/bbos/bin/templates/project/www/VERSION
@@ -1 +1 @@
-2.8.0
+2.9.0rc1

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/132d48f1/bbos/javascript/cordova.blackberry.js
----------------------------------------------------------------------
diff --git a/bbos/javascript/cordova.blackberry.js b/bbos/javascript/cordova.blackberry.js
index c53b8af..b9c7758 100644
--- a/bbos/javascript/cordova.blackberry.js
+++ b/bbos/javascript/cordova.blackberry.js
@@ -1,5 +1,5 @@
 // Platform: blackberry
-// 2.8.0-0-g6208c95
+// 2.9.0rc1-0-g002f33d
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '2.8.0-0-g6208c95';
+var CORDOVA_JS_BUILD_LABEL = '2.9.0rc1-0-g002f33d';
 // file: lib/scripts/require.js
 
 var require,
@@ -2885,9 +2885,31 @@ FileWriter.prototype.abort = function() {
 /**
  * Writes data to the file
  *
- * @param text to be written
+ * @param data text or blob to be written
  */
-FileWriter.prototype.write = function(text) {
+FileWriter.prototype.write = function(data) {
+
+    var isBinary = false;
+
+    // If we don't have Blob or ArrayBuffer support, don't bother.
+    if (typeof window.Blob !== 'undefined' && typeof window.ArrayBuffer !== 'undefined')
{
+
+        // Check to see if the incoming data is a blob
+        if (data instanceof Blob) {
+            var that=this;
+            var fileReader = new FileReader();
+            fileReader.onload = function() {
+                // Call this method again, with the arraybuffer as argument
+                FileWriter.prototype.write.call(that, this.result);
+            };
+            fileReader.readAsArrayBuffer(data);
+            return;
+        }
+
+        // Mark data type for safer transport over the binary bridge
+        isBinary = (data instanceof ArrayBuffer);
+    }
+
     // Throw an exception if we are already writing a file
     if (this.readyState === FileWriter.WRITING) {
         throw new FileError(FileError.INVALID_STATE_ERR);
@@ -2953,7 +2975,7 @@ FileWriter.prototype.write = function(text) {
             if (typeof me.onwriteend === "function") {
                 me.onwriteend(new ProgressEvent("writeend", {"target":me}));
             }
-        }, "File", "write", [this.fileName, text, this.position]);
+        }, "File", "write", [this.fileName, data, this.position, isBinary]);
 };
 
 /**
@@ -3139,6 +3161,9 @@ InAppBrowser.prototype = {
     close: function (eventname) {
         exec(null, null, "InAppBrowser", "close", []);
     },
+    show: function (eventname) {
+      exec(null, null, "InAppBrowser", "show", []);
+    },
     addEventListener: function (eventname,f) {
         if (eventname in this.channels) {
             this.channels[eventname].subscribe(f);
@@ -9757,11 +9782,21 @@ document.addEventListener("DOMContentLoaded", function () {
         }
     }
 
+    function scriptErrorCallback(err) {
+        // Open Question: If a script path specified in cordova_plugins.js does not exist,
do we fail for all?
+        // this is currently just continuing.
+        scriptCounter--;
+        if (scriptCounter === 0) {
+            onScriptLoadingComplete && onScriptLoadingComplete();
+        }
+    }
+
     // Helper function to inject a <script> tag.
     function injectScript(path) {
         scriptCounter++;
         var script = document.createElement("script");
         script.onload = scriptLoadedCallback;
+        script.onerror = scriptErrorCallback;
         script.src = path;
         document.head.appendChild(script);
     }
@@ -9773,10 +9808,10 @@ document.addEventListener("DOMContentLoaded", function () {
         context.cordova.require('cordova/channel').onPluginsReady.fire();
     }
 
-    // Handler for the cordova_plugins.json content.
+    // Handler for the cordova_plugins.js content.
     // See plugman's plugin_loader.js for the details of this object.
     // This function is only called if the really is a plugins array that isn't empty.
-    // Otherwise the XHR response handler will just call finishPluginLoading().
+    // Otherwise the onerror response handler will just call finishPluginLoading().
     function handlePluginsObject(modules, path) {
         // First create the callback for when all plugins are loaded.
         var mapper = context.cordova.require('cordova/modulemapper');
@@ -9784,25 +9819,30 @@ document.addEventListener("DOMContentLoaded", function () {
             // Loop through all the plugins and then through their clobbers and merges.
             for (var i = 0; i < modules.length; i++) {
                 var module = modules[i];
-                if (!module) continue;
+                if (module) {
+                    try { 
+                        if (module.clobbers && module.clobbers.length) {
+                            for (var j = 0; j < module.clobbers.length; j++) {
+                                mapper.clobbers(module.id, module.clobbers[j]);
+                            }
+                        }
 
-                if (module.clobbers && module.clobbers.length) {
-                    for (var j = 0; j < module.clobbers.length; j++) {
-                        mapper.clobbers(module.id, module.clobbers[j]);
-                    }
-                }
+                        if (module.merges && module.merges.length) {
+                            for (var k = 0; k < module.merges.length; k++) {
+                                mapper.merges(module.id, module.merges[k]);
+                            }
+                        }
 
-                if (module.merges && module.merges.length) {
-                    for (var k = 0; k < module.merges.length; k++) {
-                        mapper.merges(module.id, module.merges[k]);
+                        // Finally, if runs is truthy we want to simply require() the module.
+                        // This can be skipped if it had any merges or clobbers, though,
+                        // since the mapper will already have required the module.
+                        if (module.runs && !(module.clobbers && module.clobbers.length)
&& !(module.merges && module.merges.length)) {
+                            context.cordova.require(module.id);
+                        }
+                    }
+                    catch(err) {
+                        // error with module, most likely clobbers, should we continue?
                     }
-                }
-
-                // Finally, if runs is truthy we want to simply require() the module.
-                // This can be skipped if it had any merges or clobbers, though,
-                // since the mapper will already have required the module.
-                if (module.runs && !(module.clobbers && module.clobbers.length)
&& !(module.merges && module.merges.length)) {
-                    context.cordova.require(module.id);
                 }
             }
 
@@ -9826,6 +9866,33 @@ document.addEventListener("DOMContentLoaded", function () {
             break;
         }
     }
+
+    var plugins_json = path + 'cordova_plugins.json';
+    var plugins_js = path + 'cordova_plugins.js';
+
+    // One some phones (Windows) this xhr.open throws an Access Denied exception
+    // So lets keep trying, but with a script tag injection technique instead of XHR
+    var injectPluginScript = function injectPluginScript() {
+        try {
+            var script = document.createElement("script");
+            script.onload = function(){
+                var list = cordova.require("cordova/plugin_list");
+                handlePluginsObject(list,path);
+            };
+            script.onerror = function() {
+                // Error loading cordova_plugins.js, file not found or something
+                // this is an acceptable error, pre-3.0.0, so we just move on.
+                finishPluginLoading();
+            };
+            script.src = plugins_js;
+            document.head.appendChild(script);
+
+        } catch(err){
+            finishPluginLoading();
+        }
+    } 
+
+
     // Try to XHR the cordova_plugins.json file asynchronously.
     var xhr = new XMLHttpRequest();
     xhr.onload = function() {
@@ -9844,14 +9911,16 @@ document.addEventListener("DOMContentLoaded", function () {
         }
     };
     xhr.onerror = function() {
-        finishPluginLoading();
+        // In this case, the json file was not present, but XHR was allowed, 
+        // so we should still try the script injection technique with the js file
+        // in case that is there.
+        injectPluginScript();
     };
-    var plugins_json = path + 'cordova_plugins.json';
     try { // we commented we were going to try, so let us actually try and catch
         xhr.open('GET', plugins_json, true); // Async
         xhr.send();
     } catch(err){
-        finishPluginLoading();
+        injectPluginScript();
     }
 }(window));
 

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/132d48f1/blackberry10/bin/templates/project/www/VERSION
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/www/VERSION b/blackberry10/bin/templates/project/www/VERSION
index 834f262..3af205c 100644
--- a/blackberry10/bin/templates/project/www/VERSION
+++ b/blackberry10/bin/templates/project/www/VERSION
@@ -1 +1 @@
-2.8.0
+2.9.0rc1

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/132d48f1/blackberry10/javascript/cordova.blackberry10.js
----------------------------------------------------------------------
diff --git a/blackberry10/javascript/cordova.blackberry10.js b/blackberry10/javascript/cordova.blackberry10.js
index d3020aa..ff116e4 100644
--- a/blackberry10/javascript/cordova.blackberry10.js
+++ b/blackberry10/javascript/cordova.blackberry10.js
@@ -1,5 +1,5 @@
 // Platform: blackberry10
-// 2.8.0-0-g6208c95
+// 2.9.0rc1-0-g002f33d
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '2.8.0-0-g6208c95';
+var CORDOVA_JS_BUILD_LABEL = '2.9.0rc1-0-g002f33d';
 // file: lib/scripts/require.js
 
 var require,
@@ -2420,6 +2420,9 @@ InAppBrowser.prototype = {
     close: function (eventname) {
         exec(null, null, "InAppBrowser", "close", []);
     },
+    show: function (eventname) {
+      exec(null, null, "InAppBrowser", "show", []);
+    },
     addEventListener: function (eventname,f) {
         if (eventname in this.channels) {
             this.channels[eventname].subscribe(f);
@@ -6791,11 +6794,21 @@ document.addEventListener("DOMContentLoaded", function () {
         }
     }
 
+    function scriptErrorCallback(err) {
+        // Open Question: If a script path specified in cordova_plugins.js does not exist,
do we fail for all?
+        // this is currently just continuing.
+        scriptCounter--;
+        if (scriptCounter === 0) {
+            onScriptLoadingComplete && onScriptLoadingComplete();
+        }
+    }
+
     // Helper function to inject a <script> tag.
     function injectScript(path) {
         scriptCounter++;
         var script = document.createElement("script");
         script.onload = scriptLoadedCallback;
+        script.onerror = scriptErrorCallback;
         script.src = path;
         document.head.appendChild(script);
     }
@@ -6807,10 +6820,10 @@ document.addEventListener("DOMContentLoaded", function () {
         context.cordova.require('cordova/channel').onPluginsReady.fire();
     }
 
-    // Handler for the cordova_plugins.json content.
+    // Handler for the cordova_plugins.js content.
     // See plugman's plugin_loader.js for the details of this object.
     // This function is only called if the really is a plugins array that isn't empty.
-    // Otherwise the XHR response handler will just call finishPluginLoading().
+    // Otherwise the onerror response handler will just call finishPluginLoading().
     function handlePluginsObject(modules, path) {
         // First create the callback for when all plugins are loaded.
         var mapper = context.cordova.require('cordova/modulemapper');
@@ -6818,25 +6831,30 @@ document.addEventListener("DOMContentLoaded", function () {
             // Loop through all the plugins and then through their clobbers and merges.
             for (var i = 0; i < modules.length; i++) {
                 var module = modules[i];
-                if (!module) continue;
+                if (module) {
+                    try { 
+                        if (module.clobbers && module.clobbers.length) {
+                            for (var j = 0; j < module.clobbers.length; j++) {
+                                mapper.clobbers(module.id, module.clobbers[j]);
+                            }
+                        }
 
-                if (module.clobbers && module.clobbers.length) {
-                    for (var j = 0; j < module.clobbers.length; j++) {
-                        mapper.clobbers(module.id, module.clobbers[j]);
-                    }
-                }
+                        if (module.merges && module.merges.length) {
+                            for (var k = 0; k < module.merges.length; k++) {
+                                mapper.merges(module.id, module.merges[k]);
+                            }
+                        }
 
-                if (module.merges && module.merges.length) {
-                    for (var k = 0; k < module.merges.length; k++) {
-                        mapper.merges(module.id, module.merges[k]);
+                        // Finally, if runs is truthy we want to simply require() the module.
+                        // This can be skipped if it had any merges or clobbers, though,
+                        // since the mapper will already have required the module.
+                        if (module.runs && !(module.clobbers && module.clobbers.length)
&& !(module.merges && module.merges.length)) {
+                            context.cordova.require(module.id);
+                        }
+                    }
+                    catch(err) {
+                        // error with module, most likely clobbers, should we continue?
                     }
-                }
-
-                // Finally, if runs is truthy we want to simply require() the module.
-                // This can be skipped if it had any merges or clobbers, though,
-                // since the mapper will already have required the module.
-                if (module.runs && !(module.clobbers && module.clobbers.length)
&& !(module.merges && module.merges.length)) {
-                    context.cordova.require(module.id);
                 }
             }
 
@@ -6860,6 +6878,33 @@ document.addEventListener("DOMContentLoaded", function () {
             break;
         }
     }
+
+    var plugins_json = path + 'cordova_plugins.json';
+    var plugins_js = path + 'cordova_plugins.js';
+
+    // One some phones (Windows) this xhr.open throws an Access Denied exception
+    // So lets keep trying, but with a script tag injection technique instead of XHR
+    var injectPluginScript = function injectPluginScript() {
+        try {
+            var script = document.createElement("script");
+            script.onload = function(){
+                var list = cordova.require("cordova/plugin_list");
+                handlePluginsObject(list,path);
+            };
+            script.onerror = function() {
+                // Error loading cordova_plugins.js, file not found or something
+                // this is an acceptable error, pre-3.0.0, so we just move on.
+                finishPluginLoading();
+            };
+            script.src = plugins_js;
+            document.head.appendChild(script);
+
+        } catch(err){
+            finishPluginLoading();
+        }
+    } 
+
+
     // Try to XHR the cordova_plugins.json file asynchronously.
     var xhr = new XMLHttpRequest();
     xhr.onload = function() {
@@ -6878,16 +6923,18 @@ document.addEventListener("DOMContentLoaded", function () {
         }
     };
     xhr.onerror = function() {
-        finishPluginLoading();
+        // In this case, the json file was not present, but XHR was allowed, 
+        // so we should still try the script injection technique with the js file
+        // in case that is there.
+        injectPluginScript();
     };
-    var plugins_json = path + 'cordova_plugins.json';
     try { // we commented we were going to try, so let us actually try and catch
         xhr.open('GET', plugins_json, true); // Async
         xhr.send();
     } catch(err){
-        finishPluginLoading();
+        injectPluginScript();
     }
 }(window));
 
 
-})();
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/132d48f1/playbook/VERSION
----------------------------------------------------------------------
diff --git a/playbook/VERSION b/playbook/VERSION
index 834f262..3af205c 100644
--- a/playbook/VERSION
+++ b/playbook/VERSION
@@ -1 +1 @@
-2.8.0
+2.9.0rc1

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/132d48f1/playbook/bin/templates/project/www/VERSION
----------------------------------------------------------------------
diff --git a/playbook/bin/templates/project/www/VERSION b/playbook/bin/templates/project/www/VERSION
index 834f262..3af205c 100644
--- a/playbook/bin/templates/project/www/VERSION
+++ b/playbook/bin/templates/project/www/VERSION
@@ -1 +1 @@
-2.8.0
+2.9.0rc1

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/132d48f1/playbook/javascript/cordova.blackberry.js
----------------------------------------------------------------------
diff --git a/playbook/javascript/cordova.blackberry.js b/playbook/javascript/cordova.blackberry.js
index c53b8af..b9c7758 100644
--- a/playbook/javascript/cordova.blackberry.js
+++ b/playbook/javascript/cordova.blackberry.js
@@ -1,5 +1,5 @@
 // Platform: blackberry
-// 2.8.0-0-g6208c95
+// 2.9.0rc1-0-g002f33d
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '2.8.0-0-g6208c95';
+var CORDOVA_JS_BUILD_LABEL = '2.9.0rc1-0-g002f33d';
 // file: lib/scripts/require.js
 
 var require,
@@ -2885,9 +2885,31 @@ FileWriter.prototype.abort = function() {
 /**
  * Writes data to the file
  *
- * @param text to be written
+ * @param data text or blob to be written
  */
-FileWriter.prototype.write = function(text) {
+FileWriter.prototype.write = function(data) {
+
+    var isBinary = false;
+
+    // If we don't have Blob or ArrayBuffer support, don't bother.
+    if (typeof window.Blob !== 'undefined' && typeof window.ArrayBuffer !== 'undefined')
{
+
+        // Check to see if the incoming data is a blob
+        if (data instanceof Blob) {
+            var that=this;
+            var fileReader = new FileReader();
+            fileReader.onload = function() {
+                // Call this method again, with the arraybuffer as argument
+                FileWriter.prototype.write.call(that, this.result);
+            };
+            fileReader.readAsArrayBuffer(data);
+            return;
+        }
+
+        // Mark data type for safer transport over the binary bridge
+        isBinary = (data instanceof ArrayBuffer);
+    }
+
     // Throw an exception if we are already writing a file
     if (this.readyState === FileWriter.WRITING) {
         throw new FileError(FileError.INVALID_STATE_ERR);
@@ -2953,7 +2975,7 @@ FileWriter.prototype.write = function(text) {
             if (typeof me.onwriteend === "function") {
                 me.onwriteend(new ProgressEvent("writeend", {"target":me}));
             }
-        }, "File", "write", [this.fileName, text, this.position]);
+        }, "File", "write", [this.fileName, data, this.position, isBinary]);
 };
 
 /**
@@ -3139,6 +3161,9 @@ InAppBrowser.prototype = {
     close: function (eventname) {
         exec(null, null, "InAppBrowser", "close", []);
     },
+    show: function (eventname) {
+      exec(null, null, "InAppBrowser", "show", []);
+    },
     addEventListener: function (eventname,f) {
         if (eventname in this.channels) {
             this.channels[eventname].subscribe(f);
@@ -9757,11 +9782,21 @@ document.addEventListener("DOMContentLoaded", function () {
         }
     }
 
+    function scriptErrorCallback(err) {
+        // Open Question: If a script path specified in cordova_plugins.js does not exist,
do we fail for all?
+        // this is currently just continuing.
+        scriptCounter--;
+        if (scriptCounter === 0) {
+            onScriptLoadingComplete && onScriptLoadingComplete();
+        }
+    }
+
     // Helper function to inject a <script> tag.
     function injectScript(path) {
         scriptCounter++;
         var script = document.createElement("script");
         script.onload = scriptLoadedCallback;
+        script.onerror = scriptErrorCallback;
         script.src = path;
         document.head.appendChild(script);
     }
@@ -9773,10 +9808,10 @@ document.addEventListener("DOMContentLoaded", function () {
         context.cordova.require('cordova/channel').onPluginsReady.fire();
     }
 
-    // Handler for the cordova_plugins.json content.
+    // Handler for the cordova_plugins.js content.
     // See plugman's plugin_loader.js for the details of this object.
     // This function is only called if the really is a plugins array that isn't empty.
-    // Otherwise the XHR response handler will just call finishPluginLoading().
+    // Otherwise the onerror response handler will just call finishPluginLoading().
     function handlePluginsObject(modules, path) {
         // First create the callback for when all plugins are loaded.
         var mapper = context.cordova.require('cordova/modulemapper');
@@ -9784,25 +9819,30 @@ document.addEventListener("DOMContentLoaded", function () {
             // Loop through all the plugins and then through their clobbers and merges.
             for (var i = 0; i < modules.length; i++) {
                 var module = modules[i];
-                if (!module) continue;
+                if (module) {
+                    try { 
+                        if (module.clobbers && module.clobbers.length) {
+                            for (var j = 0; j < module.clobbers.length; j++) {
+                                mapper.clobbers(module.id, module.clobbers[j]);
+                            }
+                        }
 
-                if (module.clobbers && module.clobbers.length) {
-                    for (var j = 0; j < module.clobbers.length; j++) {
-                        mapper.clobbers(module.id, module.clobbers[j]);
-                    }
-                }
+                        if (module.merges && module.merges.length) {
+                            for (var k = 0; k < module.merges.length; k++) {
+                                mapper.merges(module.id, module.merges[k]);
+                            }
+                        }
 
-                if (module.merges && module.merges.length) {
-                    for (var k = 0; k < module.merges.length; k++) {
-                        mapper.merges(module.id, module.merges[k]);
+                        // Finally, if runs is truthy we want to simply require() the module.
+                        // This can be skipped if it had any merges or clobbers, though,
+                        // since the mapper will already have required the module.
+                        if (module.runs && !(module.clobbers && module.clobbers.length)
&& !(module.merges && module.merges.length)) {
+                            context.cordova.require(module.id);
+                        }
+                    }
+                    catch(err) {
+                        // error with module, most likely clobbers, should we continue?
                     }
-                }
-
-                // Finally, if runs is truthy we want to simply require() the module.
-                // This can be skipped if it had any merges or clobbers, though,
-                // since the mapper will already have required the module.
-                if (module.runs && !(module.clobbers && module.clobbers.length)
&& !(module.merges && module.merges.length)) {
-                    context.cordova.require(module.id);
                 }
             }
 
@@ -9826,6 +9866,33 @@ document.addEventListener("DOMContentLoaded", function () {
             break;
         }
     }
+
+    var plugins_json = path + 'cordova_plugins.json';
+    var plugins_js = path + 'cordova_plugins.js';
+
+    // One some phones (Windows) this xhr.open throws an Access Denied exception
+    // So lets keep trying, but with a script tag injection technique instead of XHR
+    var injectPluginScript = function injectPluginScript() {
+        try {
+            var script = document.createElement("script");
+            script.onload = function(){
+                var list = cordova.require("cordova/plugin_list");
+                handlePluginsObject(list,path);
+            };
+            script.onerror = function() {
+                // Error loading cordova_plugins.js, file not found or something
+                // this is an acceptable error, pre-3.0.0, so we just move on.
+                finishPluginLoading();
+            };
+            script.src = plugins_js;
+            document.head.appendChild(script);
+
+        } catch(err){
+            finishPluginLoading();
+        }
+    } 
+
+
     // Try to XHR the cordova_plugins.json file asynchronously.
     var xhr = new XMLHttpRequest();
     xhr.onload = function() {
@@ -9844,14 +9911,16 @@ document.addEventListener("DOMContentLoaded", function () {
         }
     };
     xhr.onerror = function() {
-        finishPluginLoading();
+        // In this case, the json file was not present, but XHR was allowed, 
+        // so we should still try the script injection technique with the js file
+        // in case that is there.
+        injectPluginScript();
     };
-    var plugins_json = path + 'cordova_plugins.json';
     try { // we commented we were going to try, so let us actually try and catch
         xhr.open('GET', plugins_json, true); // Async
         xhr.send();
     } catch(err){
-        finishPluginLoading();
+        injectPluginScript();
     }
 }(window));
 


Mime
View raw message