Skip to content

Commit 0bf2c07

Browse files
committed
Update JS snapshot to version 6.0.0 (via coho)
1 parent 940f888 commit 0bf2c07

File tree

1 file changed

+7
-276
lines changed

1 file changed

+7
-276
lines changed

cordova-lib/cordova.js

Lines changed: 7 additions & 276 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Platform: browser
2-
// 4450a4cea50616e080a82e8ede9e3d6a1fe3c3ec
2+
// d07d9d0989196f1b90fe962ca68f5ceb355c69ec
33
/*
44
Licensed to the Apache Software Foundation (ASF) under one
55
or more contributor license agreements. See the NOTICE file
@@ -19,12 +19,9 @@
1919
under the License.
2020
*/
2121
;(function() {
22-
var PLATFORM_VERSION_BUILD_LABEL = '5.1.0-dev';
22+
var PLATFORM_VERSION_BUILD_LABEL = '6.0.0';
2323
// file: src/scripts/require.js
2424

25-
/* jshint -W079 */
26-
/* jshint -W020 */
27-
2825
var require;
2926
var define;
3027

@@ -307,6 +304,7 @@ var cordova = {
307304
} catch (err) {
308305
var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
309306
console && console.log && console.log(msg);
307+
console && console.log && err.stack && console.log(err.stack);
310308
cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg });
311309
throw err;
312310
}
@@ -836,7 +834,7 @@ module.exports = channel;
836834

837835
});
838836

