From 831e57dd48f5e181e467e1ce3fc1ff13e05f6e60 Mon Sep 17 00:00:00 2001 From: mrodriguez Date: Thu, 19 Nov 2015 20:06:11 -0300 Subject: [PATCH] Changed manifest transformations for Windows 10 Hosted Apps. By default, WindowsRuntimeAccess attribute of ACUR rules is set to 'all' if no access type is specified in mjs_api_access --- lib/platformUtils/windows10Utils.js | 2 +- .../transformations/windows10.js | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/lib/platformUtils/windows10Utils.js b/lib/platformUtils/windows10Utils.js index 59de5b61..4aa58970 100644 --- a/lib/platformUtils/windows10Utils.js +++ b/lib/platformUtils/windows10Utils.js @@ -125,7 +125,7 @@ function replaceManifestValues(w3cManifestInfo, content) { return false; } - tryAddAcurToList(acurList, { match: apiRule.match, runtimeAccess: apiRule.access }); + tryAddAcurToList(acurList, { match: apiRule.match, runtimeAccess: apiRule.access || 'all' }); }); } diff --git a/test/manifestTools/transformations/windows10.js b/test/manifestTools/transformations/windows10.js index cd2701b0..f6549761 100644 --- a/test/manifestTools/transformations/windows10.js +++ b/test/manifestTools/transformations/windows10.js @@ -640,6 +640,42 @@ describe('transformation: Windows 10 Manifest', function () { }); }); + it('Should add ACUR from mjs_api_access with default access type \'all\' if no access type is specified', function (done) { + var siteUrl = 'http://url.com/something?query'; + var shortName = 'shortName'; + + var originalManifestInfo = { + content: { + 'start_url': siteUrl, + 'short_name': shortName, + 'mjs_api_access': [ + { 'match': 'http://url.com/somepath/', 'platform': 'windows10'} + ] + } + }; + + transformation.convertFromBase(originalManifestInfo, function (err, result) { + should.not.exist(err); + should.exist(result); + /*jshint -W030 */ + result.should.have.property('content').which.is.an.Object; + result.should.have.property('format', 'windows10'); + + var manifest = result.content; + + manifest.should.have.property('rawData'); + + var expectedContentUriRules = '' + + '' + + '' + + ''; + + manifest.rawData.replace(/[\t\r\n]/g, '').indexOf(expectedContentUriRules).should.be.above(-1); + + done(); + }); + }); + it('Should not add ACUR from mjs_api_access if windows10 is not in platform', function (done) { var siteUrl = 'http://url.com/something?query'; var shortName = 'shortName';