Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C3049200D0F for ; Fri, 25 Aug 2017 07:57:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C18AD16B679; Fri, 25 Aug 2017 05:57:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EA9D116AF28 for ; Fri, 25 Aug 2017 07:57:28 +0200 (CEST) Received: (qmail 82685 invoked by uid 500); 25 Aug 2017 05:57:28 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 82588 invoked by uid 99); 25 Aug 2017 05:57:27 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Aug 2017 05:57:27 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 8E81184D68; Fri, 25 Aug 2017 05:57:27 +0000 (UTC) Date: Fri, 25 Aug 2017 05:57:28 +0000 To: "commits@cordova.apache.org" Subject: [cordova-browser] 01/04: Update JS snapshot to version 5.0.0 (via coho) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: steven@apache.org Reply-To: "commits@cordova.apache.org" In-Reply-To: <150364064747.12786.14951264151527294133@gitbox.apache.org> References: <150364064747.12786.14951264151527294133@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: cordova-browser X-Git-Refname: refs/heads/5.0.x X-Git-Reftype: branch X-Git-Rev: 5d75fab3f47748d67f2570bd9feaec4c7a8ae4fd X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20170825055727.8E81184D68@gitbox.apache.org> archived-at: Fri, 25 Aug 2017 05:57:29 -0000 This is an automated email from the ASF dual-hosted git repository. steven pushed a commit to branch 5.0.x in repository https://gitbox.apache.org/repos/asf/cordova-browser.git commit 5d75fab3f47748d67f2570bd9feaec4c7a8ae4fd Author: Steve Gill AuthorDate: Thu Aug 24 16:17:47 2017 -0700 Update JS snapshot to version 5.0.0 (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..224bfba 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.0.0'; // 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" . --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org