You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/06/13 20:21:41 UTC
[18/78] [partial] start of lazy loading: axe all vendored-in libs
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/plugins/SplashScreen/index.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/bin/test/plugins/SplashScreen/index.js b/lib/cordova-blackberry/bin/test/plugins/SplashScreen/index.js
deleted file mode 100644
index 658ce3d..0000000
--- a/lib/cordova-blackberry/bin/test/plugins/SplashScreen/index.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-* Copyright 2013 Research In Motion Limited.
-*
-* Licensed 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 KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-describe("SplashScreen", function () {
- var _apiDir = __dirname + "./../../../../plugins/SplashScreen/src/blackberry10/",
- index,
- mockedEnv = {
- response: {
- send: jasmine.createSpy()
- }
- },
- mockedApplication = {
- windowVisible: undefined
- };
-
- beforeEach(function () {
- index = require(_apiDir + "index");
- mockedEnv.response.send.reset();
- });
-
- afterEach(function () {
- index = null;
- delete require.cache[require.resolve(_apiDir + "index")];
- });
- describe("show", function () {
- beforeEach(function () {
- GLOBAL.PluginResult = function (args, env) {};
- GLOBAL.PluginResult.prototype.error = jasmine.createSpy();
- });
-
- afterEach(function () {
- delete GLOBAL.PluginResult;
- });
-
- it("calls PluginResult.error if show is called", function () {
- index.show();
-
- expect(PluginResult.prototype.error).toHaveBeenCalledWith("Not supported on platform", false);
- });
- });
-
- describe("hide", function () {
- beforeEach(function () {
- GLOBAL.window = {
- qnx: {
- webplatform: {
- getApplication: function () {
- return mockedApplication;
- }
- }
- }
- };
-
- GLOBAL.PluginResult = function (args, env) {};
- GLOBAL.PluginResult.prototype.ok = jasmine.createSpy();
- });
-
- afterEach(function () {
- delete GLOBAL.window;
- delete GLOBAL.PluginResult;
- });
-
- it("calls PluginResult.ok if hide is called", function () {
- index.hide();
-
- expect(mockedApplication.windowVisible).toBeTruthy();
- expect(PluginResult.prototype.ok).toHaveBeenCalledWith(undefined, false);
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/bootstrap/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/bootstrap/index.html b/lib/cordova-blackberry/framework/bootstrap/index.html
deleted file mode 100644
index 6e3b028..0000000
--- a/lib/cordova-blackberry/framework/bootstrap/index.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="user-scalable=no, target-densitydpi=device-dpi, width=device-width">
- <title>WebWorks For BB10 Bootstrap</title>
- <script src="./require.js"></script>
- <script src="platform:///webplatform.js"></script>
- <script src="./frameworkModules.js"></script>
- <script>
- function start() {
- //Must load jnext first, as there seemed to be a race condition for if it was defined before it was used
- require("lib/jnext.js");
- require(frameworkModules, function () {
- require('lib/framework').start();
- });
- }
- </script>
- </head>
- <body onload="start();">
- I am the man behind the curtain.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/bootstrap/require.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/bootstrap/require.js b/lib/cordova-blackberry/framework/bootstrap/require.js
deleted file mode 100644
index a68bfcc..0000000
--- a/lib/cordova-blackberry/framework/bootstrap/require.js
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var define,
- require;
-
-(function () {
- var unpreparedModules = {},
- readyModules = {},
- ACCEPTABLE_EXTENSIONS = [".js", ".json"],
- DEFAULT_EXTENSION = ".js";
-
- function hasValidExtension(moduleName) {
- return ACCEPTABLE_EXTENSIONS.some(function (element, index, array) {
- return moduleName.match("\\" + element + "$");
- });
- }
-
-
- function normalizeName(originalName, baseName) {
- var nameParts,
- name = originalName.slice(0);
- //remove ^local:// (if it exists) and .js$
- //This will not work for local:// without a trailing js
- name = name.replace(/(?:^local:\/\/)/, "");
- if (name.charAt(0) === '.' && baseName) {
- //Split the baseName and remove the final part (the module name)
- nameParts = baseName.split('/');
- nameParts.pop();
- nameParts = nameParts.concat(name.split('/'));
-
- name = nameParts.reduce(function (previous, current, index, array) {
- var returnValue,
- slashIndex;
-
- //If previous is a dot, ignore it
- //If previous is ever just .. we're screwed anyway
- if (previous !== '.') {
- returnValue = previous;
- }
-
- //If we have a .. then remove a chunk of previous
- if (current === "..") {
- slashIndex = previous.lastIndexOf('/');
- //If there's no slash we're either screwed or we remove the final token
- if (slashIndex !== -1) {
- returnValue = previous.slice(0, previous.lastIndexOf('/'));
- } else {
- returnValue = "";
- }
- } else if (current !== '.') {
- //Otherwise simply append anything not a .
- //Only append a slash if we're not empty
- if (returnValue.length) {
- returnValue += "/";
- }
- returnValue += current;
- }
-
- return returnValue;
- });
-
- }
-
- //If there is no acceptable extension tack on a .js
- if (!hasValidExtension(name)) {
- name = name + DEFAULT_EXTENSION;
- }
-
- return name;
- }
-
- function buildModule(name, dependencies, factory) {
- var module = {exports: {}},
- localRequire = function (moduleName) {
- return require(moduleName, name);
- },
- args = [];
- localRequire.toUrl = function (moduleName, baseName) {
- return require.toUrl(moduleName, baseName || name);
- };
- dependencies.forEach(function (dependency) {
- if (dependency === 'require') {
- args.push(localRequire);
- } else if (dependency === 'exports') {
- args.push(module.exports);
- } else if (dependency === 'module') {
- args.push(module);
- } else {
- //This is because jshint cannot handle out of order functions
- /*global loadModule:false */
- args.push(loadModule(dependency));
- /*global loadModule:true */
- }
- });
-
- //No need to process dependencies, webworks only has require, exports, module
- factory.apply(this, args);
-
- //For full AMD we would need logic to also check the return value
- return module.exports;
-
- }
-
- function getDefineString(moduleName, body) {
- var evalString = 'define("' + moduleName + '", function (require, exports, module) {',
- isJson = /\.json$/.test(moduleName);
-
- evalString += isJson ? ' module.exports = ' : '';
- evalString += body.replace(/^\s+|\s+$/g, '');
- evalString += isJson ? ' ;' : '';
- evalString += '});';
-
- return evalString;
- }
-
- function loadModule(name, baseName) {
- var normalizedName = normalizeName(name, baseName),
- url,
- xhr,
- loadResult;
- //Always check undefined first, this allows the user to redefine modules
- //(Not used in WebWorks, although it is used in our unit tests)
- if (unpreparedModules[normalizedName]) {
- readyModules[normalizedName] = buildModule(normalizedName, unpreparedModules[normalizedName].dependencies, unpreparedModules[normalizedName].factory);
- delete unpreparedModules[normalizedName];
- }
-
- //If the module does not exist, load the module from external source
- //Webworks currently only loads APIs from across bridge
- if (!readyModules[normalizedName]) {
- //If the module to be loaded ends in .js then we will define it
- //Also if baseName exists than we have a local require situation
- if (hasValidExtension(name) || baseName) {
- xhr = new XMLHttpRequest();
- url = name;
- //If the module to be loaded starts with local:// go over the bridge
- //Else If the module to be loaded is a relative load it may not have .js extension which is needed
- if (/^local:\/\//.test(name)) {
- url = "http://localhost:8472/extensions/load/" + normalizedName.replace(/(?:^ext\/)(.+)(?:\/client.js$)/, "$1");
-
- xhr.open("GET", url, false);
- xhr.send(null);
- try {
- loadResult = JSON.parse(xhr.responseText);
-
- loadResult.dependencies.forEach(function (dep) {
- /*jshint evil:true */
- eval(getDefineString(dep.moduleName, dep.body));
- /*jshint evil:false */
- });
-
- //Trimming responseText to remove EOF chars
- /*jshint evil:true */
- eval(getDefineString(normalizedName, loadResult.client));
- /*jshint evil:false */
- } catch (err1) {
- err1.message += ' in ' + url;
- throw err1;
- }
- } else {
- if (baseName) {
- url = normalizedName;
- }
-
- xhr.open("GET", url, false);
- xhr.send(null);
- try {
- //Trimming responseText to remove EOF chars
- /*jshint evil:true */
- eval(getDefineString(normalizedName, xhr.responseText));
- /*jshint evil:false */
- } catch (err) {
- err.message += ' in ' + url;
- throw err;
- }
- }
-
- if (unpreparedModules[normalizedName]) {
- readyModules[normalizedName] = buildModule(normalizedName, unpreparedModules[normalizedName].dependencies, unpreparedModules[normalizedName].factory);
- delete unpreparedModules[normalizedName];
- }
- } else {
- throw "module " + name + " cannot be found";
- }
-
- }
-
- return readyModules[normalizedName];
-
- }
-
- //Use the AMD signature incase we ever want to change.
- //For now we will only be using (name, baseName)
- require = function (dependencies, callback) {
- if (typeof dependencies === "string") {
- //dependencies is the module name and callback is the relName
- //relName is not part of the AMDJS spec, but we use it from localRequire
- return loadModule(dependencies, callback);
- } else if (Array.isArray(dependencies) && typeof callback === 'function') {
- //Call it Asynchronously
- setTimeout(function () {
- buildModule(undefined, dependencies, callback);
- }, 0);
- }
- };
-
- require.toUrl = function (originalName, baseName) {
- return normalizeName(originalName, baseName);
- };
-
- //Use the AMD signature incase we ever want to change.
- //For now webworks will only be using (name, factory) signature.
- define = function (name, dependencies, factory) {
- if (typeof name === "string" && typeof dependencies === 'function') {
- factory = dependencies;
- dependencies = ['require', 'exports', 'module'];
- }
-
- //According to the AMDJS spec we should parse out the require statments
- //from factory.toString and add those to the list of dependencies
-
- //Normalize the name. Remove local:// and .js
- name = normalizeName(name);
- unpreparedModules[name] = {
- dependencies: dependencies,
- factory: factory
- };
- };
-}());
-
-//Export for use in node for unit tests
-if (typeof module === "object" && typeof require === "function") {
- module.exports = {
- require: require,
- define: define
- };
-}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/bootstrap/ui.html
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/bootstrap/ui.html b/lib/cordova-blackberry/framework/bootstrap/ui.html
deleted file mode 100644
index 98c94a0..0000000
--- a/lib/cordova-blackberry/framework/bootstrap/ui.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!-- Copyright 2012 Research In Motion Limited.
-
- Licensed 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 KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- -->
-<!DOCTYPE HTML>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
- <title>Overlay WebView</title>
- <link rel="stylesheet" href="platform:///ui-resources/styles/styles.css" type="text/css" media="screen" charset="utf-8">
-
- <script src="../chrome/require.js" type="text/javascript"></script>
- <script src="platform:///webplatform.js" type="text/javascript"></script>
- <script src="platform:///i18n.js" type="text/javascript"></script>
- <script src="platform:///ui-resources/index.js" type="text/javascript"></script>
- </head>
- <body>
-
- <div id="contextMenuModal" style="display:none;"></div>
-<div id="contextMenu" class="hideMenu">
- <div id="contextMenuHeader">
- <div id="contextMenuHeadText"></div>
- <div id="contextMenuSubheadText"></div>
- </div>
- <div id="contextMenuContent"></div>
- <div id="contextMenuHandle"></div>
- <div id="contextMenuDelete"></div>
-</div>
-
- <div id="dialog" class="hidden">
- <div class="dialog-top-third">
- <div id="dialog-panel">
- </div>
- </div>
- <div class="dialog-bottom-two-thirds">
- </div>
-</div>
-
- <div id="invocationlist" class="screenInner screenSlide removed">
- <div id="cancelTitlebar"></div>
- <div id="invocationListContent" class="targetList"></div>
- <div id="targetLoader">
- <div id="targetLoaderActivity" class="activityIndicator"></div>
- </div>
-</div>
-
- <div id="toaster" class="toaster"></div>
-
-
- <div id="childwebviewcontrols"></div>
-
- <div id="formcontrolPanel">
- <div id="formcontrol">
- <button id="formcontrol_previous"/>
- <button id="formcontrol_next"/>
- <button id="formcontrol_submit"/>
- </div>
- </div>
-
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/PluginResult.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/PluginResult.js b/lib/cordova-blackberry/framework/lib/PluginResult.js
deleted file mode 100644
index 68acf23..0000000
--- a/lib/cordova-blackberry/framework/lib/PluginResult.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-function PluginResult (args, env) {
-
- var CALLBACK_STATUS_NO_RESULT = 0,
- CALLBACK_STATUS_OK = 1,
- CALLBACK_STATUS_ERROR = 9,
- callbackId = JSON.parse(decodeURIComponent(args.callbackId)),
- send = function (data) {
- env.response.send(200, encodeURIComponent(JSON.stringify(data)));
- },
- callback = function (success, status, data, keepCallback) {
- var executeString = "cordova.callbackFromNative('" + callbackId + "', " +
- !!success + ", " + status + ", [" + data + "], " + !!keepCallback + ");";
- env.webview.executeJavaScript(executeString);
- };
-
- Object.defineProperty(this, "callbackId", {enumerable: true, value: callbackId});
-
- this.noResult = function (keepCallback) {
- send({ code: CALLBACK_STATUS_NO_RESULT, keepCallback: !!keepCallback });
- };
-
- this.error = function (msg, keepCallback) {
- send({ code: CALLBACK_STATUS_ERROR, msg: msg, keepCallback: !!keepCallback });
- };
-
- this.ok = function (data, keepCallback) {
- send({ code: CALLBACK_STATUS_OK, data: data, keepCallback: !!keepCallback });
- };
-
- this.callbackOk = function (data, keepCallback) {
- callback(true, CALLBACK_STATUS_OK, JSON.stringify(data), keepCallback);
- };
-
- this.callbackError = function (msg, keepCallback) {
- callback(false, CALLBACK_STATUS_ERROR, JSON.stringify(msg), keepCallback);
- };
-}
-
-window.PluginResult = PluginResult;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/config.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/config.js b/lib/cordova-blackberry/framework/lib/config.js
deleted file mode 100644
index 6fbe527..0000000
--- a/lib/cordova-blackberry/framework/lib/config.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var defaults = require('./config/default'),
- user = require('./config/user'),
- utils = require('./utils');
-
-module.exports = utils.mixin(user,
- utils.mixin(defaults, {}));
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/config/default.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/config/default.js b/lib/cordova-blackberry/framework/lib/config/default.js
deleted file mode 100644
index 31990b1..0000000
--- a/lib/cordova-blackberry/framework/lib/config/default.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2010-2011 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module.exports = {
- configXML: "config.xml",
- configXMLDoc: null,
-
- backButtonBehavior: "back",
- customHeaders: {},
- version: "1.0.0",
-
- author: "",
- authorURL: "",
- authorEmail: "",
- copyright: "",
- content: "index.html",
- contentCharset: "",
- contentType: "",
- description: "",
- icon: "AIRApp_72.png",
- iconHover: "",
- id: "",
- license: "",
- licenseURL: "",
- name: "WebWorksAppTemplate",
-
- navigationMode: "pointer",
-
- preferredTransports: null,
- transportTimeout: 300000,
-
- hasMultiAccess: false,
- widgetExtensions: null,
- featureTable: null,
- accessList: null,
- permissions: null,
-
- loadingScreenColor: "#FFFFFF",
- backgroundImage: "",
- foregroundImage: "",
- onFirstLaunch: false,
- onLocalPageLoad: false,
- onRemotePageLoad: false,
- transitionType: -1,
- transitionDuration: 250,
- transitionDirection: 128,
-
- disableAllCache: false,
- aggressiveCacheAge: 2592000,
- maxCacheSizeTotal: 1024,
- maxCacheSizeItem: 128,
- maxStandardCacheAge: 2592000,
-
- runOnStartUp: false,
- allowInvokeParams: false,
- backgroundSource: "",
- foregroundSource: "index.html",
- debugEnabled: false,
- enableFormControl: true,
- enableChildWebView: true,
- enableWebSecurity: true,
- enablePopupBlocker: false
-};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/config/user.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/config/user.js b/lib/cordova-blackberry/framework/lib/config/user.js
deleted file mode 100644
index 5e36885..0000000
--- a/lib/cordova-blackberry/framework/lib/config/user.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2010-2011 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module.exports = {
- authorEmail: "guocat@gmail.com",
- copyright: "@Rebecca",
- customHeaders: {
- "rim-header": "RIM-Widget:rim/widget"
- },
- userAgent: "Some extremely long user agent (with) spe/cial, characters",
- author: "Me",
- version: "1.0.0.0",
- hasMultiAccess: true,
- license: "This is a license",
- accessList: [{
- allowSubDomain: false,
- features: [{
- version: "1.0.0.0",
- required: true,
- id: "blackberry.example.test"
- }, {
- version: "1.0.0.0",
- required: true,
- id: "blackberry.app"
- }],
- uri: "WIDGET_LOCAL"
- }],
- licenseURL: "",
- authorURL: "http://bbtools_win7_01/yui",
- foregroundSource: "derp.html",
- backgroundColor: 0xFFFF9900,
- content: "http://localhost/lib/public/testbed.html",
- description: "this is the description",
- configXML: "config.xml",
- name: "wwTest"
-};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/controllerWebView.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/controllerWebView.js b/lib/cordova-blackberry/framework/lib/controllerWebView.js
deleted file mode 100644
index 9c05ebe..0000000
--- a/lib/cordova-blackberry/framework/lib/controllerWebView.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var controllerWebView,
- overlayWebView = require("./overlayWebView"),
- controller,
- invocation,
- utils;
-
-controllerWebView = {
- init: function (config) {
- controller = window.qnx.webplatform.getController();
- invocation = window.qnx.webplatform.getApplication().invocation;
- utils = require('./utils');
- controller.enableWebInspector = config.debugEnabled;
- controller.enableCrossSiteXHR = true;
- controller.visible = false;
- controller.active = false;
- controller.setGeometry(0, 0, screen.width, screen.height);
- controller.setFileSystemSandbox = false;
-
- /* Remote functions that are published to allow communication with
- * the overlay webview, they are called via the RPC bridge
- */
- controller.publishRemoteFunction('webview.setSensitivity', function (args) {
- var sensitivityType = args[0];
- overlayWebView.setSensitivity(sensitivityType);
- });
-
- controller.publishRemoteFunction('webview.notifyContextMenuCancelled', function () {
- overlayWebView.notifyContextMenuCancelled();
- });
- },
-
- setGeometry: function (x, y, width, height) {
- controller.setGeometry(x, y, width, height);
- },
-
- setApplicationOrientation: function (angle) {
- controller.setApplicationOrientation(angle);
- },
-
- notifyApplicationOrientationDone: function () {
- controller.notifyApplicationOrientationDone();
- },
-
- dispatchEvent: function (eventType, args) {
- controller.dispatchEvent(eventType, args);
- }
-};
-
-controllerWebView.__defineGetter__('id', function () {
- return controller.id;
-});
-
-controllerWebView.__defineSetter__('onChildWebViewCreated', function (input) {
- controller.onChildWebViewCreated = input;
-});
-module.exports = controllerWebView;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/event.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/event.js b/lib/cordova-blackberry/framework/lib/event.js
deleted file mode 100644
index 880e6c4..0000000
--- a/lib/cordova-blackberry/framework/lib/event.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var _handlers = {},
- _webview = require("./webview");
-
-module.exports = {
- trigger: function (actionEvent) {
- var args = Array.prototype.slice.call(arguments),
- executeString = "webworks.event.trigger('" + actionEvent + "', '" + escape(encodeURIComponent(JSON.stringify(args.slice(1)))) + "')";
-
- if (_handlers.hasOwnProperty(actionEvent)) {
- _handlers[actionEvent].forEach(function (webview) {
- webview.executeJavaScript(executeString);
- });
- } else {
- //Just dump it in the content webview for consistency
- _webview.executeJavascript(executeString);
- }
- },
-
- add: function (action, webview) {
- var triggerEvent;
-
- if (action) {
- //Use action.event for old extensions that may not have triggerEvent defined
- triggerEvent = action.triggerEvent || action.event;
-
- if (!action.once) {
- action.context.addEventListener(action.event, action.trigger || this.trigger);
- }
-
- //If there are no registered listeners for this event, create an array to hold them
- if (!_handlers.hasOwnProperty(triggerEvent)) {
- _handlers[triggerEvent] = [];
- }
- //If the webview is not in the list of webviews listening to this action then add it
- if (!_handlers[triggerEvent].some(function (handlerWebView) {
- return handlerWebView.id === webview.id;
- })) {
- _handlers[triggerEvent].push(webview);
- }
-
- } else {
- throw "Action is null or undefined";
- }
- },
-
- remove: function (action, webview) {
- if (action) {
- action.context.removeEventListener(action.event, action.trigger || this.trigger);
-
- //Remove the webview from the _handlers
- if (_handlers.hasOwnProperty(action.event)) {
-
- _handlers[action.event] = _handlers[action.event].filter(function (sourceWebview) {
- return sourceWebview.id !== webview.id;
- });
-
- //If the array is empty delete it
- if (_handlers[action.event].length === 0) {
- delete _handlers[action.event];
- }
- }
-
- } else {
- throw "Action is null or undefined";
- }
-
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/events/applicationEvents.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/events/applicationEvents.js b/lib/cordova-blackberry/framework/lib/events/applicationEvents.js
deleted file mode 100644
index 14a8f9e..0000000
--- a/lib/cordova-blackberry/framework/lib/events/applicationEvents.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2010-2011 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module.exports = {
- addEventListener: function (event, trigger) {
- if (event) {
- event = "application." + event;
- window.qnx.webplatform.getApplication().addEventListener(event, trigger);
- } else {
- console.warn("Attempting to register for 'falsey' event: " + event);
- }
- },
- removeEventListener: function (event, trigger) {
- if (event) {
- event = "application." + event;
- window.qnx.webplatform.getApplication().removeEventListener(event, trigger);
- } else {
- console.warn("Attempting to un-register for 'falsey' event: " + event);
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/events/deviceEvents.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/events/deviceEvents.js b/lib/cordova-blackberry/framework/lib/events/deviceEvents.js
deleted file mode 100644
index 939357b..0000000
--- a/lib/cordova-blackberry/framework/lib/events/deviceEvents.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2010-2011 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module.exports = {
- addEventListener: function (event, trigger) {
- if (event) {
- event = "device." + event;
- window.qnx.webplatform.device.addEventListener(event, trigger);
- } else {
- console.warn("Attempting to register for 'falsey' event: " + event);
- }
- },
- removeEventListener: function (event, trigger) {
- if (event) {
- event = "device." + event;
- window.qnx.webplatform.device.removeEventListener(event, trigger);
- } else {
- console.warn("Attempting to un-register for 'falsey' event: " + event);
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/exception.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/exception.js b/lib/cordova-blackberry/framework/lib/exception.js
deleted file mode 100644
index f0a8467..0000000
--- a/lib/cordova-blackberry/framework/lib/exception.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module.exports = {
-
- types: {
- Application: "Application",
- ArgumentLength: "ArgumentLength",
- ArgumentType: "ArgumentType",
- Argument: "Argument",
- NotificationType: "NotificationType",
- NotificationStateType: "NotificationStateType",
- DomObjectNotFound: "DomObjectNotFound",
- MethodNotImplemented: "MethodNotImplemented",
- InvalidState: "InvalidState",
- ApplicationState: "ApplicationState"
- },
-
- handle: function handle(exception, reThrow) {
- reThrow = reThrow || false;
-
- var eMsg = exception.message || "exception caught!",
- msg = eMsg + "\n\n" + (exception.stack || "*no stack provided*") + "\n\n";
-
- console.error(msg);
-
- if (reThrow) {
- throw exception;
- }
- },
-
- raise: function raise(exceptionType, message, customExceptionObject) {
- var obj = customExceptionObject || {
- type: "",
- message: "",
-
- toString: function () {
- var result = this.name + ': "' + this.message + '"';
-
- if (this.stack) {
- result += "\n" + this.stack;
- }
- return result;
- }
- };
-
- message = message || "";
-
- obj.name = exceptionType;
- obj.type = exceptionType;
- // TODO: include the exception objects original message if exists
- obj.message = message;
-
- throw obj;
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/framework.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/framework.js b/lib/cordova-blackberry/framework/lib/framework.js
deleted file mode 100644
index 5de045c..0000000
--- a/lib/cordova-blackberry/framework/lib/framework.js
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var utils = require('./utils'),
- controllerWebView = require('./controllerWebView'),
- webview = require('./webview'),
- overlayWebView = require('./overlayWebView'),
- config = require("./config"),
- appEvents = require("./events/applicationEvents"),
- actionMap = {
- pause: {
- event: "inactive",
- trigger: function () {
- webview.executeJavascript("cordova.fireDocumentEvent('pause')");
- }
- },
- resume: {
- event: "active",
- trigger: function () {
- webview.executeJavascript("cordova.fireDocumentEvent('resume')");
- }
- }
- };
-
-function addEvents() {
- for (var action in actionMap) {
- if (actionMap.hasOwnProperty(action)) {
- appEvents.addEventListener(actionMap[action].event, actionMap[action].trigger);
- }
- }
-}
-
-function removeEvents() {
- for (var action in actionMap) {
- if (actionMap.hasOwnProperty(action)) {
- appEvents.removeEventListener(actionMap[action].event, actionMap[action].trigger);
- }
- }
-}
-
-function showWebInspectorInfo() {
- var port = window.qnx.webplatform.getApplication().webInspectorPort,
- messageObj = {};
-
- qnx.webplatform.device.getNetworkInterfaces(function (networkInfo) {
- var connectedInterface;
-
- utils.forEach(networkInfo, function (info) {
- if (info && !connectedInterface) {
- connectedInterface = info;
- }
- }, this);
-
- messageObj.title = "Web Inspector Enabled";
- if (connectedInterface) {
- messageObj.htmlmessage = "\n ip4: " + connectedInterface.ipv4Address + ":" + port + "<br/> ip6: " + connectedInterface.ipv6Address + ":" + port;
- } else {
- messageObj.message = "";
- }
- messageObj.dialogType = 'JavaScriptAlert';
- overlayWebView.showDialog(messageObj);
- });
-}
-
-var _self = {
- start: function (url) {
- var callback,
- showUrlCallback;
-
- // Set up the controller WebView
- controllerWebView.init(config);
-
- webview.create(function () {
- if (config.enableFlash) {
- //Set webview plugin directory [required for flash]
- webview.setExtraPluginDirectory('/usr/lib/browser/plugins');
-
- //Enable plugins for the webview [required for flash]
- webview.setEnablePlugins(true);
-
- //Enable flash for the childWebViews
- controllerWebView.onChildWebViewCreated = function (child) {
- //Set webview plugin directory [required for flash]
- child.setExtraPluginDirectory('/usr/lib/browser/plugins');
-
- //Enable plugins for the webview [required for flash]
- child.pluginsEnabled = true;
- };
- }
-
- if (!config.enableWebSecurity) {
- webview.enableCrossSiteXHR = true;
- }
-
- if (!config.enablePopupBlocker) {
- qnx.webplatform.nativeCall('webview.setBlockPopups', webview.id, false);
- }
- // Workaround for executeJavascript doing nothing for the first time
-
- webview.executeJavascript("1 + 1");
-
- url = url || config.content;
-
- showUrlCallback = function () {
- overlayWebView.removeEventListener("DocumentLoadFinished", showUrlCallback);
- showUrlCallback = null;
-
- // Start page
- if (url) {
- webview.setURL(url);
- }
- };
-
- overlayWebView.create(function () {
- overlayWebView.addEventListener("DocumentLoadFinished", showUrlCallback);
-
- overlayWebView.setURL("local:///chrome/ui.html");
- overlayWebView.renderContextMenuFor(webview);
- overlayWebView.handleDialogFor(webview);
- controllerWebView.dispatchEvent('ui.init', null);
- webview.setUIWebViewObj(overlayWebView.getWebViewObj());
- if (config.enableChildWebView) {
- overlayWebView.bindAppWebViewToChildWebViewControls(webview);
- } else {
- webview.onChildWindowOpen = function (data) {
- var parsedData = JSON.parse(data);
- utils.invokeInBrowser(parsedData.url);
- };
- }
- if (config.enableFormControl) {
- overlayWebView.getWebViewObj().formcontrol.subscribeTo(webview);
- }
- });
- },
- {
- debugEnabled : config.debugEnabled
- });
-
- addEvents();
-
- //if debugging is enabled, show the IP and port for webinspector
- if (config.debugEnabled) {
- callback = function () {
- showWebInspectorInfo();
-
- //Remove listener. Alert should only be shown once.
- webview.removeEventListener("DocumentLoadFinished", callback);
- };
-
- webview.addEventListener("DocumentLoadFinished", callback);
- }
- },
- stop: function () {
- removeEvents();
- webview.destroy();
- }
-};
-
-module.exports = _self;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/jnext.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/jnext.js b/lib/cordova-blackberry/framework/lib/jnext.js
deleted file mode 100755
index d0e4d79..0000000
--- a/lib/cordova-blackberry/framework/lib/jnext.js
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*global objJSExt */
-
-function JNEXT_() {
- var self = this;
- var m_bFirstRequire = true;
-
- self.m_arEvents = {};
-
- self.onPageLoad = function() {
- };
-
- self.attachToDOM = function() {
- // Make sure JNEXT onPageLoad is called when page load
- // completes without damaging existing onLoad handlers
- var prevOnLoad = window.onload;
- if( typeof window.onload != 'function') {
- window.onload = self.onPageLoad;
- } else {
- window.onload = function() {
- if(prevOnLoad) {
- prevOnLoad();
- }
-
- self.onPageLoad();
- };
- }
-
- // Unobtrusively add the JNEXT plugin or ActiveX to the DOM
- var objBody = document.getElementsByTagName("body")[0];
- var objDiv = document.createElement('div');
- var strHTML;
-
- if(window.ActiveXObject) {
- strHTML = '<object id="objJSExt" width="0" height="0" classid="CLSID:C802F39D-BF85-427a-A334-77E501DB62E9" codebase="jnext.ocx"></object>';
- strHTML += '<script language="JavaScript" for="objJSExt" EVENT="Js2nEvent( strEvent )">JNEXT.processEvent(strEvent)</script>';
- } else {
- var strAddSrc = "";
- if(navigator.userAgent.indexOf("Safari") != -1 && navigator.userAgent.indexOf("Windows") != -1) {
- // This hack required on Safari for Windows
- strAddSrc = 'src="./jnext/safari.foo"';
- }
- strHTML = '<embed id="objJSExt" ' + strAddSrc + ' type="application/jnext-scriptable-plugin" width="0" height="0">';
- }
-
- objDiv.innerHTML = strHTML;
- objBody.appendChild(objDiv);
- };
-
- self.getosname = function() {
- return objJSExt.sendCmd("osname");
- };
-
- self.require = function(strLibrary) {
- // Load a required JNEXT plugin
- var strCmd;
- var strVal;
- var arParams;
-
- if(m_bFirstRequire) {
- strCmd = "userAgent " + navigator.userAgent;
- strVal = objJSExt.sendCmd(strCmd);
- arParams = strVal.split(" ");
- if(arParams[0] != "Ok") {
- alert("userAgent " + strVal);
- return false;
- }
- self.m_bFirstRequire = false;
- }
- strCmd = "Require " + strLibrary;
- strVal = objJSExt.sendCmd(strCmd);
- arParams = strVal.split(" ");
- if(arParams[0] != "Ok") {
- alert("Require " + strVal);
- return false;
- }
-
- return true;
- };
-
- self.createObject = function(strObjName) {
- // Create an instance of a native object
- var strCmd;
- var strVal;
- var arParams;
- strVal = objJSExt.sendCmd("CreateObject " + strObjName);
- arParams = strVal.split(" ");
- if(arParams[0] != "Ok") {
- alert("CreateObject: " + strVal);
- return "";
- }
- return arParams[1];
- };
-
- self.invoke = function(strObjId, strMethod, strParams) {
- // Invoke a method of a given instance of a native object
- var strCmd = "InvokeMethod " + strObjId + " " + strMethod;
-
- if( typeof (strParams) != "undefined") {
- strCmd += " " + strParams;
- }
-
- return objJSExt.sendCmd(strCmd);
- };
-
- self.registerEvents = function(objNotify) {
- var strId = objNotify.getId();
- self.m_arEvents[strId] = objNotify;
- };
-
- self.unregisterEvents = function(objNotify) {
- var strId = objNotify.getId();
- delete self.m_arEvents[strId];
- };
-
- self.processEvent = function(strNativeEvt) {
- // Process an event received from native code. The event
- // containes the target JavaScript object id and the
- // relevant parameters.
-
- var arParams = strNativeEvt.split(" ");
- var strObjId = arParams[0];
- var strEvent = strNativeEvt.substring(strObjId.length + 1);
-
- var objNotify = self.m_arEvents[strObjId];
- if( typeof (objNotify) == 'undefined') {
- alert("Warning: No object with Id " + strId + " found for event " + strEvent);
- return;
- }
-
- // This will now be handled by the appropriate JavaScript
- // JNEXT extension object
- objNotify.onEvent(strEvent);
- };
-
- self.ajaxGet = function(strUrl, id) {
- var req = false;
- if(window.ActiveXObject) {
- try {
- req = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- req = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (ex) {
- }
- }
- } else if(window.XMLHttpRequest) {
- req = new XMLHttpRequest();
- } else {
- return false;
- }
-
- req.onreadystatechange = function() {
- if(req.readyState == 4 && (req.status == 200 || window.location.href.indexOf("http") == -1)) {
- self.onAjaxRecv(req.responseText);
- }
- };
-
- req.open('GET', strUrl, true);
- req.send(null);
- };
-
- self.onAjaxRecv = function(strContent) {
- alert(strContent);
- };
-
- self.attachToDOM();
-}
-
-window.JNEXT = new JNEXT_();
-module.exports = JNEXT;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/overlayWebView.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/overlayWebView.js b/lib/cordova-blackberry/framework/lib/overlayWebView.js
deleted file mode 100644
index a2bba69..0000000
--- a/lib/cordova-blackberry/framework/lib/overlayWebView.js
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var CHROME_HEIGHT = 0,
- webview,
- _webviewObj;
-
-webview =
- {
-
- create: function (ready, configSettings) {
- _webviewObj = window.qnx.webplatform.createUIWebView(function () {
-
- _webviewObj.visible = true;
- _webviewObj.active = true;
- _webviewObj.zOrder = 2;
- _webviewObj.enableCrossSiteXHR = true;
- _webviewObj.setGeometry(0, 0, screen.width, screen.height);
- _webviewObj.addEventListener("DocumentLoadFinished", function () {
- _webviewObj.default.setDefaultFont();
- _webviewObj.visible = true;
- });
-
- _webviewObj.allowRpc = true;
- _webviewObj.backgroundColor = 0x00FFFFFF;
- _webviewObj.sensitivity = "SensitivityTest";
- _webviewObj.devicePixelRatio = 1;
- _webviewObj.allowQnxObject = true;
-
- if (ready && typeof ready === 'function') {
- ready();
- }
-
- window.qnx.webplatform.getController().dispatchEvent("overlayWebView.initialized", [_webviewObj]);
-
- });
- },
-
- destroy: function () {
- _webviewObj.destroy();
- },
-
- setURL: function (url) {
- _webviewObj.url = url;
- },
-
- setGeometry: function (x, y, width, height) {
- _webviewObj.setGeometry(x, y, width, height);
- },
-
- setSensitivity : function (sensitivity) {
- _webviewObj.sensitivity = sensitivity;
- },
-
- setApplicationOrientation: function (angle) {
- _webviewObj.setApplicationOrientation(angle);
- },
-
- notifyApplicationOrientationDone: function () {
- _webviewObj.notifyApplicationOrientationDone();
- },
-
- executeJavascript: function (js) {
- _webviewObj.executeJavaScript(js);
- },
-
- windowGroup: function () {
- return _webviewObj.windowGroup;
- },
-
- notifyContextMenuCancelled: function () {
- _webviewObj.notifyContextMenuCancelled();
- },
-
- bindAppWebViewToChildWebViewControls: function (appWebView) {
- if (_webviewObj && _webviewObj.childwebviewcontrols) {
- _webviewObj.childwebviewcontrols.subscribeTo(appWebView);
- }
- },
-
- renderContextMenuFor: function (targetWebView) {
- return _webviewObj.contextMenu.subscribeTo(targetWebView);
- },
-
- handleDialogFor: function (targetWebView) {
- return _webviewObj.dialog.subscribeTo(targetWebView);
- },
-
- showDialog: function (description, callback) {
- return _webviewObj.dialog.show(description, callback);
- },
-
- getWebViewObj: function (webview) {
- return _webviewObj;
- },
-
- addEventListener: function (eventName, callback) {
- _webviewObj.addEventListener(eventName, callback);
- },
-
- removeEventListener: function (eventName, callback) {
- _webviewObj.removeEventListener(eventName, callback);
- },
-
- showToast : function (message, options) {
- return _webviewObj.toast.show(message, options);
- },
-
- showInvocationList: function (request, title, success, error) {
- _webviewObj.invocationlist.show(request, title, success, error);
- }
-};
-
-webview.__defineGetter__('id', function () {
- if (_webviewObj) {
- return _webviewObj.id;
- }
-});
-
-webview.__defineGetter__('zOrder', function () {
- return _webviewObj.zOrder;
-});
-
-webview.__defineGetter__('contextMenu', function () {
- if (_webviewObj) {
- return _webviewObj.contextMenu;
- }
-});
-
-module.exports = webview;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/plugins/default.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/plugins/default.js b/lib/cordova-blackberry/framework/lib/plugins/default.js
deleted file mode 100644
index 8347917..0000000
--- a/lib/cordova-blackberry/framework/lib/plugins/default.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2010-2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var Whitelist = require("../policy/whitelist").Whitelist,
- whitelist = new Whitelist();
-
-module.exports = {
-
- exec: function (request, succ, fail, args, env) {
- var extPath = "plugin/" + request.params.ext + "/index",
- requestObj = {
- extension: null,
- method: null,
- getExtension: function () {
- if (frameworkModules.indexOf(extPath + ".js") !== -1) {
- this.extension = require("../utils").loadModule("../" + extPath);
- return requestObj;
- } else {
- throw {code: 404, msg: "Extension " + request.params.ext + " not found"};
- }
- },
- getMethod: function () {
- var methodParts = request.params.method ? request.params.method.split('/') : [request.params.method],
- extMethod;
-
- try {
- extMethod = this.extension[methodParts.shift()];
- extMethod = methodParts.reduce(function (previous, current) {
- if (previous[current]) {
- return previous[current];
- } else {
- throw {code: 404, msg: "Method " + request.params.method + " for " + request.params.ext + " not found"};
- }
- }, extMethod);
-
- if (extMethod && typeof extMethod === "function") {
- this.method = extMethod;
- return requestObj;
- } else {
- throw {code: 404, msg: "Method " + request.params.method + " for " + request.params.ext + " not found"};
- }
- } catch (e) {
- throw {code: 404, msg: "Method " + request.params.method + " for " + request.params.ext + " not found"};
- }
- },
- exec: function () {
- this.method(succ, fail, args, env);
- }
- };
-
- try {
- requestObj.getExtension().getMethod().exec();
- } catch (e) {
- console.warn(e.msg);
- fail(-1, e.msg, e.code);
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/plugins/event.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/plugins/event.js b/lib/cordova-blackberry/framework/lib/plugins/event.js
deleted file mode 100644
index 441bc70..0000000
--- a/lib/cordova-blackberry/framework/lib/plugins/event.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2010-2011 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var _event = require("../../lib/event"),
- ONCE_EVENT_ERROR = "Error occured while adding once event listener.",
- ERROR_ID = -1;
-
-module.exports = {
- once: function (request, success, fail, args, env) {
- try {
- var eventName = decodeURIComponent(args.eventName).replace(/\"/g, ""),
- action = {
- once: true,
- event: eventName
- };
-
- _event.add(action, env.webview);
-
- if (success) {
- success();
- }
- }
- catch (e) {
- if (fail) {
- fail(ERROR_ID, ONCE_EVENT_ERROR);
- }
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/policy/folderAccess.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/policy/folderAccess.js b/lib/cordova-blackberry/framework/lib/policy/folderAccess.js
deleted file mode 100644
index 5cd5690..0000000
--- a/lib/cordova-blackberry/framework/lib/policy/folderAccess.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2010-2011 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var util = require("../utils");
-
-// Removes the start and end slashes from the path
-function _trimSurroundingSlashes(path) {
- // Trim starting slash
- if (util.startsWith(path, "/")) {
- path = path.substr(1);
- }
-
- // Trim ending slash
- if (util.endsWith(path, "/")) {
- path = path.substr(0, path.length - 1);
- }
-
- return path;
-}
-
-// Determines the depth of the given path
-// Folder path must not include the scheme or the host
-function _determineDepth(folderPath) {
- var depthCount = 0;
-
- // Replace all backslashes with forward slash
- folderPath = folderPath.replace("\\", "/");
-
- // Special case: "/" is the given path
- if (folderPath === "/") {
- return 0;
- }
-
- folderPath = _trimSurroundingSlashes(folderPath);
-
- // Count slashes remaining
- while (folderPath.indexOf("/") !== -1) {
- depthCount = depthCount + 1;
-
- // Add 1 to skip the slash
- folderPath = folderPath.substring(folderPath.indexOf("/") + 1);
- }
-
- // Add one more for the remaining folder
- depthCount += 1;
-
- return depthCount;
-}
-
-// Parse a folder path up to the desired depth
-function _getPath(folderPath, desiredDepth) {
- var depthCount = 0, builtPath = "";
-
- // Special case: Desired depth is 0
- if (desiredDepth === 0) {
- return "/";
- }
-
- // Replace all backslashes with forward slash
- folderPath = folderPath.replace("\\", "/");
-
- folderPath = _trimSurroundingSlashes(folderPath);
-
- // Count slashes remaining
- while (depthCount < desiredDepth) {
- depthCount += 1;
-
- // Add 1 to skip the slash
- builtPath += "/" + folderPath.substring(0, folderPath.indexOf('/'));
- folderPath = folderPath.substring(folderPath.indexOf('/') + 1);
- }
-
- return builtPath;
-}
-
-function WebFolderAccessManager() {
- this._pathCollection = {};
- this._maxPathLength = 0;
-}
-
-WebFolderAccessManager.prototype.addAccess = function (folderPath, access) {
- if (!folderPath) {
- folderPath = "/";
- }
-
- // Trim surrounding slashes for consistency
- // The root "/" is a special case that does not need this trimming
- if (folderPath !== "/") {
- folderPath = "/" + _trimSurroundingSlashes(folderPath);
- }
-
- folderPath = folderPath.toLowerCase();
-
- this._pathCollection[folderPath] = access;
-
- // Determine the depth of the path
- this._maxPathLength = Math.max(this._maxPathLength, _determineDepth(folderPath));
-};
-
-WebFolderAccessManager.prototype.getAccess = function (folderPath) {
- var depth = _determineDepth(folderPath);
- return this.getAccessRecursively(folderPath, depth);
-};
-
-WebFolderAccessManager.prototype.fetchAccess = function (folderPath) {
- var queryIndex, folderPathWildcard;
-
- if (!this._pathCollection.hasOwnProperty(folderPath)) {
- // If there isn't an exact match and folderPath contains query string,
- // check if the path collection contains an access with the same folderPath
- // but with wildcard query
- if ((queryIndex = folderPath.indexOf("?")) > -1) {
- folderPathWildcard = folderPath.slice(0, queryIndex + 1) + "*";
-
- if (this._pathCollection.hasOwnProperty(folderPathWildcard)) {
- return this._pathCollection[folderPathWildcard];
- }
- }
-
- return null;
- } else {
- return this._pathCollection[folderPath];
- }
-};
-
-WebFolderAccessManager.prototype.getAccessRecursively = function (folderPath, pathLength) {
- var fetchedAccess,
- newPathLength,
- newPath;
-
- if (!folderPath) {
- return null;
- }
-
- folderPath = folderPath.toLowerCase();
-
- if (!!(fetchedAccess = this.fetchAccess(folderPath))) {
- return fetchedAccess;
- } else {
- // Truncate the end portion of the path and try again
- newPathLength = Math.min(this._maxPathLength, pathLength - 1);
- newPath = _getPath(folderPath, newPathLength);
-
- return this.getAccessRecursively(newPath, newPathLength);
- }
-};
-
-function WebFolderAccess() {
- this._mgr = new WebFolderAccessManager();
-}
-
-// folderPath - folder path must not include the scheme or the host
-WebFolderAccess.prototype.addAccess = function (folderPath, access) {
- this._mgr.addAccess(folderPath, access);
-};
-
-// folderPath - folder path must not include the scheme or the host
-WebFolderAccess.prototype.getAccess = function (folderPath) {
- return this._mgr.getAccess(folderPath);
-};
-
-exports.WebFolderAccess = WebFolderAccess;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/policy/webkitOriginAccess.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/policy/webkitOriginAccess.js b/lib/cordova-blackberry/framework/lib/policy/webkitOriginAccess.js
deleted file mode 100644
index 84adb49..0000000
--- a/lib/cordova-blackberry/framework/lib/policy/webkitOriginAccess.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var config = require('./../config'),
- utils = require('./../utils'),
- Whitelist = require('./whitelist').Whitelist,
- LOCAL_URI = "local://",
- FILE_URI = "file://",
- WW_URI = utils.getURIPrefix(),
- _domains = [
- {
- url: LOCAL_URI,
- allowSubDomains: true
- }
- ],
- _webviews = [],
- _isInitialized = false,
- _whitelist = new Whitelist();
-
-function addOriginAccessWhitelistEntry(webview, source, destination, allowSubDomains) {
- webview.addOriginAccessWhitelistEntry(source, destination, !!allowSubDomains);
-}
-
-function addDomain(url, allowSubDomains) {
- var parsedUri = utils.parseUri(url);
-
- allowSubDomains = !!allowSubDomains;
-
- if (utils.isLocalURI(parsedUri)) {
- url = LOCAL_URI;
- } else if (utils.isFileURI(parsedUri)) {
- url = FILE_URI;
- } else {
- url = parsedUri.source;
- }
-
- if (_whitelist.isAccessAllowed(url) && !_domains.some(function (domain) {
- return domain.url === url;
- })) {
- _webviews.forEach(function (webview) {
- addOriginAccessWhitelistEntry(webview, url, WW_URI, true);
-
- _domains.forEach(function (domain) {
- addOriginAccessWhitelistEntry(webview, domain.url, url, allowSubDomains);
- addOriginAccessWhitelistEntry(webview, url, domain.url, domain.allowSubDomains);
- });
-
- });
-
- _domains.push({
- url: url,
- allowSubDomains: allowSubDomains
- });
- }
-}
-
-function initializeDomains() {
- var accessElements = config.accessList;
-
- accessElements.forEach(function (element, index, array) {
- var uri = (element.uri === 'WIDGET_LOCAL' ? LOCAL_URI : element.uri);
- addDomain(uri, !!element.allowSubDomain);
- });
-}
-
-function initializaWebview(webview) {
- //Always allow file access from local and let the OS deal with permissions
- addOriginAccessWhitelistEntry(webview, LOCAL_URI, FILE_URI, true);
- addOriginAccessWhitelistEntry(webview, FILE_URI, LOCAL_URI, true);
- //Always allow LOCAL access to URIs
- addOriginAccessWhitelistEntry(webview, LOCAL_URI, WW_URI, true);
-
- _domains.forEach(function (domain, domainIndex, domainArray) {
- var i,
- nextDomain;
-
- if (domain.uri !== LOCAL_URI) {
- addOriginAccessWhitelistEntry(webview, domain.url, WW_URI, true);
- }
-
- for (i = domainIndex + 1; i < domainArray.length; i++) {
- nextDomain = domainArray[i];
- addOriginAccessWhitelistEntry(webview, domain.url, nextDomain.url, nextDomain.allowSubDomains);
- addOriginAccessWhitelistEntry(webview, nextDomain.url, domain.url, domain.allowSubDomains);
- }
- });
-
-}
-
-module.exports = {
-
- addWebView: function (webview) {
- if (_webviews.indexOf(webview) === -1) {
- _webviews.push(webview);
- initializaWebview(webview);
- if (!_isInitialized) {
- initializeDomains();
- _isInitialized = true;
- }
- }
- },
-
- addOriginAccess: function (origin, allowSubDomains) {
- if (!_isInitialized) {
- initializeDomains();
- _isInitialized = true;
- }
- addDomain(origin, allowSubDomains);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/policy/whitelist.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/policy/whitelist.js b/lib/cordova-blackberry/framework/lib/policy/whitelist.js
deleted file mode 100644
index dcfbc3c..0000000
--- a/lib/cordova-blackberry/framework/lib/policy/whitelist.js
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Copyright 2010-2011 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var WebFolderAccess = require("./folderAccess").WebFolderAccess,
- util = require("../utils");
-
-function _isLocalAccess(access) {
- return access && access.uri === "WIDGET_LOCAL";
-}
-
-function _isMatch(access, requestURI) {
- // Look for local first
- if (_isLocalAccess(access)) {
- // Local access always allowed
- //THIS USED TO RETURN TRUE FOR FILE ACCESS
- //I HAVE TURNED IT OFF BECAUSE IT MAKES NO SENSE THAT LOCAL ACCESS ALWAYS MATCHES FILE ACCESS
- return (util.isLocalURI(requestURI));
- } else if (util.isDataURI(requestURI)) {
- // Check for data url
- // data urls are allowed
- return true;
- }
-
- // Based on widgets 1.0 (access control)
- // http://www.w3.org/TR/2009/WD-widgets-access-20090618/#rfc3987
- var refURI = util.parseUri(access.uri),
- allowSub = access.allowSubDomain;
-
- if (!requestURI.path) {
- requestURI.path = "/";
- }
-
- // Start comparison based on widget spec.
- // 1. Compare scheme
- if (refURI.scheme.toLowerCase() !== requestURI.scheme.toLowerCase()) {
- return false;
- }
-
- // 2. Compare host - if subdoman is false, host must match exactly
- // (referenceURI MUST HAVE host specified - not null.)
- // Special Case: Ignore this condition if we are dealing with file://
- if (!requestURI.authority && !util.isFileURI(requestURI)) {
- return false;
- }
-
- if (!allowSub && refURI.host.toLowerCase() !== requestURI.host.toLowerCase()) {
- return false;
- }
-
- // 3. Compare host - if subdomain is true, check for subdomain or match
- if (allowSub && !util.endsWith(requestURI.host.toLowerCase(), "." + refURI.host.toLowerCase()) &&
- requestURI.host.toLowerCase() !== refURI.host.toLowerCase()) {
- return false;
- }
-
- // 4. Compare port
- if (refURI.port && refURI.port !== requestURI.port) {
- return false;
- }
-
- // 5. Compare path+query
- if (!util.startsWith(requestURI.path.toLowerCase(), refURI.path.toLowerCase()) && refURI.query !== "*") {
- return false;
- }
-
- return true;
-}
-
-function _getAccessForPathAndQuery(folderAccess, path, query) {
- if (folderAccess) {
- if (!query) {
- return folderAccess.getAccess(path);
- } else {
- return folderAccess.getAccess(path + "?" + query);
- }
- }
-
- return null;
-}
-
-function AccessManager(config) {
- config = config || require("../config");
-
- this._accessList = config.accessList;
- this._hasGlobalAccess = config.hasMultiAccess;
- this._authorityCollection = null;
- this._localAccess = null;
-}
-
-AccessManager.prototype.getFolderAccess = function (scheme, authority) {
- var key = scheme + "://" + authority;
- key = key.toLowerCase();
-
- if (this._authorityCollection.hasOwnProperty(key)) {
- return this._authorityCollection[key];
- }
-
- return null;
-};
-
-AccessManager.prototype.putFolderAccess = function (scheme, authority, folderAccess) {
- var key = scheme + "://" + authority;
- key = key.toLowerCase();
- this._authorityCollection[key] = folderAccess;
-};
-
-AccessManager.prototype.initializeAuthCollection = function () {
- var folderAccess, currentURI, that = this;
-
- if (!this._authorityCollection) {
- this._authorityCollection = {};
-
- if (this._accessList) {
- this._accessList.forEach(function (access) {
- if (_isLocalAccess(access)) {
- that._localAccess = access;
- } else {
- currentURI = util.parseUri(access.uri);
-
- // Check the authority collection to see if the authority item
- // we want already exists
- folderAccess = that.getFolderAccess(currentURI.scheme, currentURI.authority) || new WebFolderAccess();
-
- // Add folder path access to the authority item
- if (!currentURI.query) {
- folderAccess.addAccess(currentURI.path, access);
- } else {
- folderAccess.addAccess(currentURI.path + "?" + currentURI.query, access);
- }
-
- that.putFolderAccess(currentURI.scheme, currentURI.authority, folderAccess);
- }
- });
- }
- }
-};
-
-AccessManager.prototype.authorityCheck = function (port, scheme, authority) {
- var originalAuthority = authority;
-
- if (port) {
- // If authority has a specific port, and the collection does not have an access matches
- // the exact authority, strip port from authority to see if there is a match
- if (!this.getFolderAccess(scheme, authority)) {
- authority = authority.slice(0, authority.lastIndexOf(":"));
- authority = this.authorityCheck("", scheme, authority);
- }
-
- //If no successful match was found without the port, reset the authority and try with it
- if (!this.getFolderAccess(scheme, authority)) {
- authority = originalAuthority;
- }
- }
-
- if (authority.indexOf(".") === -1) {
- // If authority is computer name, must have exact match in collection
- if (!this.getFolderAccess(scheme, authority)) {
- return "";
- }
-
- return authority;
- }
-
- while (authority && !this.getFolderAccess(scheme, authority)) {
- if (authority.indexOf(".") === -1) {
- return "";
- }
- authority = authority.substring(authority.indexOf(".") + 1);
- }
-
- return authority;
-};
-
-AccessManager.prototype.getFromFolderAccess = function (folderAccess, requestURI) {
- var fetchedAccess = null,
- scheme = requestURI.scheme,
- authority = requestURI.authority,
- path = requestURI.path,
- query = requestURI.query,
- prevAuthority;
-
- if (!path) {
- fetchedAccess = folderAccess.getAccess("/");
- } else {
- fetchedAccess = _getAccessForPathAndQuery(folderAccess, path, query);
- }
-
- // Make sure we've got the right one
- while (!fetchedAccess || !_isMatch(fetchedAccess, requestURI)) {
- // There was an auth url that matched, but didnt match the folder structure
- // Try the next level up
- prevAuthority = authority;
- authority = authority.substring(authority.indexOf(".") + 1);
- //If authority hasn't changed, then this loop will continue endlessly because nothing else has changed
- //This will happen when an element has the same authority but no folder access.
- if (prevAuthority === authority) {
- return null;
- }
-
- // Check for an authority string that has an existing key
- authority = this.authorityCheck(requestURI.port, scheme, authority);
- if (!authority) {
- return null;
- }
-
- // Retrieve access set for the specified authority
- folderAccess = this.getFolderAccess(scheme, authority);
-
- // Special case: no access element was found for a file protocol request.
- // This is added since file protocol was allowed through the above check
- if (scheme === "file" && !folderAccess) {
- return null;
- }
-
- fetchedAccess = _getAccessForPathAndQuery(folderAccess, path, query);
- }
-
- return fetchedAccess;
-};
-
-AccessManager.prototype.getAccessByUrl = function (url) {
- var requestURI = util.parseUri(url),
- authority = requestURI.authority,
- scheme = requestURI.scheme,
- folderAccess,
- fetchedAccess;
-
- if (util.isAbsoluteURI(requestURI)) {
- // Initialize authority collection if it does not yet exist
- this.initializeAuthCollection();
-
- // Start with the full authority path and check if an access exists for that path
- // If it does not exist, remove the first section of the authority path and try again
-
- // Check for an authority string that has an existing key
- // Special case: Allow file, and local protocol to proceed without an authority
- authority = this.authorityCheck(requestURI.port, scheme, authority);
- if (!authority && !(scheme === "file" || scheme === "local" || scheme === "data")) {
- return null;
- }
- // Retrieve access set for the specified authority
- folderAccess = this.getFolderAccess(scheme, authority);
-
- // Special case: no access was found for a file protocol request
- // This is added since file protocol was allowed through the above check
- if (scheme === "file" && !folderAccess) {
- return null;
- } else if (scheme === "local" && !folderAccess) {
- // If no access element is found with local URI, use local access for this request
- return this._localAccess;
- } else if (scheme === "data") {
- // Always allow data-uris
- return true;
- }
-
- fetchedAccess = this.getFromFolderAccess(folderAccess, requestURI);
-
- if (fetchedAccess) {
- return fetchedAccess;
- } else if (this._localAccess && _isMatch(this._localAccess, requestURI)) {
- // If we cannot find a more specific access for this local URI, use local access
- return this._localAccess;
- } else if (folderAccess && _isMatch(folderAccess, requestURI)) {
- return folderAccess;
- }
- }
-
- return null;
-};
-
-AccessManager.prototype.hasGlobalAccess = function () {
- return this._hasGlobalAccess;
-};
-
-function Whitelist(config) {
- this._mgr = new AccessManager(config);
-}
-
-Whitelist.prototype.getFeaturesForUrl = function (url) {
- var access = this._mgr.getAccessByUrl(url),
- featureIds = [];
-
- if (access && access.features) {
- access.features.forEach(function (elem) {
- featureIds.push(elem.id);
- });
- }
-
- return featureIds;
-};
-
-Whitelist.prototype.isFeatureAllowed = function (url, feature) {
- var features = this.getFeaturesForUrl(url);
-
- return !!features && features.reduce(function (found, current) {
- return found || current === feature;
- }, false);
-};
-
-Whitelist.prototype.isAccessAllowed = function (url, isXHR) {
- return (this._mgr.hasGlobalAccess() && !isXHR) || !!this._mgr.getAccessByUrl(url);
-};
-
-exports.Whitelist = Whitelist;
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/framework/lib/server.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/framework/lib/server.js b/lib/cordova-blackberry/framework/lib/server.js
deleted file mode 100644
index 15b95b0..0000000
--- a/lib/cordova-blackberry/framework/lib/server.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2012 Research In Motion Limited.
- *
- * Licensed 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 KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var DEFAULT_SERVICE = "default",
- DEFAULT_ACTION = "exec";
-
-function rebuildRequest(req) {
- var originalURL = req.params.service + "/" +
- req.params.action +
- (req.params.ext ? "/" + req.params.ext : "") +
- (req.params.method ? "/" + req.params.method : "") +
- (req.params.args ? "?" + req.params.args : ""),
- tokens = originalURL.split('/'),
- //Handle the case where the method is multi-level
- finalToken = (tokens[1] && tokens.length > 2) ? tokens.slice(1).join('/') : tokens[1],
- args = null;
-
- // set args
- if (finalToken && finalToken.indexOf("?") >= 0) {
- // Re-split args
- args = finalToken.split("?")[1];
- }
-
- return {
- params : {
- service : DEFAULT_SERVICE,
- action : DEFAULT_ACTION,
- ext : tokens[0],
- method : (finalToken && finalToken.indexOf("?") >= 0) ? finalToken.split("?")[0] : finalToken,
- args : args
- },
- body : req.body,
- origin : req.origin
- };
-}
-
-function parseArgs(req) {
- var args = null,
- params;
- // set args
- if (req.params.args && typeof req.params.args === "string") {
- // GET querystring to json
- params = req.params.args.split("&");
- if (params) {
- args = {};
- params.forEach(function (param) {
- var parts = param.split("=");
- args[parts[0]] = parts[1];
- });
- }
- } else {
- // POST body to json
- if (req.body) {
- args = JSON.parse(req.body);
- }
- }
- req.params.args = args;
-}
-
-module.exports = {
- handle: function (req, res, sourceWebview, config) {
- try {
- var pluginName = "lib/plugins/" + req.params.service,
- plugin;
-
- if (frameworkModules.indexOf(pluginName + ".js") === -1) {
- pluginName = "lib/plugins/" + DEFAULT_SERVICE;
- req = rebuildRequest(req);
- }
-
- parseArgs(req);
-
- //Updating because some versions of node only work with relative paths
- pluginName = pluginName.replace('lib', '.');
-
- plugin = require("./utils").loadModule(pluginName);
-
- plugin[req.params.action](req,
- function (result) {
- res.send(200, encodeURIComponent(JSON.stringify({
- code: 42,
- data: result
- })));
- },
- function (code, error, httpCode) {
- if (!httpCode) {
- httpCode = 200;
- }
-
- res.send(httpCode, encodeURIComponent(JSON.stringify({
- code: Math.abs(code) * -1 || -1,
- data: null,
- msg: error
- })));
- },
- req.params.args,
- {
- "request": req,
- "response": res,
- "webview": sourceWebview,
- "config": config
- });
- } catch (e) {
- console.error(e);
- res.send(404, "can't find the stuff");
- }
- }
-};