CB-7695 Fix InAppBrowser injectScriptFile for Windows 8.1 / Windows Phone 8.1
Changed injects' paths to include parent folder Used getFileFromApplicationUriAsync
This commit is contained in:
parent
d2eaa089f8
commit
71b43d39a4
@ -25,7 +25,8 @@
|
|||||||
|
|
||||||
|
|
||||||
var cordova = require('cordova'),
|
var cordova = require('cordova'),
|
||||||
channel = require('cordova/channel');
|
channel = require('cordova/channel'),
|
||||||
|
urlutil = require('cordova/urlutil');
|
||||||
|
|
||||||
var browserWrap,
|
var browserWrap,
|
||||||
popup;
|
popup;
|
||||||
@ -142,16 +143,24 @@ var IAB = {
|
|||||||
op.start();
|
op.start();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
injectScriptFile: function (win, fail, args) {
|
injectScriptFile: function (win, fail, args) {
|
||||||
var file = args[0],
|
var filePath = args[0],
|
||||||
hasCallback = args[1];
|
hasCallback = args[1];
|
||||||
|
|
||||||
|
if (!!filePath) {
|
||||||
|
filePath = urlutil.makeAbsolute(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
if (isWebViewAvailable && browserWrap && popup) {
|
if (isWebViewAvailable && browserWrap && popup) {
|
||||||
Windows.Storage.FileIO.readTextAsync(file).done(function (code) {
|
var uri = new Windows.Foundation.Uri(filePath);
|
||||||
var op = popup.invokeScriptAsync("eval", code);
|
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done(function (file) {
|
||||||
op.oncomplete = function () { hasCallback && win([]); };
|
Windows.Storage.FileIO.readTextAsync(file).done(function (code) {
|
||||||
op.onerror = function () { };
|
var op = popup.invokeScriptAsync("eval", code);
|
||||||
op.start();
|
op.oncomplete = function () { hasCallback && win([]); };
|
||||||
|
op.onerror = function () { };
|
||||||
|
op.start();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var cordova = require('cordova');
|
||||||
|
var isWindows = cordova.platformId == 'windows';
|
||||||
|
|
||||||
window.alert = window.alert || navigator.notification.alert;
|
window.alert = window.alert || navigator.notification.alert;
|
||||||
|
|
||||||
exports.defineManualTests = function (contentEl, createActionButton) {
|
exports.defineManualTests = function (contentEl, createActionButton) {
|
||||||
@ -306,8 +309,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
|||||||
var localhtml = basePath + 'local.html',
|
var localhtml = basePath + 'local.html',
|
||||||
localpdf = basePath + 'local.pdf',
|
localpdf = basePath + 'local.pdf',
|
||||||
injecthtml = basePath + 'inject.html',
|
injecthtml = basePath + 'inject.html',
|
||||||
injectjs = 'inject.js',
|
injectjs = isWindows ? basePath + 'inject.js' : 'inject.js',
|
||||||
injectcss = 'inject.css',
|
injectcss = isWindows ? basePath + 'inject.css' : 'inject.css',
|
||||||
videohtml = basePath + 'video.html';
|
videohtml = basePath + 'video.html';
|
||||||
|
|
||||||
//Local
|
//Local
|
||||||
|
Loading…
Reference in New Issue
Block a user