You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/08/25 05:57:26 UTC
[cordova-browser] 04/06: Update JS snapshot to version 5.1.0-dev
(via coho)
This is an automated email from the ASF dual-hosted git repository.
steven pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-browser.git
commit 08f18a99c52d1474f247cde57fb192b482f7b448
Author: Steve Gill <st...@gmail.com>
AuthorDate: Thu Aug 24 16:17:49 2017 -0700
Update JS snapshot to version 5.1.0-dev (via coho)
---
cordova-lib/cordova.js | 133 +++++++++++++++++++++++++------------------------
1 file changed, 68 insertions(+), 65 deletions(-)
diff --git a/cordova-lib/cordova.js b/cordova-lib/cordova.js
index 07c91f6..5e22bea 100644
--- a/cordova-lib/cordova.js
+++ b/cordova-lib/cordova.js
@@ -1,5 +1,5 @@
// Platform: browser
-// c517ca811b4948b630e0b74dbae6c9637939da24
+// 5a1bffcf410d1696d5701b3eaa9bca9b0859480d
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -8,9 +8,9 @@
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
@@ -19,9 +19,12 @@
under the License.
*/
;(function() {
-var PLATFORM_VERSION_BUILD_LABEL = '4.2.0-dev';
+var PLATFORM_VERSION_BUILD_LABEL = '5.1.0-dev';
// file: src/scripts/require.js
+/*jshint -W079 */
+/*jshint -W020 */
+
var require,
define;
@@ -31,7 +34,7 @@ var require,
requireStack = [],
// Map of module ID -> index into requireStack of modules currently being built.
inProgressModules = {},
- SEPARATOR = ".";
+ SEPARATOR = "/";
@@ -694,8 +697,13 @@ var Channel = function(type, sticky) {
}
};
-function forceFunction(f) {
- if (typeof f != 'function') throw "Function required as first argument!";
+function checkSubscriptionArgument(argument) {
+ if (typeof argument !== "function" && typeof argument.handleEvent !== "function") {
+ throw new Error(
+ "Must provide a function or an EventListener object " +
+ "implementing the handleEvent interface."
+ );
+ }
}
/**
@@ -705,28 +713,39 @@ function forceFunction(f) {
* and a guid that can be used to stop subscribing to the channel.
* Returns the guid.
*/
-Channel.prototype.subscribe = function(f, c) {
- // need a function to call
- forceFunction(f);
+Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) {
+ checkSubscriptionArgument(eventListenerOrFunction);
+ var handleEvent, guid;
+
+ if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") {
+ // Received an EventListener object implementing the handleEvent interface
+ handleEvent = eventListenerOrFunction.handleEvent;
+ eventListener = eventListenerOrFunction;
+ } else {
+ // Received a function to handle event
+ handleEvent = eventListenerOrFunction;
+ }
+
if (this.state == 2) {
- f.apply(c || this, this.fireArgs);
+ handleEvent.apply(eventListener || this, this.fireArgs);
return;
}
- var func = f,
- guid = f.observer_guid;
- if (typeof c == "object") { func = utils.close(c, f); }
+ guid = eventListenerOrFunction.observer_guid;
+ if (typeof eventListener === "object") {
+ handleEvent = utils.close(eventListener, handleEvent);
+ }
if (!guid) {
- // first time any channel has seen this subscriber
+ // First time any channel has seen this subscriber
guid = '' + nextGuid++;
}
- func.observer_guid = guid;
- f.observer_guid = guid;
+ handleEvent.observer_guid = guid;
+ eventListenerOrFunction.observer_guid = guid;
// Don't add the same handler more than once.
if (!this.handlers[guid]) {
- this.handlers[guid] = func;
+ this.handlers[guid] = handleEvent;
this.numHandlers++;
if (this.numHandlers == 1) {
this.onHasSubscribersChange && this.onHasSubscribersChange();
@@ -737,12 +756,20 @@ Channel.prototype.subscribe = function(f, c) {
/**
* Unsubscribes the function with the given guid from the channel.
*/
-Channel.prototype.unsubscribe = function(f) {
- // need a function to unsubscribe
- forceFunction(f);
+Channel.prototype.unsubscribe = function(eventListenerOrFunction) {
+ checkSubscriptionArgument(eventListenerOrFunction);
+ var handleEvent, guid, handler;
+
+ if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") {
+ // Received an EventListener object implementing the handleEvent interface
+ handleEvent = eventListenerOrFunction.handleEvent;
+ } else {
+ // Received a function to handle event
+ handleEvent = eventListenerOrFunction;
+ }
- var guid = f.observer_guid,
- handler = this.handlers[guid];
+ guid = handleEvent.observer_guid;
+ handler = this.handlers[guid];
if (handler) {
delete this.handlers[guid];
this.numHandlers--;
@@ -814,7 +841,7 @@ module.exports = channel;
});
-// file: e:/cordova/cordova-browser/cordova-js-src/confighelper.js
+// file: /Users/steveng/repo/cordova/cordova-browser/cordova-js-src/confighelper.js
define("cordova/confighelper", function(require, exports, module) {
var config;
@@ -859,14 +886,9 @@ function readConfig(success, error) {
}
};
- if ("ActiveXObject" in window) {
- // Needed for XHR-ing via file:// protocol in IE
- xhr = new window.ActiveXObject("MSXML2.XMLHTTP");
- xhr.onreadystatechange = xhrStatusChangeHandler;
- } else {
- xhr = new XMLHttpRequest();
- xhr.addEventListener("load", xhrStatusChangeHandler);
- }
+ xhr = new XMLHttpRequest();
+ xhr.addEventListener("load", xhrStatusChangeHandler);
+
try {
xhr.open("get", "/config.xml", true);
@@ -894,7 +916,7 @@ exports.readConfig = readConfig;
});
-// file: e:/cordova/cordova-browser/cordova-js-src/exec.js
+// file: /Users/steveng/repo/cordova/cordova-browser/cordova-js-src/exec.js
define("cordova/exec", function(require, exports, module) {
/*jslint sloppy:true, plusplus:true*/
@@ -924,15 +946,15 @@ module.exports = function (success, fail, service, action, args) {
args = args || [];
if (proxy) {
-
+
var callbackId = service + cordova.callbackId++;
-
+
if (typeof success === "function" || typeof fail === "function") {
cordova.callbacks[callbackId] = {success: success, fail: fail};
}
try {
-
+
// callbackOptions param represents additional optional parameters command could pass back, like keepCallback or
// custom callbackId, for example {callbackId: id, keepCallback: true, status: cordova.callbackStatus.JSON_EXCEPTION }
@@ -984,7 +1006,7 @@ module.exports = function (success, fail, service, action, args) {
} else {
console.log("Error: exec proxy not found for :: " + service + " :: " + action);
-
+
if(typeof fail === "function" ) {
fail("Missing Command Error");
}
@@ -1474,35 +1496,15 @@ exports.reset();
});
-// file: e:/cordova/cordova-browser/cordova-js-src/platform.js
+// file: /Users/steveng/repo/cordova/cordova-browser/cordova-js-src/platform.js
define("cordova/platform", function(require, exports, module) {
module.exports = {
id: 'browser',
- cordovaVersion: '3.4.0',
+ cordovaVersion: '4.2.0', // cordova-js
bootstrap: function() {
- var cache = navigator.serviceWorker.register;
- var cacheCalled = false;
- navigator.serviceWorker.register = function() {
- cacheCalled = true;
- navigator.serviceWorker.register = cache;
- return cache.apply(navigator.serviceWorker,arguments);
- }
-
- document.addEventListener('deviceready',function(){
- if(!cacheCalled) {
- navigator.serviceWorker.register('/cordova-sw.js').then(function(registration) {
- // Registration was successful
- console.log('ServiceWorker registration successful with scope: ', registration.scope);
- }, function(err) {
- // registration failed :(
- console.log('ServiceWorker registration failed: ', err);
- });
- }
- });
-
var modulemapper = require('cordova/modulemapper');
var channel = require('cordova/channel');
@@ -1510,16 +1512,14 @@ module.exports = {
channel.onNativeReady.fire();
- // FIXME is this the right place to clobber pause/resume? I am guessing not
- // FIXME pause/resume should be deprecated IN CORDOVA for pagevisiblity api
- document.addEventListener('webkitvisibilitychange', function() {
- if (document.webkitHidden) {
+ document.addEventListener("visibilitychange", function(){
+ if(document.hidden) {
channel.onPause.fire();
}
else {
channel.onResume.fire();
}
- }, false);
+ });
// End of bootstrap
}
@@ -1796,7 +1796,10 @@ utils.clone = function(obj) {
retVal = {};
for(i in obj){
- if(!(i in retVal) || retVal[i] != obj[i]) {
+ // https://issues.apache.org/jira/browse/CB-11522 'unknown' type may be returned in
+ // custom protocol activation case on Windows Phone 8.1 causing "No such interface supported" exception
+ // on cloning.
+ if((!(i in retVal) || retVal[i] != obj[i]) && typeof obj[i] != 'undefined' && typeof obj[i] != 'unknown') {
retVal[i] = utils.clone(obj[i]);
}
}
--
To stop receiving notification emails like this one, please contact
"commits@cordova.apache.org" <co...@cordova.apache.org>.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org