This is an automated email from the ASF dual-hosted git repository. erisu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cordova-mobile-spec.git
The following commit(s) were added to refs/heads/master by this push: new 068d4f9 chore!: remove deprecated platform and plugin usage (#211) 068d4f9 is described below commit 068d4f95f1bc9a583c31b5912b0d298e50122a86 Author: エリス <er...@users.noreply.github.com> AuthorDate: Mon Feb 24 22:30:33 2025 +0900 chore!: remove deprecated platform and plugin usage (#211) --- config.xml | 7 --- cordova-plugin-mobilespec-tests/plugin.xml | 2 +- .../tests/datauri.tests.js | 11 ----- .../tests/localXHR.tests.js | 53 ++-------------------- .../tests/storage.tests.js | 16 ------- createmobilespec/createmobilespec.js | 39 ++-------------- www/cordova-incl.js | 26 ++--------- www/csp-incl.js | 22 ++------- www/master.css | 9 +--- 9 files changed, 15 insertions(+), 170 deletions(-) diff --git a/config.xml b/config.xml index 8840907..dc578ac 100644 --- a/config.xml +++ b/config.xml @@ -52,13 +52,6 @@ <allow-intent href="tel:*" /> <allow-intent href="www.google.com" /> <allow-navigation href="data:*" /> - <platform name="blackberry10"> - <access origin="file:///" /> - <access origin="https://www.apache.org" /> - <access origin="http://cordova.apache.org" /> - <access origin="http://foobar.apache.org" /> - <access origin="http://www.apache.org" /> - </platform> <preference name="iosPersistentFileLocation" value="Library" /> <preference name="AndroidPersistentFileLocation" value="Internal" /> <platform name="android"> diff --git a/cordova-plugin-mobilespec-tests/plugin.xml b/cordova-plugin-mobilespec-tests/plugin.xml index 20981a8..881a5b0 100644 --- a/cordova-plugin-mobilespec-tests/plugin.xml +++ b/cordova-plugin-mobilespec-tests/plugin.xml @@ -42,7 +42,7 @@ <js-module src="tests/input.tests.js" name="input.tests"> </js-module> - + <platform name="android"> <source-file src="AndroidMobileSpecTestPlugin.java" target-dir="src/org/apache/cordova/mobilespec" /> <config-file target="res/xml/config.xml" parent="/*"> diff --git a/cordova-plugin-mobilespec-tests/tests/datauri.tests.js b/cordova-plugin-mobilespec-tests/tests/datauri.tests.js index 534e1c1..634a380 100644 --- a/cordova-plugin-mobilespec-tests/tests/datauri.tests.js +++ b/cordova-plugin-mobilespec-tests/tests/datauri.tests.js @@ -18,9 +18,6 @@ */ exports.defineAutoTests = function () { - var isWindowsPhone = cordova.platformId == 'windowsphone'; - var isWindows = (cordova.platformId === "windows") || (cordova.platformId === "windows8"); - describe('data uris', function () { var frame; var onMessageBind; @@ -40,14 +37,6 @@ exports.defineAutoTests = function () { }); it("datauri.spec.1 should work with iframes", function (done) { - // IE on WP7/8 considers 'data:' in frame.src string as protocol type - // so asks user to look for appropriating application in the market; - // temporary skipped since requires user interaction - // data:text/html is not supported by IE so pended for windows platform for now - if (isWindowsPhone || isWindows) { - pending(); - } - frame = document.createElement('iframe'); onMessageBind = onMessage.bind(null, done); window.addEventListener('message', onMessageBind, false); diff --git a/cordova-plugin-mobilespec-tests/tests/localXHR.tests.js b/cordova-plugin-mobilespec-tests/tests/localXHR.tests.js index e084b9c..06f9ebf 100644 --- a/cordova-plugin-mobilespec-tests/tests/localXHR.tests.js +++ b/cordova-plugin-mobilespec-tests/tests/localXHR.tests.js @@ -21,10 +21,9 @@ // These tests are needed to check browser's functionality and verify that we are not breaking it. exports.defineAutoTests = function () { - var isWp8 = cordova.platformId === "windowsphone"; var isIOS = (cordova.platformId === "ios"); var isIOSWKWebView = isIOS && (window.webkit && window.webkit.messageHandlers); - + describe("XMLHttpRequest", function () { var errorHandler = { onError: function (done) { @@ -79,10 +78,8 @@ exports.defineAutoTests = function () { // overrideMimeType // IE10 does not support overrideMimeType - if (cordova.platformId != 'windows8' && cordova.platformId != 'windowsphone') { - expect(xhr.overrideMimeType).toBeDefined(); - expect(typeof xhr.overrideMimeType == 'function').toBe(true); - } + expect(xhr.overrideMimeType).toBeDefined(); + expect(typeof xhr.overrideMimeType == 'function').toBe(true); // open expect(xhr.open).toBeDefined(); @@ -176,48 +173,4 @@ exports.defineAutoTests = function () { }, "Expecting both callbacks to be called."); }); }); - - - // only add these tests if we are testing on windows phone - - if (isWp8) { - describe("XMLHttpRequest Windows Phone", function () { - - var errorHandler = { onError: function () { } }; - - beforeEach(function () { - spyOn(errorHandler, 'onError'); - }); - - afterEach(function () { - expect(errorHandler.onError).not.toHaveBeenCalled(); - }); - - var createXHR = function (url, bAsync, win, lose) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, bAsync); - xhr.onload = win; - xhr.onerror = lose; - xhr.send(); - return xhr; - }; - - it("XMLHttpRequest.spec.7 should be able to load the (WP8 backwards compatability) root page www/index.html", function (done) { - expect(function () { - createXHR("www/index.html", true, done, errorHandler.onError) - }).not.toThrow(); - }); - - it("XMLHttpRequest.spec.8 should be able to load the (WP7 backwards compatability) root page app/www/index.html", function (done) { - expect(function () { - createXHR("app/www/index.html", true, done, errorHandler.onError) - }).not.toThrow(); - }); - - it("XMLHttpRequest.spec.11 should be able to load the current page using window.location with extra / [CB-6299]", function (done) { - var path = window.location.protocol + "/" + window.location.toString().substr(window.location.protocol.length); - createXHR(path, true, done, errorHandler.onError); - }); - }); - } } diff --git a/cordova-plugin-mobilespec-tests/tests/storage.tests.js b/cordova-plugin-mobilespec-tests/tests/storage.tests.js index e6627cb..46418a9 100644 --- a/cordova-plugin-mobilespec-tests/tests/storage.tests.js +++ b/cordova-plugin-mobilespec-tests/tests/storage.tests.js @@ -19,11 +19,7 @@ * */ exports.defineAutoTests = function () { - - var isWindowsPhone = cordova.platformId == 'windowsphone'; - var isWindows = (cordova.platformId === "windows") || (cordova.platformId === "windows8"); var isIOS = (cordova.platformId === "ios"); - var isOSX = (cordova.platformId === "osx"); var isIOSWKWebView = isIOS && (window.webkit && window.webkit.messageHandlers); describe("Session Storage", function () { @@ -179,18 +175,10 @@ exports.defineAutoTests = function () { describe("HTML 5 Storage", function () { it("storage.spec.9 should exist", function () { - //IE doesn't support openDatabase method - if (isWindows || isWindowsPhone) { - pending(); - } expect(window.openDatabase).toBeDefined(); }); it("storage.spec.17 should contain an openDatabase function", function () { - //IE doesn't support openDatabase method - if (isWindows || isWindowsPhone) { - pending(); - } expect(window.openDatabase).toBeDefined(); if (window.openDatabase) { expect(typeof window.openDatabase).toBe('function'); @@ -222,10 +210,6 @@ exports.defineAutoTests = function () { if (isIOSWKWebView) { pending(); } - if (isOSX) { - // see CB-10579 - pending(); - } var db = openDatabase("Database", "1.0", "HTML5 Database API example", 5 * 1024 * 1024); db.transaction(function (t) { diff --git a/createmobilespec/createmobilespec.js b/createmobilespec/createmobilespec.js index 8ea563a..493de96 100755 --- a/createmobilespec/createmobilespec.js +++ b/createmobilespec/createmobilespec.js @@ -107,16 +107,12 @@ var top_dir = process.cwd() + path.sep, "config": ["www"] }, "ios": { "bin": ["cordova-ios"], "www": ["www"], - "config": ["CUSTOM"] }, - "osx": { "bin": ["cordova-osx"], - "www": ["www"] }, - "windows": { "bin": ["cordova-windows"], - "www": ["www"] } + "config": ["CUSTOM"] } }, argv = optimist.usage("\nUsage: $0 PLATFORM... [--help] [--plugman] [--link] [--global] [--globalplugins] [--plugins=\".\\myPluginDir\"] [--skipjs] [--skiplink] [--variable VAR=\"value\"] [directoryName]\n" + "A project will be created with the mobile-spec app and all the core plugins.\n" + "At least one platform must be specified. See the included README.md.\n" + - "\tPLATFORM: [--<android|browser|electron|ios|osx|windows>]\n" + + "\tPLATFORM: [--<android|browser|electron|ios>]\n" + "") .boolean("help").describe("help", "Shows usage.") .boolean("debug").describe("debug", "Debug logging.") @@ -124,8 +120,6 @@ var top_dir = process.cwd() + path.sep, .boolean("browser").describe("browser", "Add Browser platform.") .boolean("electron").describe("electron", "Add Electron platform.") .boolean("ios").describe("ios", "Add iOS platform.") - .boolean("osx").describe("osx", "Add osx platform (macOS).") - .boolean("windows").describe("windows", "Add Windows (universal) platform.") .boolean("plugman").describe("plugman", "Use {platform}/bin/create and plugman directly instead of the CLI.") .boolean("global").describe("global", "Use the globally-installed `cordova` and the downloaded platforms/plugins from the registry instead of the local git repo.\n" + "\t\t\tWill use the local git repo of mobile-spec.\n" + @@ -154,8 +148,6 @@ var top_dir = process.cwd() + path.sep, var DEFAULT_PLUGINS = [ 'cordova-plugin-battery-status', 'cordova-plugin-camera', - 'cordova-plugin-console', - 'cordova-plugin-contacts', 'cordova-plugin-device', 'cordova-plugin-device-motion', 'cordova-plugin-device-orientation', @@ -163,30 +155,17 @@ var DEFAULT_PLUGINS = [ 'cordova-plugin-file', 'cordova-plugin-file-transfer', 'cordova-plugin-geolocation', - 'cordova-plugin-globalization', 'cordova-plugin-inappbrowser', 'cordova-plugin-media', 'cordova-plugin-media-capture', 'cordova-plugin-network-information', + 'cordova-plugin-screen-orientation', 'cordova-plugin-splashscreen', 'cordova-plugin-statusbar', 'cordova-plugin-vibration', - 'cordova-plugin-whitelist', // TODO check if all are listed ]; -// osx platform (macOS) has little support for the most of the plugins, -// so it gets its own default list -var DEFAULT_PLUGINS_OSX = [ - 'cordova-plugin-camera', - 'cordova-plugin-device', - 'cordova-plugin-file', - 'cordova-plugin-inappbrowser', - // non-functional on osx platform (macOS), iOS, - // or any other non-Android platforms: - 'cordova-plugin-whitelist', -]; - // plugin search paths that will override default var SEARCH_PATHS = { 'cordova-plugin-mobilespec-tests': mobile_spec_git_dir, @@ -208,8 +187,6 @@ if (argv.android) { platforms.push("android"); } if (argv.ios) { platforms.push("ios"); } if (argv.browser) { platforms.push("browser"); } if (argv.electron) { platforms.push("electron"); } -if (argv.windows) { platforms.push("windows"); } -if (argv.osx) {platforms.push("osx");} argv.skiplink = argv.skiplink || argv.global; argv.skipjs = argv.skipjs || argv.global; @@ -468,16 +445,6 @@ function pluginIdToDirName(id) { function installPlugins() { var plugins = DEFAULT_PLUGINS; - // special override for osx platform (macOS) - if (argv.osx) { - if (platforms.length > 1) { - console.warn('Warning: Testing more than one platform at once may cause issues with unsupported plugins for osx platform (macOS).'); - } else { - console.warn('Warning: Using reduced plugin list for osx platform (macOS).'); - plugins = DEFAULT_PLUGINS_OSX; - } - } - if (argv.plugins) { plugins = argv.plugins.split(" ").filter(function (item) { return item !== ""; diff --git a/www/cordova-incl.js b/www/cordova-incl.js index 895891d..331ffbd 100644 --- a/www/cordova-incl.js +++ b/www/cordova-incl.js @@ -22,17 +22,8 @@ var PLAT; (function getPlatform() { var platforms = { - amazon_fireos: /cordova-amazon-fireos/, android: /Android/, - ios: /(iPad)|(iPhone)|(iPod)/, - blackberry10: /(BB10)/, - blackberry: /(PlayBook)|(BlackBerry)/, - // Since Windows Phone 8.1 uses completely different API more similar to Windows 8 - // than to Windows phone 8 we need to detect it separately. - windowsphone81: /Windows Phone 8.1/, - windowsphone: /Windows Phone/, - windows8: /MSAppHost/, - firefoxos: /Firefox/ + ios: /(iPad)|(iPhone)|(iPod)/ }; for (var key in platforms) { if (platforms[key].exec(navigator.userAgent)) { @@ -43,20 +34,11 @@ var PLAT; })(); var scripts = document.getElementsByTagName('script'); -var currentPath = scripts[scripts.length - 1].src; -if (PLAT !== "blackberry10" && PLAT !== "firefoxos" && PLAT !== 'windowsphone' && PLAT !== 'windowsphone81') { - currentPath += '?paramShouldBeIgnored'; -} +var currentPath = scripts[scripts.length - 1].src + '?paramShouldBeIgnored'; var cordovaPath = currentPath.replace("cordova-incl.js", "cordova.js"); if (!window._doNotWriteCordovaScript) { - if (PLAT != "windows8" && PLAT != "windowsphone81") { - document.write('<script type="text/javascript" charset="utf-8" src="' + cordovaPath + '"></script>'); - } else { - var s = document.createElement('script'); - s.src = cordovaPath; - document.head.appendChild(s); - } + document.write('<script type="text/javascript" charset="utf-8" src="' + cordovaPath + '"></script>'); } function addListenerToClass(className, listener, argsArray, action, doNotWrap) { @@ -82,7 +64,7 @@ function addListenerToClass(className, listener, argsArray, action, doNotWrap) { } function backHome() { - if (window.device && device.platform && (device.platform.toLowerCase() == 'android' || device.platform.toLowerCase() == 'amazon-fireos')) { + if (window.device && device.platform && (device.platform.toLowerCase() == 'android')) { navigator.app.backHistory(); } else { diff --git a/www/csp-incl.js b/www/csp-incl.js index eef832e..83d6bea 100644 --- a/www/csp-incl.js +++ b/www/csp-incl.js @@ -22,17 +22,8 @@ var PLAT; (function getPlatform() { var platforms = { - amazon_fireos: /cordova-amazon-fireos/, android: /Android/, - ios: /(iPad)|(iPhone)|(iPod)/, - blackberry10: /(BB10)/, - blackberry: /(PlayBook)|(BlackBerry)/, - // Since Windows Phone 8.1 uses completely different API more similar to Windows 8 - // than to Windows phone 8 we need to detect it separately. - windowsphone81: /Windows Phone 8.1/, - windowsphone: /Windows Phone/, - windows: /MSAppHost/, - firefoxos: /Firefox/ + ios: /(iPad)|(iPhone)|(iPod)/ }; for (var key in platforms) { if (platforms[key].exec(navigator.userAgent)) { @@ -49,7 +40,6 @@ if (!window._disableCSP) { switch (PLAT) { case 'android': case 'ios': - case 'windows': cspMetaContent = 'default-src \'self\' https://ssl.gstatic.com/accessibility/javascript/android/;' + ' connect-src \'self\' http://www.google.com;' + ' media-src \'self\' http://cordova.apache.org/downloads/ https://cordova.apache.org/downloads/;' + @@ -61,16 +51,10 @@ if (!window._disableCSP) { if (cspMetaContent) { cspMetaContent = '<meta http-equiv="Content-Security-Policy" content="' + cspMetaContent + '"/>'; - if (PLAT === 'windows' && MSApp && MSApp.execUnsafeLocalFunction) { - MSApp.execUnsafeLocalFunction(function () { - document.write(cspMetaContent); - }); - } else { - document.write(cspMetaContent); - } + document.write(cspMetaContent); } } else { - console.log('CSP injection is disabled.'); + console.log('CSP injection is disabled.'); } diff --git a/www/master.css b/www/master.css index 9e8798d..0606e09 100644 --- a/www/master.css +++ b/www/master.css @@ -169,15 +169,8 @@ display: none; } -body.amazon-fireos-platform .platform.amazon-fireos, body.android-platform .platform.android, -body.blackberry10-platform .platform.blackberry10, body.browser-platform .platform.browser, -body.firefoxos-platform .platform.firefoxos, -body.ios-platform .platform.ios, -body.osx-platform .platform.ios, -body.ubuntu-platform .platform.ubuntu, -body.windows8-platform .platform.windows8, -body.windowsphone-platform .platform.windowsphone { +body.ios-platform .platform.ios { display: block; } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org