cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hermw...@apache.org
Subject [1/2] updated to latest 2.6.0rc1 tagged cordova-js libs
Date Thu, 28 Mar 2013 22:00:19 GMT
Updated Branches:
  refs/heads/master 98b31916d -> 5d439c4ae


http://git-wip-us.apache.org/repos/asf/cordova-webos/blob/5d439c4a/lib/cordova.webos.js
----------------------------------------------------------------------
diff --git a/lib/cordova.webos.js b/lib/cordova.webos.js
index 614b1fa..3251823 100644
--- a/lib/cordova.webos.js
+++ b/lib/cordova.webos.js
@@ -1,8 +1,8 @@
 // Platform: webos
 
-// commit bbf1562d4934b1331ffb263424b6ae054cedeb71
+// commit 4bbb9b5e9f232cc5f090e5065a0d92086b78628d
 
-// File generated at :: Thu Mar 21 2013 14:40:07 GMT-0700 (PDT)
+// File generated at :: Wed Mar 27 2013 15:35:48 GMT-0700 (PDT)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -924,6 +924,8 @@ exports.reset();
 // file: lib/webos/platform.js
 define("cordova/platform", function(require, exports, module) {
 
+/*global Mojo:false */
+
 var service=require('cordova/plugin/webos/service'),
     cordova = require('cordova');
 
@@ -933,13 +935,6 @@ module.exports = {
         var modulemapper = require('cordova/modulemapper');
 
         modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
-
-        modulemapper.merges('cordova/plugin/webos/service', 'navigator.service');
-        modulemapper.merges('cordova/plugin/webos/application', 'navigator.application');
-        modulemapper.merges('cordova/plugin/webos/window', 'navigator.window');
-        modulemapper.merges('cordova/plugin/webos/orientation', 'navigator.orientation');
-        modulemapper.merges('cordova/plugin/webos/keyboard', 'navigator.keyboard');
-
         modulemapper.mapModules(window);
 
         if (window.PalmSystem) {
@@ -1011,6 +1006,27 @@ module.exports = {
             });
 
         });
+    },
+    merges: {
+        navigator: {
+            children: {
+                service: {
+                    path: "cordova/plugin/webos/service"
+                },
+                application: {
+                    path: "cordova/plugin/webos/application"
+                },
+                window: {
+                    path: "cordova/plugin/webos/window"
+                },
+                orientation: {
+                    path: "cordova/plugin/webos/orientation"
+                },
+                keyboard: {
+                    path: "cordova/plugin/webos/keyboard"
+                }
+            }
+        }
     }
 };
 
@@ -2619,7 +2635,7 @@ function getBasicAuthHeader(urlString) {
         var origin = protocol + url.host;
 
         // check whether there are the username:password credentials in the url
-        if (url.href.indexOf(origin) != 0) { // credentials found
+        if (url.href.indexOf(origin) !== 0) { // credentials found
             var atIndex = url.href.indexOf("@");
             credentials = url.href.substring(protocol.length, atIndex);
         }
@@ -2668,15 +2684,11 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback,
erro
     var params = null;
     var chunkedMode = true;
     var headers = null;
-
+    var httpMethod = null;
     var basicAuthHeader = getBasicAuthHeader(server);
     if (basicAuthHeader) {
-        if (!options) {
-            options = new FileUploadOptions();
-        }
-        if (!options.headers) {
-            options.headers = {};
-        }
+        options = options || {};
+        options.headers = options.headers || {};
         options.headers[basicAuthHeader.name] = basicAuthHeader.value;
     }
 
@@ -2685,6 +2697,12 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback,
erro
         fileName = options.fileName;
         mimeType = options.mimeType;
         headers = options.headers;
+        httpMethod = options.httpMethod || "POST";
+        if (httpMethod.toUpperCase() == "PUT"){
+            httpMethod = "PUT";
+        } else {
+            httpMethod = "POST";
+        }
         if (options.chunkedMode !== null || typeof options.chunkedMode != "undefined") {
             chunkedMode = options.chunkedMode;
         }
@@ -2711,7 +2729,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback,
erro
             successCallback && successCallback(result);
         }
     };
-    exec(win, fail, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType,
params, trustAllHosts, chunkedMode, headers, this._id]);
+    exec(win, fail, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType,
params, trustAllHosts, chunkedMode, headers, this._id, httpMethod]);
 };
 
 /**
@@ -2729,12 +2747,8 @@ FileTransfer.prototype.download = function(source, target, successCallback,
erro
 
     var basicAuthHeader = getBasicAuthHeader(source);
     if (basicAuthHeader) {
-        if (!options) {
-            options = {};
-        }
-        if (!options.headers) {
-            options.headers = {};
-        }
+        options = options || {};
+        options.headers = options.headers || {};
         options.headers[basicAuthHeader.name] = basicAuthHeader.value;
     }
 
@@ -2773,12 +2787,11 @@ FileTransfer.prototype.download = function(source, target, successCallback,
erro
 };
 
 /**
- * Aborts the ongoing file transfer on this object
- * @param successCallback {Function}  Callback to be invoked upon success
- * @param errorCallback {Function}    Callback to be invoked upon error
+ * Aborts the ongoing file transfer on this object. The original error
+ * callback for the file transfer will be called if necessary.
  */