839-
// file: /Users/steveng/repo/cordova/cordova-browser/cordova-js-src/confighelper.js
837+
// file: /Users/erisu/git/apache/cordova/cordova-browser/cordova-js-src/confighelper.js
840838
define("cordova/confighelper", function(require, exports, module) {
841839

842840
var config;
@@ -886,7 +884,7 @@ function readConfig(success, error) {
886884

887885

888886
try {
889-
xhr.open("get", "/config.xml", true);
887+
xhr.open("get", "config.xml", true);
890888
xhr.send();
891889
} catch(e) {
892890
fail('[Browser][cordova.js][readConfig] Could not XHR config.xml: ' + JSON.stringify(e));
@@ -911,7 +909,7 @@ exports.readConfig = readConfig;
911909

912910
});
913911

914-
// file: /Users/steveng/repo/cordova/cordova-browser/cordova-js-src/exec.js
912+
// file: /Users/erisu/git/apache/cordova/cordova-browser/cordova-js-src/exec.js
915913
define("cordova/exec", function(require, exports, module) {
916914

917915
/*jslint sloppy:true, plusplus:true*/
@@ -1166,130 +1164,6 @@ channel.join(function () {
11661164

11671165
});
11681166

1169-
// file: src/common/init_b.js
1170-
define("cordova/init_b", function(require, exports, module) {
1171-
1172-
var channel = require('cordova/channel');
1173-
var cordova = require('cordova');
1174-
var modulemapper = require('cordova/modulemapper');
1175-
var platform = require('cordova/platform');
1176-
var pluginloader = require('cordova/pluginloader');
1177-
var utils = require('cordova/utils');
1178-
1179-
var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady, channel.onPluginsReady];
1180-
1181-
// setting exec
1182-
cordova.exec = require('cordova/exec');
1183-
1184-
function logUnfiredChannels (arr) {
1185-
for (var i = 0; i < arr.length; ++i) {
1186-
if (arr[i].state !== 2) {
1187-
console.log('Channel not fired: ' + arr[i].type);
1188-
}
1189-
}
1190-
}
1191-
1192-
window.setTimeout(function () {
1193-
if (channel.onDeviceReady.state !== 2) {
1194-
console.log('deviceready has not fired after 5 seconds.');
1195-
logUnfiredChannels(platformInitChannelsArray);
1196-
logUnfiredChannels(channel.deviceReadyChannelsArray);
1197-
}
1198-
}, 5000);
1199-
1200-
// Replace navigator before any modules are required(), to ensure it happens as soon as possible.
1201-
// We replace it so that properties that can't be clobbered can instead be overridden.
1202-
function replaceNavigator (origNavigator) {
1203-
var CordovaNavigator = function () {};
1204-
CordovaNavigator.prototype = origNavigator;
1205-
var newNavigator = new CordovaNavigator();
1206-
// This work-around really only applies to new APIs that are newer than Function.bind.
1207-
// Without it, APIs such as getGamepads() break.
1208-
if (CordovaNavigator.bind) {
1209-
for (var key in origNavigator) {
1210-
if (typeof origNavigator[key] === 'function') {
1211-
newNavigator[key] = origNavigator[key].bind(origNavigator);
1212-
} else {
1213-
(function (k) {
1214-
utils.defineGetterSetter(newNavigator, key, function () {
1215-
return origNavigator[k];
1216-
});
1217-
})(key);
1218-
}
1219-
}
1220-
}
1221-
return newNavigator;
1222-
}
1223-
if (window.navigator) {
1224-
window.navigator = replaceNavigator(window.navigator);
1225-
}
1226-
1227-
if (!window.console) {
1228-
window.console = {
1229-
log: function () {}
1230-
};
1231-
}
1232-
if (!window.console.warn) {
1233-
window.console.warn = function (msg) {
1234-
this.log('warn: ' + msg);
1235-
};
1236-
}
1237-
1238-
// Register pause, resume and deviceready channels as events on document.
1239-
channel.onPause = cordova.addDocumentEventHandler('pause');
1240-
channel.onResume = cordova.addDocumentEventHandler('resume');
1241-
channel.onActivated = cordova.addDocumentEventHandler('activated');
1242-
channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
1243-
1244-
// Listen for DOMContentLoaded and notify our channel subscribers.
1245-
if (document.readyState === 'complete' || document.readyState === 'interactive') {
1246-
channel.onDOMContentLoaded.fire();
1247-
} else {
1248-
document.addEventListener('DOMContentLoaded', function () {
1249-
channel.onDOMContentLoaded.fire();
1250-
}, false);
1251-
}
1252-
1253-
// _nativeReady is global variable that the native side can set
1254-
// to signify that the native code is ready. It is a global since
1255-
// it may be called before any cordova JS is ready.
1256-
if (window._nativeReady) {
1257-
channel.onNativeReady.fire();
1258-
}
1259-
1260-
// Call the platform-specific initialization.
1261-
platform.bootstrap && platform.bootstrap();
1262-
1263-
// Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js.
1264-
// The delay allows the attached modules to be defined before the plugin loader looks for them.
1265-
setTimeout(function () {
1266-
pluginloader.load(function () {
1267-
channel.onPluginsReady.fire();
1268-
});
1269-
}, 0);
1270-
1271-
/**
1272-
* Create all cordova objects once native side is ready.
1273-
*/
1274-
channel.join(function () {
1275-
modulemapper.mapModules(window);
1276-
1277-
platform.initialize && platform.initialize();
1278-
1279-
// Fire event to notify that all objects are created
1280-
channel.onCordovaReady.fire();
1281-
1282-
// Fire onDeviceReady event once page has fully loaded, all
1283-
// constructors have run and cordova info has been received from native
1284-
// side.
1285-
channel.join(function () {
1286-
require('cordova').fireDocumentEvent('deviceready');
1287-
}, channel.deviceReadyChannelsArray);
1288-
1289-
}, platformInitChannelsArray);
1290-
1291-
});
1292-
12931167
// file: src/common/modulemapper.js
12941168
define("cordova/modulemapper", function(require, exports, module) {
12951169

@@ -1390,103 +1264,7 @@ exports.reset();
13901264

13911265
});
13921266

1393-
// file: src/common/modulemapper_b.js
1394-
define("cordova/modulemapper_b", function(require, exports, module) {
1395-
1396-
var builder = require('cordova/builder');
1397-
var symbolList = [];
1398-
var deprecationMap;
1399-
1400-
exports.reset = function () {
1401-
symbolList = [];
1402-
deprecationMap = {};
1403-
};
1404-
1405-
function addEntry (strategy, moduleName, symbolPath, opt_deprecationMessage) {
1406-
symbolList.push(strategy, moduleName, symbolPath);
1407-
if (opt_deprecationMessage) {
1408-
deprecationMap[symbolPath] = opt_deprecationMessage;
1409-
}
1410-
}
1411-
1412-
// Note: Android 2.3 does have Function.bind().
1413-
exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) {
1414-
addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
1415-
};
1416-
1417-
exports.merges = function (moduleName, symbolPath, opt_deprecationMessage) {
1418-
addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
1419-
};
1420-
1421-
exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) {
1422-
addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
1423-
};
1424-
1425-
exports.runs = function (moduleName) {
1426-
addEntry('r', moduleName, null);
1427-
};
1428-
1429-
function prepareNamespace (symbolPath, context) {
1430-
if (!symbolPath) {
1431-
return context;
1432-
}
1433-
var parts = symbolPath.split('.');
1434-
var cur = context;
1435-
for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign
1436-
cur = cur[part] = cur[part] || {};
1437-
}
1438-
return cur;
1439-
}
1440-
1441-
exports.mapModules = function (context) {
1442-
var origSymbols = {};
1443-
context.CDV_origSymbols = origSymbols;
1444-
for (var i = 0, len = symbolList.length; i < len; i += 3) {
1445-
var strategy = symbolList[i];
1446-
var moduleName = symbolList[i + 1];
1447-
var module = require(moduleName);
1448-
// <runs/>
1449-
if (strategy === 'r') {
1450-
continue;
1451-
}
1452-
var symbolPath = symbolList[i + 2];
1453-
var lastDot = symbolPath.lastIndexOf('.');
1454-
var namespace = symbolPath.substr(0, lastDot);
1455-
var lastName = symbolPath.substr(lastDot + 1);
1456-
1457-
var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
1458-
var parentObj = prepareNamespace(namespace, context);
1459-
var target = parentObj[lastName];
1460-
1461-
if (strategy === 'm' && target) {
1462-
builder.recursiveMerge(target, module);
1463-
} else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
1464-
if (!(symbolPath in origSymbols)) {
1465-
origSymbols[symbolPath] = target;
1466-
}
1467-
builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
1468-
}
1469-
}
1470-
};
1471-
1472-
exports.getOriginalSymbol = function (context, symbolPath) {
1473-
var origSymbols = context.CDV_origSymbols;
1474-
if (origSymbols && (symbolPath in origSymbols)) {
1475-
return origSymbols[symbolPath];
1476-
}
1477-
var parts = symbolPath.split('.');
1478-
var obj = context;
1479-
for (var i = 0; i < parts.length; ++i) {
1480-
obj = obj && obj[parts[i]];
1481-
}
1482-
return obj;
1483-
};
1484-
1485-
exports.reset();
1486-
1487-
});
1488-
1489-
// file: /Users/steveng/repo/cordova/cordova-browser/cordova-js-src/platform.js
1267+
// file: /Users/erisu/git/apache/cordova/cordova-browser/cordova-js-src/platform.js
14901268
define("cordova/platform", function(require, exports, module) {
14911269

14921270
module.exports = {
@@ -1627,53 +1405,6 @@ exports.load = function (callback) {
16271405

16281406
});
16291407

1630-
// file: src/common/pluginloader_b.js
1631-
define("cordova/pluginloader_b", function(require, exports, module) {
1632-
1633-
var modulemapper = require('cordova/modulemapper');
1634-
1635-
// Handler for the cordova_plugins.js content.
1636-
// See plugman's plugin_loader.js for the details of this object.
1637-
function handlePluginsObject (moduleList) {
1638-
// if moduleList is not defined or empty, we've nothing to do
1639-
if (!moduleList || !moduleList.length) {
1640-
return;
1641-
}
1642-
1643-
// Loop through all the modules and then through their clobbers and merges.
1644-
for (var i = 0, module; module = moduleList[i]; i++) { // eslint-disable-line no-cond-assign
1645-
if (module.clobbers && module.clobbers.length) {
1646-
for (var j = 0; j < module.clobbers.length; j++) {
1647-
modulemapper.clobbers(module.id, module.clobbers[j]);
1648-
}
1649-
}
1650-
1651-
if (module.merges && module.merges.length) {
1652-
for (var k = 0; k < module.merges.length; k++) {
1653-
modulemapper.merges(module.id, module.merges[k]);
1654-
}
1655-
}
1656-
1657-
// Finally, if runs is truthy we want to simply require() the module.
1658-
if (module.runs) {
1659-
modulemapper.runs(module.id);
1660-
}
1661-
}
1662-
}
1663-
1664-
// Loads all plugins' js-modules. Plugin loading is syncronous in browserified bundle
1665-
// but the method accepts callback to be compatible with non-browserify flow.
1666-
// onDeviceReady is blocked on onPluginsReady. onPluginsReady is fired when there are
1667-
// no plugins to load, or they are all done.
1668-
exports.load = function (callback) {
1669-
var moduleList = require('cordova/plugin_list');
1670-
handlePluginsObject(moduleList);
1671-
1672-
callback();
1673-
};
1674-
1675-
});
1676-
16771408
// file: src/common/urlutil.js
16781409
define("cordova/urlutil", function(require, exports, module) {
16791410

0 commit comments

Comments
 (0)