From d842693889057f5d3fe209f6f7a443015df28f22 Mon Sep 17 00:00:00 2001 From: daserge Date: Wed, 18 Jan 2017 17:42:55 +0300 Subject: [PATCH] CB-12364 [Windows] Inappbrowser inject file manual tests are not working --- src/windows/InAppBrowserProxy.js | 6 ++++-- tests/tests.js | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/windows/InAppBrowserProxy.js b/src/windows/InAppBrowserProxy.js index 2ce8819..dec91db 100644 --- a/src/windows/InAppBrowserProxy.js +++ b/src/windows/InAppBrowserProxy.js @@ -313,7 +313,8 @@ var IAB = { } if (isWebViewAvailable && browserWrap && popup) { - var uri = new Windows.Foundation.Uri(filePath); + // CB-12364 getFileFromApplicationUriAsync does not support ms-appx-web + var uri = new Windows.Foundation.Uri(filePath.replace('ms-appx-web:', 'ms-appx:')); Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done(function (file) { Windows.Storage.FileIO.readTextAsync(file).done(function (code) { var op = popup.invokeScriptAsync("eval", code); @@ -350,7 +351,8 @@ var IAB = { filePath = filePath && urlutil.makeAbsolute(filePath); if (isWebViewAvailable && browserWrap && popup) { - var uri = new Windows.Foundation.Uri(filePath); + // CB-12364 getFileFromApplicationUriAsync does not support ms-appx-web + var uri = new Windows.Foundation.Uri(filePath.replace('ms-appx-web:', 'ms-appx:')); Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).then(function (file) { return Windows.Storage.FileIO.readTextAsync(file); }).done(function (code) { diff --git a/tests/tests.js b/tests/tests.js index de0c090..84cdee8 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -26,6 +26,10 @@ var cordova = require('cordova'); var isWindows = cordova.platformId == 'windows'; window.alert = window.alert || navigator.notification.alert; +if (isWindows && navigator && navigator.notification && navigator.notification.alert) { + // window.alert is defined but not functional on UWP + window.alert = navigator.notification.alert; +} exports.defineAutoTests = function () {