-FileTransfer.prototype.abort = function(successCallback, errorCallback) {
-    exec(successCallback, errorCallback, 'FileTransfer', 'abort', [this._id]);
+FileTransfer.prototype.abort = function() {
+    exec(null, null, 'FileTransfer', 'abort', [this._id]);
 };
 
 module.exports = FileTransfer;
@@ -2822,12 +2835,13 @@ define("cordova/plugin/FileUploadOptions", function(require, exports,
module) {
  * @param headers {Object}   Keys are header names, values are header values. Multiple
  *                           headers of the same name are not supported.
  */
-var FileUploadOptions = function(fileKey, fileName, mimeType, params, headers) {
+var FileUploadOptions = function(fileKey, fileName, mimeType, params, headers, httpMethod)
{
     this.fileKey = fileKey || null;
     this.fileName = fileName || null;
     this.mimeType = mimeType || null;
     this.params = params || null;
     this.headers = headers || null;
+    this.httpMethod = httpMethod || null;
 };
 
 module.exports = FileUploadOptions;
@@ -3190,6 +3204,34 @@ InAppBrowser.prototype = {
         if (eventname in this.channels) {
             this.channels[eventname].unsubscribe(f);
         }
+    },
+    executeScript: function(injectDetails, cb) {
+        var script,
+            sourceString;
+        if (injectDetails.code) {
+            exec(cb, null, "InAppBrowser", "injectScriptCode", [injectDetails.code]);
+        } else if (injectDetails.file) {
+            sourceString = JSON.stringify(injectDetails.file);
+            script = "(function(d) { var c = d.createElement('script'); c.src = " + sourceString
+ "; d.body.appendChild(c); })(document)";
+            exec(cb, null, "InAppBrowser", "injectScriptCode", [script]);
+        } else {
+            throw new Error('executeScript requires exactly one of code or file to be specified');
+        }
+    },
+    insertCSS: function(injectDetails, cb) {
+        var script,
+            sourceString;
+        if (injectDetails.code) {
+            sourceString = JSON.stringify(injectDetails.code);
+            script = "(function(d) { var c = d.createElement('style'); c.innerHTML = " +
sourceString + "; d.body.appendChild(c); })(document)";
+            exec(cb, null, "InAppBrowser", "injectScriptCode", [script]);
+        } else if (injectDetails.file) {
+            sourceString = JSON.stringify(injectDetails.file);
+            script = "(function(d) { var c = d.createElement('link'); c.rel='stylesheet',
c.type='text/css'; c.href = " + sourceString + "; d.body.appendChild(c); })(document)";
+            exec(cb, null, "InAppBrowser", "injectScriptCode", [script]);
+        } else {
+            throw new Error('insertCSS requires exactly one of code or file to be specified');
+        }
     }
 };
 
@@ -6791,28 +6833,29 @@ require('cordova/channel').onNativeReady.fire();
         }
     }
 
-    // Try to XHR the cordova_plugins.json file asynchronously.
-    var xhr = new context.XMLHttpRequest();
-    xhr.onreadystatechange = function() {
-        if (this.readyState != 4) { // not DONE
-            return;
-        }
 
-        // If the response is a JSON string which composes an array, call handlePluginsObject.
-        // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
-        if (this.status == 200) {
+    // Try to XHR the cordova_plugins.json file asynchronously.
+    try { // we commented we were going to try, so let us actually try and catch 
+        var xhr = new context.XMLHttpRequest();
+        xhr.onload = function() {
+            // If the response is a JSON string which composes an array, call handlePluginsObject.
+            // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
             var obj = JSON.parse(this.responseText);
             if (obj && obj instanceof Array && obj.length > 0) {
                 handlePluginsObject(obj);
             } else {
                 finishPluginLoading();
             }
-        } else {
+        };
+        xhr.onerror = function() {
             finishPluginLoading();
-        }
-    };
-    xhr.open('GET', 'cordova_plugins.json', true); // Async
-    xhr.send();
+        };
+        xhr.open('GET', 'cordova_plugins.json', true); // Async
+        xhr.send();
+    }
+    catch(err){
+        finishPluginLoading();
+    }
 }(window));
 
 


Mime
View raw message