Update JS snapshot to version 6.5.0-dev (via coho)

This commit is contained in:
Joe Bowser 2017-11-06 11:44:23 -08:00
parent 05aeaf1bd2
commit 83601dca2f

View File

@ -1,6 +1,5 @@
/* eslint-disable */
// Platform: android // Platform: android
// 74a4adc2d0fddb1e0cfb9be1961494ef0afc9893 // 4450a4cea50616e080a82e8ede9e3d6a1fe3c3ec
/* /*
Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
@ -20,31 +19,29 @@
under the License. under the License.
*/ */
;(function() { ;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '6.4.0-dev'; var PLATFORM_VERSION_BUILD_LABEL = '6.5.0-dev';
// file: src/scripts/require.js // file: src/scripts/require.js
/* jshint -W079 */ /* jshint -W079 */
/* jshint -W020 */ /* jshint -W020 */
var require, var require;
define; var define;
(function () { (function () {
var modules = {}, var modules = {};
// Stack of moduleIds currently being built. // Stack of moduleIds currently being built.
requireStack = [], var requireStack = [];
// Map of module ID -> index into requireStack of modules currently being built. // Map of module ID -> index into requireStack of modules currently being built.
inProgressModules = {}, var inProgressModules = {};
SEPARATOR = "."; var SEPARATOR = '.';
function build (module) { function build (module) {
var factory = module.factory, var factory = module.factory;
localRequire = function (id) { var localRequire = function (id) {
var resultantId = id; var resultantId = id;
// Its a relative path, so lop off the last portion and add the id (minus "./") // Its a relative path, so lop off the last portion and add the id (minus "./")
if (id.charAt(0) === ".") { if (id.charAt(0) === '.') {
resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2); resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2);
} }
return require(resultantId); return require(resultantId);
@ -57,10 +54,10 @@ var require,
require = function (id) { require = function (id) {
if (!modules[id]) { if (!modules[id]) {
throw "module " + id + " not found"; throw 'module ' + id + ' not found';
} else if (id in inProgressModules) { } else if (id in inProgressModules) {
var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id; var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
throw "Cycle in require graph: " + cycle; throw 'Cycle in require graph: ' + cycle;
} }
if (modules[id].factory) { if (modules[id].factory) {
try { try {
@ -77,7 +74,7 @@ var require,
define = function (id, factory) { define = function (id, factory) {
if (modules[id]) { if (modules[id]) {
throw "module " + id + " already defined"; throw 'module ' + id + ' already defined';
} }
modules[id] = { modules[id] = {
@ -94,7 +91,7 @@ var require,
})(); })();
// Export for use in node // Export for use in node
if (typeof module === "object" && typeof require === "function") { if (typeof module === 'object' && typeof require === 'function') {
module.exports.require = require; module.exports.require = require;
module.exports.define = define; module.exports.define = define;
} }
@ -104,15 +101,13 @@ define("cordova", function(require, exports, module) {
// Workaround for Windows 10 in hosted environment case // Workaround for Windows 10 in hosted environment case
// http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object // http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object
if (window.cordova && !(window.cordova instanceof HTMLElement)) { if (window.cordova && !(window.cordova instanceof HTMLElement)) { // eslint-disable-line no-undef
throw new Error("cordova already defined"); throw new Error('cordova already defined');
} }
var channel = require('cordova/channel'); var channel = require('cordova/channel');
var platform = require('cordova/platform'); var platform = require('cordova/platform');
/** /**
* Intercept calls to addEventListener + removeEventListener and handle deviceready, * Intercept calls to addEventListener + removeEventListener and handle deviceready,
* resume, and pause events. * resume, and pause events.
@ -125,12 +120,12 @@ var m_window_removeEventListener = window.removeEventListener;
/** /**
* Houses custom event handlers to intercept on document + window event listeners. * Houses custom event handlers to intercept on document + window event listeners.
*/ */
var documentEventHandlers = {}, var documentEventHandlers = {};
windowEventHandlers = {}; var windowEventHandlers = {};
document.addEventListener = function (evt, handler, capture) { document.addEventListener = function (evt, handler, capture) {
var e = evt.toLowerCase(); var e = evt.toLowerCase();
if (typeof documentEventHandlers[e] != 'undefined') { if (typeof documentEventHandlers[e] !== 'undefined') {
documentEventHandlers[e].subscribe(handler); documentEventHandlers[e].subscribe(handler);
} else { } else {
m_document_addEventListener.call(document, evt, handler, capture); m_document_addEventListener.call(document, evt, handler, capture);
@ -139,7 +134,7 @@ document.addEventListener = function(evt, handler, capture) {
window.addEventListener = function (evt, handler, capture) { window.addEventListener = function (evt, handler, capture) {
var e = evt.toLowerCase(); var e = evt.toLowerCase();
if (typeof windowEventHandlers[e] != 'undefined') { if (typeof windowEventHandlers[e] !== 'undefined') {
windowEventHandlers[e].subscribe(handler); windowEventHandlers[e].subscribe(handler);
} else { } else {
m_window_addEventListener.call(window, evt, handler, capture); m_window_addEventListener.call(window, evt, handler, capture);
@ -149,7 +144,7 @@ window.addEventListener = function(evt, handler, capture) {
document.removeEventListener = function (evt, handler, capture) { document.removeEventListener = function (evt, handler, capture) {
var e = evt.toLowerCase(); var e = evt.toLowerCase();
// If unsubscribing from an event that is handled by a plugin // If unsubscribing from an event that is handled by a plugin
if (typeof documentEventHandlers[e] != "undefined") { if (typeof documentEventHandlers[e] !== 'undefined') {
documentEventHandlers[e].unsubscribe(handler); documentEventHandlers[e].unsubscribe(handler);
} else { } else {
m_document_removeEventListener.call(document, evt, handler, capture); m_document_removeEventListener.call(document, evt, handler, capture);
@ -159,7 +154,7 @@ document.removeEventListener = function(evt, handler, capture) {
window.removeEventListener = function (evt, handler, capture) { window.removeEventListener = function (evt, handler, capture) {
var e = evt.toLowerCase(); var e = evt.toLowerCase();
// If unsubscribing from an event that is handled by a plugin // If unsubscribing from an event that is handled by a plugin
if (typeof windowEventHandlers[e] != "undefined") { if (typeof windowEventHandlers[e] !== 'undefined') {
windowEventHandlers[e].unsubscribe(handler); windowEventHandlers[e].unsubscribe(handler);
} else { } else {
m_window_removeEventListener.call(window, evt, handler, capture); m_window_removeEventListener.call(window, evt, handler, capture);
@ -179,13 +174,16 @@ function createEvent(type, data) {
return event; return event;
} }
/* eslint-disable no-undef */
var cordova = { var cordova = {
define: define, define: define,
require: require, require: require,
version: PLATFORM_VERSION_BUILD_LABEL, version: PLATFORM_VERSION_BUILD_LABEL,
platformVersion: PLATFORM_VERSION_BUILD_LABEL, platformVersion: PLATFORM_VERSION_BUILD_LABEL,
platformId: platform.id, platformId: platform.id,
/* eslint-enable no-undef */
/** /**
* Methods to add/remove your own addEventListener hijacking on document + window. * Methods to add/remove your own addEventListener hijacking on document + window.
*/ */
@ -219,14 +217,13 @@ var cordova = {
*/ */
fireDocumentEvent: function (type, data, bNoDetach) { fireDocumentEvent: function (type, data, bNoDetach) {
var evt = createEvent(type, data); var evt = createEvent(type, data);
if (typeof documentEventHandlers[type] != 'undefined') { if (typeof documentEventHandlers[type] !== 'undefined') {
if (bNoDetach) { if (bNoDetach) {
documentEventHandlers[type].fire(evt); documentEventHandlers[type].fire(evt);
} } else {
else {
setTimeout(function () { setTimeout(function () {
// Fire deviceready on listeners that were registered before cordova.js was loaded. // Fire deviceready on listeners that were registered before cordova.js was loaded.
if (type == 'deviceready') { if (type === 'deviceready') {
document.dispatchEvent(evt); document.dispatchEvent(evt);
} }
documentEventHandlers[type].fire(evt); documentEventHandlers[type].fire(evt);
@ -238,7 +235,7 @@ var cordova = {
}, },
fireWindowEvent: function (type, data) { fireWindowEvent: function (type, data) {
var evt = createEvent(type, data); var evt = createEvent(type, data);
if (typeof windowEventHandlers[type] != 'undefined') { if (typeof windowEventHandlers[type] !== 'undefined') {
setTimeout(function () { setTimeout(function () {
windowEventHandlers[type].fire(evt); windowEventHandlers[type].fire(evt);
}, 0); }, 0);
@ -290,7 +287,7 @@ var cordova = {
try { try {
var callback = cordova.callbacks[callbackId]; var callback = cordova.callbacks[callbackId];
if (callback) { if (callback) {
if (isSuccess && status == cordova.callbackStatus.OK) { if (isSuccess && status === cordova.callbackStatus.OK) {
callback.success && callback.success.apply(null, args); callback.success && callback.success.apply(null, args);
} else if (!isSuccess) { } else if (!isSuccess) {
callback.fail && callback.fail.apply(null, args); callback.fail && callback.fail.apply(null, args);
@ -307,11 +304,10 @@ var cordova = {
delete cordova.callbacks[callbackId]; delete cordova.callbacks[callbackId];
} }
} }
} } catch (err) {
catch (err) { var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
var msg = "Error in " + (isSuccess ? "Success" : "Error") + " callbackId: " + callbackId + " : " + err;
console && console.log && console.log(msg); console && console.log && console.log(msg);
cordova.fireWindowEvent("cordovacallbackerror", { 'message': msg }); cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg });
throw err; throw err;
} }
}, },
@ -320,13 +316,12 @@ var cordova = {
try { try {
func(); func();
} catch (e) { } catch (e) {
console.log("Failed to run constructor: " + e); console.log('Failed to run constructor: ' + e);
} }
}); });
} }
}; };
module.exports = cordova; module.exports = cordova;
}); });
@ -403,18 +398,18 @@ function checkArgs(spec, functionName, args, opt_callee) {
var errMsg = null; var errMsg = null;
var typeName; var typeName;
for (var i = 0; i < spec.length; ++i) { for (var i = 0; i < spec.length; ++i) {
var c = spec.charAt(i), var c = spec.charAt(i);
cUpper = c.toUpperCase(), var cUpper = c.toUpperCase();
arg = args[i]; var arg = args[i];
// Asterix means allow anything. // Asterix means allow anything.
if (c == '*') { if (c === '*') {
continue; continue;
} }
typeName = utils.typeName(arg); typeName = utils.typeName(arg);
if ((arg === null || arg === undefined) && c == cUpper) { if ((arg === null || arg === undefined) && c === cUpper) {
continue; continue;
} }
if (typeName != typeMap[cUpper]) { if (typeName !== typeMap[cUpper]) {
errMsg = 'Expected ' + typeMap[cUpper]; errMsg = 'Expected ' + typeMap[cUpper];
break; break;
} }
@ -423,7 +418,7 @@ function checkArgs(spec, functionName, args, opt_callee) {
errMsg += ', but got ' + typeName + '.'; errMsg += ', but got ' + typeName + '.';
errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg; errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg;
// Don't log when running unit tests. // Don't log when running unit tests.
if (typeof jasmine == 'undefined') { if (typeof jasmine === 'undefined') {
console.error(errMsg); console.error(errMsg);
} }
throw TypeError(errMsg); throw TypeError(errMsg);
@ -438,7 +433,6 @@ moduleExports.checkArgs = checkArgs;
moduleExports.getValue = getValue; moduleExports.getValue = getValue;
moduleExports.enableChecks = true; moduleExports.enableChecks = true;
}); });
// file: src/common/base64.js // file: src/common/base64.js
@ -452,7 +446,7 @@ base64.fromArrayBuffer = function(arrayBuffer) {
}; };
base64.toArrayBuffer = function (str) { base64.toArrayBuffer = function (str) {
var decodedStr = typeof atob != 'undefined' ? atob(str) : new Buffer(str,'base64').toString('binary'); var decodedStr = typeof atob !== 'undefined' ? atob(str) : Buffer.from(str, 'base64').toString('binary'); // eslint-disable-line no-undef
var arrayBuffer = new ArrayBuffer(decodedStr.length); var arrayBuffer = new ArrayBuffer(decodedStr.length);
var array = new Uint8Array(arrayBuffer); var array = new Uint8Array(arrayBuffer);
for (var i = 0, len = decodedStr.length; i < len; i++) { for (var i = 0, len = decodedStr.length; i < len; i++) {
@ -468,7 +462,7 @@ base64.toArrayBuffer = function(str) {
* platforms tested. * platforms tested.
*/ */
var b64_6bit = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var b64_6bit = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
var b64_12bit; var b64_12bit;
var b64_12bitTable = function () { var b64_12bitTable = function () {
@ -484,7 +478,7 @@ var b64_12bitTable = function() {
function uint8ToBase64 (rawData) { function uint8ToBase64 (rawData) {
var numBytes = rawData.byteLength; var numBytes = rawData.byteLength;
var output=""; var output = '';
var segment; var segment;
var table = b64_12bitTable(); var table = b64_12bitTable();
for (var i = 0; i < numBytes - 2; i += 3) { for (var i = 0; i < numBytes - 2; i += 3) {
@ -492,12 +486,12 @@ function uint8ToBase64(rawData) {
output += table[segment >> 12]; output += table[segment >> 12];
output += table[segment & 0xfff]; output += table[segment & 0xfff];
} }
if (numBytes - i == 2) { if (numBytes - i === 2) {
segment = (rawData[i] << 16) + (rawData[i + 1] << 8); segment = (rawData[i] << 16) + (rawData[i + 1] << 8);
output += table[segment >> 12]; output += table[segment >> 12];
output += b64_6bit[(segment & 0xfff) >> 6]; output += b64_6bit[(segment & 0xfff) >> 6];
output += '='; output += '=';
} else if (numBytes - i == 1) { } else if (numBytes - i === 1) {
segment = (rawData[i] << 16); segment = (rawData[i] << 16);
output += table[segment >> 12]; output += table[segment >> 12];
output += '=='; output += '==';
@ -569,7 +563,7 @@ function include(parent, objects, clobber, merge) {
result = parent[key]; result = parent[key];
} else { } else {
// Overwrite if not currently defined. // Overwrite if not currently defined.
if (typeof parent[key] == 'undefined') { if (typeof parent[key] === 'undefined') {
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
} else { } else {
// Set result to what already exists, so we can build children into it if they exist. // Set result to what already exists, so we can build children into it if they exist.
@ -628,8 +622,8 @@ exports.replaceHookForTesting = function() {};
// file: src/common/channel.js // file: src/common/channel.js
define("cordova/channel", function(require, exports, module) { define("cordova/channel", function(require, exports, module) {
var utils = require('cordova/utils'), var utils = require('cordova/utils');
nextGuid = 1; var nextGuid = 1;
/** /**
* Custom pub-sub "channel" that can have functions subscribed to it * Custom pub-sub "channel" that can have functions subscribed to it
@ -682,16 +676,16 @@ var Channel = function(type, sticky) {
// Function that is called when the first listener is subscribed, or when // Function that is called when the first listener is subscribed, or when
// the last listener is unsubscribed. // the last listener is unsubscribed.
this.onHasSubscribersChange = null; this.onHasSubscribersChange = null;
}, };
channel = { var channel = {
/** /**
* Calls the provided function only after all of the channels specified * Calls the provided function only after all of the channels specified
* have been fired. All channels must be sticky channels. * have been fired. All channels must be sticky channels.
*/ */
join: function (h, c) { join: function (h, c) {
var len = c.length, var len = c.length;
i = len, var i = len;
f = function() { var f = function () {
if (!(--i)) h(); if (!(--i)) h();
}; };
for (var j = 0; j < len; j++) { for (var j = 0; j < len; j++) {
@ -702,13 +696,14 @@ var Channel = function(type, sticky) {
} }
if (!len) h(); if (!len) h();
}, },
/* eslint-disable no-return-assign */
create: function (type) { create: function (type) {
return channel[type] = new Channel(type, false); return channel[type] = new Channel(type, false);
}, },
createSticky: function (type) { createSticky: function (type) {
return channel[type] = new Channel(type, true); return channel[type] = new Channel(type, true);
}, },
/* eslint-enable no-return-assign */
/** /**
* cordova Channels that must fire before "deviceready" is fired. * cordova Channels that must fire before "deviceready" is fired.
*/ */
@ -744,10 +739,10 @@ var Channel = function(type, sticky) {
}; };
function checkSubscriptionArgument (argument) { function checkSubscriptionArgument (argument) {
if (typeof argument !== "function" && typeof argument.handleEvent !== "function") { if (typeof argument !== 'function' && typeof argument.handleEvent !== 'function') {
throw new Error( throw new Error(
"Must provide a function or an EventListener object " + 'Must provide a function or an EventListener object ' +
"implementing the handleEvent interface." 'implementing the handleEvent interface.'
); );
} }
} }
@ -763,7 +758,7 @@ Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) {
checkSubscriptionArgument(eventListenerOrFunction); checkSubscriptionArgument(eventListenerOrFunction);
var handleEvent, guid; var handleEvent, guid;
if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") { if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
// Received an EventListener object implementing the handleEvent interface // Received an EventListener object implementing the handleEvent interface
handleEvent = eventListenerOrFunction.handleEvent; handleEvent = eventListenerOrFunction.handleEvent;
eventListener = eventListenerOrFunction; eventListener = eventListenerOrFunction;
@ -772,13 +767,13 @@ Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) {
handleEvent = eventListenerOrFunction; handleEvent = eventListenerOrFunction;
} }
if (this.state == 2) { if (this.state === 2) {
handleEvent.apply(eventListener || this, this.fireArgs); handleEvent.apply(eventListener || this, this.fireArgs);
return; return;
} }
guid = eventListenerOrFunction.observer_guid; guid = eventListenerOrFunction.observer_guid;
if (typeof eventListener === "object") { if (typeof eventListener === 'object') {
handleEvent = utils.close(eventListener, handleEvent); handleEvent = utils.close(eventListener, handleEvent);
} }
@ -793,7 +788,7 @@ Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) {
if (!this.handlers[guid]) { if (!this.handlers[guid]) {
this.handlers[guid] = handleEvent; this.handlers[guid] = handleEvent;
this.numHandlers++; this.numHandlers++;
if (this.numHandlers == 1) { if (this.numHandlers === 1) {
this.onHasSubscribersChange && this.onHasSubscribersChange(); this.onHasSubscribersChange && this.onHasSubscribersChange();
} }
} }
@ -806,7 +801,7 @@ Channel.prototype.unsubscribe = function(eventListenerOrFunction) {
checkSubscriptionArgument(eventListenerOrFunction); checkSubscriptionArgument(eventListenerOrFunction);
var handleEvent, guid, handler; var handleEvent, guid, handler;
if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") { if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
// Received an EventListener object implementing the handleEvent interface // Received an EventListener object implementing the handleEvent interface
handleEvent = eventListenerOrFunction.handleEvent; handleEvent = eventListenerOrFunction.handleEvent;
} else { } else {
@ -829,10 +824,10 @@ Channel.prototype.unsubscribe = function(eventListenerOrFunction) {
* Calls all functions subscribed to this channel. * Calls all functions subscribed to this channel.
*/ */
Channel.prototype.fire = function (e) { Channel.prototype.fire = function (e) {
var fail = false, var fail = false; // eslint-disable-line no-unused-vars
fireArgs = Array.prototype.slice.call(arguments); var fireArgs = Array.prototype.slice.call(arguments);
// Apply stickiness. // Apply stickiness.
if (this.state == 1) { if (this.state === 1) {
this.state = 2; this.state = 2;
this.fireArgs = fireArgs; this.fireArgs = fireArgs;
} }
@ -846,7 +841,7 @@ Channel.prototype.fire = function(e) {
for (var i = 0; i < toCall.length; ++i) { for (var i = 0; i < toCall.length; ++i) {
toCall[i].apply(this, fireArgs); toCall[i].apply(this, fireArgs);
} }
if (this.state == 2 && this.numHandlers) { if (this.state === 2 && this.numHandlers) {
this.numHandlers = 0; this.numHandlers = 0;
this.handlers = {}; this.handlers = {};
this.onHasSubscribersChange && this.onHasSubscribersChange(); this.onHasSubscribersChange && this.onHasSubscribersChange();
@ -854,7 +849,6 @@ Channel.prototype.fire = function(e) {
} }
}; };
// defining them here so they are ready super fast! // defining them here so they are ready super fast!
// DOM event that is received when the web page is loaded and parsed. // DOM event that is received when the web page is loaded and parsed.
channel.createSticky('onDOMContentLoaded'); channel.createSticky('onDOMContentLoaded');
@ -1172,7 +1166,6 @@ module.exports = androidExec;
// file: src/common/exec/proxy.js // file: src/common/exec/proxy.js
define("cordova/exec/proxy", function(require, exports, module) { define("cordova/exec/proxy", function(require, exports, module) {
// internal map of proxy function // internal map of proxy function
var CommandProxyMap = {}; var CommandProxyMap = {};
@ -1180,7 +1173,7 @@ module.exports = {
// example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...); // example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
add: function (id, proxyObj) { add: function (id, proxyObj) {
console.log("adding proxy for " + id); console.log('adding proxy for ' + id);
CommandProxyMap[id] = proxyObj; CommandProxyMap[id] = proxyObj;
return proxyObj; return proxyObj;
}, },
@ -1197,6 +1190,7 @@ module.exports = {
return (CommandProxyMap[service] ? CommandProxyMap[service][action] : null); return (CommandProxyMap[service] ? CommandProxyMap[service][action] : null);
} }
}; };
}); });
// file: src/common/init.js // file: src/common/init.js
@ -1213,14 +1207,14 @@ var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
function logUnfiredChannels (arr) { function logUnfiredChannels (arr) {
for (var i = 0; i < arr.length; ++i) { for (var i = 0; i < arr.length; ++i) {
if (arr[i].state != 2) { if (arr[i].state !== 2) {
console.log('Channel not fired: ' + arr[i].type); console.log('Channel not fired: ' + arr[i].type);
} }
} }
} }
window.setTimeout(function () { window.setTimeout(function () {
if (channel.onDeviceReady.state != 2) { if (channel.onDeviceReady.state !== 2) {
console.log('deviceready has not fired after 5 seconds.'); console.log('deviceready has not fired after 5 seconds.');
logUnfiredChannels(platformInitChannelsArray); logUnfiredChannels(platformInitChannelsArray);
logUnfiredChannels(channel.deviceReadyChannelsArray); logUnfiredChannels(channel.deviceReadyChannelsArray);
@ -1237,10 +1231,9 @@ function replaceNavigator(origNavigator) {
// Without it, APIs such as getGamepads() break. // Without it, APIs such as getGamepads() break.
if (CordovaNavigator.bind) { if (CordovaNavigator.bind) {
for (var key in origNavigator) { for (var key in origNavigator) {
if (typeof origNavigator[key] == 'function') { if (typeof origNavigator[key] === 'function') {
newNavigator[key] = origNavigator[key].bind(origNavigator); newNavigator[key] = origNavigator[key].bind(origNavigator);
} } else {
else {
(function (k) { (function (k) {
utils.defineGetterSetter(newNavigator, key, function () { utils.defineGetterSetter(newNavigator, key, function () {
return origNavigator[k]; return origNavigator[k];
@ -1263,7 +1256,7 @@ if (!window.console) {
} }
if (!window.console.warn) { if (!window.console.warn) {
window.console.warn = function (msg) { window.console.warn = function (msg) {
this.log("warn: " + msg); this.log('warn: ' + msg);
}; };
} }
@ -1274,7 +1267,7 @@ channel.onActivated = cordova.addDocumentEventHandler('activated');
channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready'); channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
// Listen for DOMContentLoaded and notify our channel subscribers. // Listen for DOMContentLoaded and notify our channel subscribers.
if (document.readyState == 'complete' || document.readyState == 'interactive') { if (document.readyState === 'complete' || document.readyState === 'interactive') {
channel.onDOMContentLoaded.fire(); channel.onDOMContentLoaded.fire();
} else { } else {
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
@ -1324,7 +1317,6 @@ channel.join(function() {
}, platformInitChannelsArray); }, platformInitChannelsArray);
}); });
// file: src/common/init_b.js // file: src/common/init_b.js
@ -1344,14 +1336,14 @@ cordova.exec = require('cordova/exec');
function logUnfiredChannels (arr) { function logUnfiredChannels (arr) {
for (var i = 0; i < arr.length; ++i) { for (var i = 0; i < arr.length; ++i) {
if (arr[i].state != 2) { if (arr[i].state !== 2) {
console.log('Channel not fired: ' + arr[i].type); console.log('Channel not fired: ' + arr[i].type);
} }
} }
} }
window.setTimeout(function () { window.setTimeout(function () {
if (channel.onDeviceReady.state != 2) { if (channel.onDeviceReady.state !== 2) {
console.log('deviceready has not fired after 5 seconds.'); console.log('deviceready has not fired after 5 seconds.');
logUnfiredChannels(platformInitChannelsArray); logUnfiredChannels(platformInitChannelsArray);
logUnfiredChannels(channel.deviceReadyChannelsArray); logUnfiredChannels(channel.deviceReadyChannelsArray);
@ -1368,10 +1360,9 @@ function replaceNavigator(origNavigator) {
// Without it, APIs such as getGamepads() break. // Without it, APIs such as getGamepads() break.
if (CordovaNavigator.bind) { if (CordovaNavigator.bind) {
for (var key in origNavigator) { for (var key in origNavigator) {
if (typeof origNavigator[key] == 'function') { if (typeof origNavigator[key] === 'function') {
newNavigator[key] = origNavigator[key].bind(origNavigator); newNavigator[key] = origNavigator[key].bind(origNavigator);
} } else {
else {
(function (k) { (function (k) {
utils.defineGetterSetter(newNavigator, key, function () { utils.defineGetterSetter(newNavigator, key, function () {
return origNavigator[k]; return origNavigator[k];
@ -1393,7 +1384,7 @@ if (!window.console) {
} }
if (!window.console.warn) { if (!window.console.warn) {
window.console.warn = function (msg) { window.console.warn = function (msg) {
this.log("warn: " + msg); this.log('warn: ' + msg);
}; };
} }
@ -1404,7 +1395,7 @@ channel.onActivated = cordova.addDocumentEventHandler('activated');
channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready'); channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
// Listen for DOMContentLoaded and notify our channel subscribers. // Listen for DOMContentLoaded and notify our channel subscribers.
if (document.readyState == 'complete' || document.readyState == 'interactive') { if (document.readyState === 'complete' || document.readyState === 'interactive') {
channel.onDOMContentLoaded.fire(); channel.onDOMContentLoaded.fire();
} else { } else {
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
@ -1455,10 +1446,10 @@ channel.join(function() {
// file: src/common/modulemapper.js // file: src/common/modulemapper.js
define("cordova/modulemapper", function(require, exports, module) { define("cordova/modulemapper", function(require, exports, module) {
var builder = require('cordova/builder'), var builder = require('cordova/builder');
moduleMap = define.moduleMap, var moduleMap = define.moduleMap; // eslint-disable-line no-undef
symbolList, var symbolList;
deprecationMap; var deprecationMap;
exports.reset = function () { exports.reset = function () {
symbolList = []; symbolList = [];
@ -1498,7 +1489,7 @@ function prepareNamespace(symbolPath, context) {
} }
var parts = symbolPath.split('.'); var parts = symbolPath.split('.');
var cur = context; var cur = context;
for (var i = 0, part; part = parts[i]; ++i) { for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign
cur = cur[part] = cur[part] || {}; cur = cur[part] = cur[part] || {};
} }
return cur; return cur;
@ -1512,7 +1503,7 @@ exports.mapModules = function(context) {
var moduleName = symbolList[i + 1]; var moduleName = symbolList[i + 1];
var module = require(moduleName); var module = require(moduleName);
// <runs/> // <runs/>
if (strategy == 'r') { if (strategy === 'r') {
continue; continue;
} }
var symbolPath = symbolList[i + 2]; var symbolPath = symbolList[i + 2];
@ -1524,9 +1515,9 @@ exports.mapModules = function(context) {
var parentObj = prepareNamespace(namespace, context); var parentObj = prepareNamespace(namespace, context);
var target = parentObj[lastName]; var target = parentObj[lastName];
if (strategy == 'm' && target) { if (strategy === 'm' && target) {
builder.recursiveMerge(target, module); builder.recursiveMerge(target, module);
} else if ((strategy == 'd' && !target) || (strategy != 'd')) { } else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
if (!(symbolPath in origSymbols)) { if (!(symbolPath in origSymbols)) {
origSymbols[symbolPath] = target; origSymbols[symbolPath] = target;
} }
@ -1550,15 +1541,14 @@ exports.getOriginalSymbol = function(context, symbolPath) {
exports.reset(); exports.reset();
}); });
// file: src/common/modulemapper_b.js // file: src/common/modulemapper_b.js
define("cordova/modulemapper_b", function(require, exports, module) { define("cordova/modulemapper_b", function(require, exports, module) {
var builder = require('cordova/builder'), var builder = require('cordova/builder');
symbolList = [], var symbolList = [];
deprecationMap; var deprecationMap;
exports.reset = function () { exports.reset = function () {
symbolList = []; symbolList = [];
@ -1595,7 +1585,7 @@ function prepareNamespace(symbolPath, context) {
} }
var parts = symbolPath.split('.'); var parts = symbolPath.split('.');
var cur = context; var cur = context;
for (var i = 0, part; part = parts[i]; ++i) { for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign
cur = cur[part] = cur[part] || {}; cur = cur[part] = cur[part] || {};
} }
return cur; return cur;
@ -1609,7 +1599,7 @@ exports.mapModules = function(context) {
var moduleName = symbolList[i + 1]; var moduleName = symbolList[i + 1];
var module = require(moduleName); var module = require(moduleName);
// <runs/> // <runs/>
if (strategy == 'r') { if (strategy === 'r') {
continue; continue;
} }
var symbolPath = symbolList[i + 2]; var symbolPath = symbolList[i + 2];
@ -1621,9 +1611,9 @@ exports.mapModules = function(context) {
var parentObj = prepareNamespace(namespace, context); var parentObj = prepareNamespace(namespace, context);
var target = parentObj[lastName]; var target = parentObj[lastName];
if (strategy == 'm' && target) { if (strategy === 'm' && target) {
builder.recursiveMerge(target, module); builder.recursiveMerge(target, module);
} else if ((strategy == 'd' && !target) || (strategy != 'd')) { } else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
if (!(symbolPath in origSymbols)) { if (!(symbolPath in origSymbols)) {
origSymbols[symbolPath] = target; origSymbols[symbolPath] = target;
} }
@ -1647,7 +1637,6 @@ exports.getOriginalSymbol = function(context, symbolPath) {
exports.reset(); exports.reset();
}); });
// file: /Users/jbowser/cordova/cordova-android/cordova-js-src/platform.js // file: /Users/jbowser/cordova/cordova-android/cordova-js-src/platform.js
@ -1857,12 +1846,11 @@ module.exports = {
define("cordova/pluginloader", function(require, exports, module) { define("cordova/pluginloader", function(require, exports, module) {
var modulemapper = require('cordova/modulemapper'); var modulemapper = require('cordova/modulemapper');
var urlutil = require('cordova/urlutil');
// Helper function to inject a <script> tag. // Helper function to inject a <script> tag.
// Exported for testing. // Exported for testing.
exports.injectScript = function (url, onload, onerror) { exports.injectScript = function (url, onload, onerror) {
var script = document.createElement("script"); var script = document.createElement('script');
// onload fires even when script fails loads with an error. // onload fires even when script fails loads with an error.
script.onload = onload; script.onload = onload;
// onerror fires for malformed URLs. // onerror fires for malformed URLs.
@ -1873,11 +1861,11 @@ exports.injectScript = function(url, onload, onerror) {
function injectIfNecessary (id, url, onload, onerror) { function injectIfNecessary (id, url, onload, onerror) {
onerror = onerror || onload; onerror = onerror || onload;
if (id in define.moduleMap) { if (id in define.moduleMap) { // eslint-disable-line no-undef
onload(); onload();
} else { } else {
exports.injectScript(url, function () { exports.injectScript(url, function () {
if (id in define.moduleMap) { if (id in define.moduleMap) { // eslint-disable-line no-undef
onload(); onload();
} else { } else {
onerror(); onerror();
@ -1888,7 +1876,7 @@ function injectIfNecessary(id, url, onload, onerror) {
function onScriptLoadingComplete (moduleList, finishPluginLoading) { function onScriptLoadingComplete (moduleList, finishPluginLoading) {
// Loop through all the plugins and then through their clobbers and merges. // Loop through all the plugins and then through their clobbers and merges.
for (var i = 0, module; module = moduleList[i]; i++) { for (var i = 0, module; module = moduleList[i]; i++) { // eslint-disable-line no-cond-assign
if (module.clobbers && module.clobbers.length) { if (module.clobbers && module.clobbers.length) {
for (var j = 0; j < module.clobbers.length; j++) { for (var j = 0; j < module.clobbers.length; j++) {
modulemapper.clobbers(module.id, module.clobbers[j]); modulemapper.clobbers(module.id, module.clobbers[j]);
@ -1939,7 +1927,7 @@ function findCordovaPath() {
var term = '/cordova.js'; var term = '/cordova.js';
for (var n = scripts.length - 1; n > -1; n--) { for (var n = scripts.length - 1; n > -1; n--) {
var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007). var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007).
if (src.indexOf(term) == (src.length - term.length)) { if (src.indexOf(term) === (src.length - term.length)) {
path = src.substring(0, src.length - term.length) + '/'; path = src.substring(0, src.length - term.length) + '/';
break; break;
} }
@ -1957,12 +1945,11 @@ exports.load = function(callback) {
pathPrefix = ''; pathPrefix = '';
} }
injectIfNecessary('cordova/plugin_list', pathPrefix + 'cordova_plugins.js', function () { injectIfNecessary('cordova/plugin_list', pathPrefix + 'cordova_plugins.js', function () {
var moduleList = require("cordova/plugin_list"); var moduleList = require('cordova/plugin_list');
handlePluginsObject(pathPrefix, moduleList, callback); handlePluginsObject(pathPrefix, moduleList, callback);
}, callback); }, callback);
}; };
}); });
// file: src/common/pluginloader_b.js // file: src/common/pluginloader_b.js
@ -1979,7 +1966,7 @@ function handlePluginsObject(moduleList) {
} }
// Loop through all the modules and then through their clobbers and merges. // Loop through all the modules and then through their clobbers and merges.
for (var i = 0, module; module = moduleList[i]; i++) { for (var i = 0, module; module = moduleList[i]; i++) { // eslint-disable-line no-cond-assign
if (module.clobbers && module.clobbers.length) { if (module.clobbers && module.clobbers.length) {
for (var j = 0; j < module.clobbers.length; j++) { for (var j = 0; j < module.clobbers.length; j++) {
modulemapper.clobbers(module.id, module.clobbers[j]); modulemapper.clobbers(module.id, module.clobbers[j]);
@ -2004,19 +1991,17 @@ function handlePluginsObject(moduleList) {
// onDeviceReady is blocked on onPluginsReady. onPluginsReady is fired when there are // onDeviceReady is blocked on onPluginsReady. onPluginsReady is fired when there are
// no plugins to load, or they are all done. // no plugins to load, or they are all done.
exports.load = function (callback) { exports.load = function (callback) {
var moduleList = require("cordova/plugin_list"); var moduleList = require('cordova/plugin_list');
handlePluginsObject(moduleList); handlePluginsObject(moduleList);
callback(); callback();
}; };
}); });
// file: src/common/urlutil.js // file: src/common/urlutil.js
define("cordova/urlutil", function(require, exports, module) { define("cordova/urlutil", function(require, exports, module) {
/** /**
* For already absolute URLs, returns what is passed in. * For already absolute URLs, returns what is passed in.
* For relative URLs, converts them to absolute ones. * For relative URLs, converts them to absolute ones.
@ -2027,7 +2012,6 @@ exports.makeAbsolute = function makeAbsolute(url) {
return anchorEl.href; return anchorEl.href;
}; };
}); });
// file: src/common/utils.js // file: src/common/utils.js
@ -2067,7 +2051,7 @@ utils.arrayIndexOf = function(a, item) {
} }
var len = a.length; var len = a.length;
for (var i = 0; i < len; ++i) { for (var i = 0; i < len; ++i) {
if (a[i] == item) { if (a[i] === item) {
return i; return i;
} }
} }
@ -2079,10 +2063,10 @@ utils.arrayIndexOf = function(a, item) {
*/ */
utils.arrayRemove = function (a, item) { utils.arrayRemove = function (a, item) {
var index = utils.arrayIndexOf(a, item); var index = utils.arrayIndexOf(a, item);
if (index != -1) { if (index !== -1) {
a.splice(index, 1); a.splice(index, 1);
} }
return index != -1; return index !== -1;
}; };
utils.typeName = function (val) { utils.typeName = function (val) {
@ -2093,7 +2077,7 @@ utils.typeName = function(val) {
* Returns an indication of whether the argument is an array or not * Returns an indication of whether the argument is an array or not
*/ */
utils.isArray = Array.isArray || utils.isArray = Array.isArray ||
function(a) {return utils.typeName(a) == 'Array';}; function (a) { return utils.typeName(a) === 'Array'; };
/** /**
* Returns an indication of whether the argument is a Date or not * Returns an indication of whether the argument is a Date or not
@ -2106,7 +2090,7 @@ utils.isDate = function(d) {
* Does a deep clone of the object. * Does a deep clone of the object.
*/ */
utils.clone = function (obj) { utils.clone = function (obj) {
if(!obj || typeof obj == 'function' || utils.isDate(obj) || typeof obj != 'object') { if (!obj || typeof obj === 'function' || utils.isDate(obj) || typeof obj !== 'object') {
return obj; return obj;
} }
@ -2125,7 +2109,7 @@ utils.clone = function(obj) {
// https://issues.apache.org/jira/browse/CB-11522 'unknown' type may be returned in // 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 // custom protocol activation case on Windows Phone 8.1 causing "No such interface supported" exception
// on cloning. // on cloning.
if((!(i in retVal) || retVal[i] != obj[i]) && typeof obj[i] != 'undefined' && typeof obj[i] != 'unknown') { if ((!(i in retVal) || retVal[i] !== obj[i]) && typeof obj[i] !== 'undefined' && typeof obj[i] !== 'unknown') { // eslint-disable-line valid-typeof
retVal[i] = utils.clone(obj[i]); retVal[i] = utils.clone(obj[i]);
} }
} }
@ -2144,11 +2128,11 @@ utils.close = function(context, func, params) {
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
function UUIDcreatePart (length) { function UUIDcreatePart (length) {
var uuidpart = ""; var uuidpart = '';
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
var uuidchar = parseInt((Math.random() * 256), 10).toString(16); var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
if (uuidchar.length == 1) { if (uuidchar.length === 1) {
uuidchar = "0" + uuidchar; uuidchar = '0' + uuidchar;
} }
uuidpart += uuidchar; uuidpart += uuidchar;
} }
@ -2166,7 +2150,6 @@ utils.createUUID = function() {
UUIDcreatePart(6); UUIDcreatePart(6);
}; };
/** /**
* Extends a child object from a parent object using classical inheritance * Extends a child object from a parent object using classical inheritance
* pattern. * pattern.
@ -2195,10 +2178,6 @@ utils.alert = function(msg) {
} }
}; };
}); });
window.cordova = require('cordova'); window.cordova = require('cordova');