Skip to content
This repository was archived by the owner on May 13, 2021. It is now read-only.

Commit 510145f

Browse files
author
msrodri
committed
Merge pull request #189 from manifoldjs/v0.4.3-development
V0.4.3 development
2 parents d734deb + dc30aa3 commit 510145f

28 files changed

+943
-104
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ coverage.html
55
*.njsproj
66
*.suo
77
*.sln
8-
.settings
8+
.settings
9+
launch.json

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ grunt
198198
## Supported Input Manifests
199199

200200
- [W3C Web App](http://www.w3.org/TR/appmanifest/)
201+
- [Chrome Hosted Apps](https://developers.google.com/chrome/apps/docs/developers_guide)
201202

202203
We plan to support the following manifest files in the future:
203204

204205
- [Web App Template](http://wat-docs.azurewebsites.net/JsonWindows)
205-
- [Chrome Hosted Apps](https://developers.google.com/chrome/apps/docs/developers_guide)
206206
- [Firefox Open Web Apps](https://developer.mozilla.org/Apps/Build/Manifest)
207207

208208
## Navigation Scope

lib/common/utils.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/manifestTools.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var fs = require('fs'),
1111
c = require('./manifestTools/constants'),
1212
validationConstants = require('./manifestTools/validationConstants'),
1313
log = require('loglevel'),
14+
chromeToW3c = require('./platformUtils/chromeToW3c.js'),
1415
Q = require('q'),
1516
// Request settings taken from https://github.com/InternetExplorer/modern.IE-static-code-scan/blob/master/app.js
1617
request = request.defaults({
@@ -104,6 +105,18 @@ function downloadManifestFromUrl(manifestUrl, callback) {
104105
// assume that it's a W3C manifest
105106
detectedFormat = c.BASE_MANIFEST_FORMAT;
106107
}
108+
109+
// If the detected format is ChromeOS, we attempt to convert it to W3C Manifest format.
110+
if (detectedFormat === c.CHROME_MANIFEST_FORMAT) {
111+
log.info('Found a ' + detectedFormat.toUpperCase() + ' manifest. Attempting to convert to W3C Manifest format...');
112+
manifestObj = chromeToW3c.chromeToW3CManifest(manifestObj);
113+
114+
// Assuming conversion was successful, running the manifest JSON through the detector again will return the W3C format type.
115+
detectedFormat = manifestTypeDetector.detect(manifestObj);
116+
if (detectedFormat === c.BASE_MANIFEST_FORMAT) {
117+
log.info('Conversion to W3C Manifest format successful.');
118+
}
119+
}
107120

108121
var manifestInfo = {
109122
content: manifestObj,
@@ -171,6 +184,18 @@ function getManifestFromFile(filePath, callback) {
171184
}
172185

173186
var detectedFormat = manifestTypeDetector.detect(manifestObj);
187+
188+
// If the detected format is ChromeOS, we attempt to convert it to W3C Manifest format.
189+
if (detectedFormat === c.CHROME_MANIFEST_FORMAT) {
190+
log.info('Found a ' + detectedFormat.toUpperCase() + ' manifest. Attempting to convert to W3C Manifest format...');
191+
manifestObj = chromeToW3c.chromeToW3CManifest(manifestObj);
192+
193+
// Assuming conversion was successful, running the manifest JSON through the detector again will return the W3C format type.
194+
detectedFormat = manifestTypeDetector.detect(manifestObj);
195+
if (detectedFormat === c.BASE_MANIFEST_FORMAT) {
196+
log.info('Conversion to W3C Manifest format successful.');
197+
}
198+
}
174199

175200
if (!detectedFormat) {
176201
return callback(new Error('Invalid manifest format.'));
@@ -196,7 +221,7 @@ function validateManifest(manifestInfo, targetPlatforms, callback) {
196221
if (!manifestInfo || !manifestInfo.content) {
197222
return callback(new Error('Manifest content is empty or invalid.'));
198223
}
199-
224+
200225
if (manifestInfo.format !== c.BASE_MANIFEST_FORMAT) {
201226
return callback(new Error('The manifest passed as argument is not a W3C manifest.'));
202227
}

lib/manifestTools/assets/web-manifest-extended.json

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,43 @@
1111
"items": {
1212
"$ref": "#/definitions/mjs_access_whitelist_rule"
1313
}
14-
}
14+
},
15+
"mjs_extended_scope": {
16+
"description": "The mjs_extended_scope member is an array of rules that define the navigation scope of this web application's application context.",
17+
"type": "array",
18+
"items": {
19+
"type": "string", "format": "uri"
20+
}
21+
},
22+
"mjs_api_access": {
23+
"description": "The mjs_api_whitelist member is an array of rules that indicates the type of access to the runtime API the URLs matching the rule should have.",
24+
"type": "array",
25+
"items": {
26+
"$ref": "#/definitions/mjs_api_access_rule"
27+
}
28+
},
29+
"mjs_import_scripts": {
30+
"description": "The mjs_import_scripts member is an array of script files that will be loaded into the application.",
31+
"type": "array",
32+
"items": {
33+
"$ref": "#/definitions/mjs_import_scripts_rule"
34+
}
35+
},
36+
"mjs_cordova": {
37+
"description": "Specify how to load the Cordova and plugin JavaScript files.",
38+
"type": "object",
39+
"properties": {
40+
"plugin_mode" : {
41+
"description" : "Defines where the Cordova and plugin JavaScript files are injected from.",
42+
"enum" : [ "client", "server" ]
43+
},
44+
"base_url" : {
45+
"description": "When pluginMode is configured as “server”, this property specifies the exact location in the server of the Cordova and plugin JavaScript files.",
46+
"type" : "string",
47+
"format" : "uri"
48+
}
49+
}
50+
}
1551
},
1652

1753
"definitions": {
@@ -25,7 +61,44 @@
2561
},
2662
"apiAccess" : {
2763
"description": "A string that defines the type of access to the runtime API where the application is running.",
28-
"enum": [ "none", "all", "AllowForWebOnly" ]
64+
"enum": [ "none", "all", "allowForWebOnly" ]
65+
}
66+
}
67+
},
68+
"mjs_api_access_rule": {
69+
"type": "object",
70+
"properties": {
71+
"match": {
72+
"description": "A string or array of strings that represent the URL pattern(s) for which the rule should be applied to.",
73+
"oneOf": [
74+
{ "type": "string", "format": "uri" },
75+
{ "type": "array", "items": { "type": "string", "format": "uri" } }
76+
]
77+
},
78+
"platform" : {
79+
"description": "Specifies the platforms for which the rule should be applied to.",
80+
"type": "string"
81+
},
82+
"access" : {
83+
"description": "Defines the type of access to the runtime API where the application is running. Could be extended in the future to accept other types for platforms with different access requirements.",
84+
"type": "string"
85+
}
86+
}
87+
},
88+
"mjs_import_scripts_rule": {
89+
"type": "object",
90+
"properties": {
91+
"src" : {
92+
"description": "The URL where the custom script file is located. The source can be specified as a path of the script file in the app package, or as a full URL to retrieve the file from the server.",
93+
"type": "string",
94+
"format": "uri"
95+
},
96+
"match": {
97+
"description": "A string or array of strings that represent the URL pattern(s) for which the script file should be loaded.",
98+
"oneOf": [
99+
{ "type": "string", "format": "uri" },
100+
{ "type": "array", "items": { "type": "string", "format": "uri" } }
101+
]
29102
}
30103
}
31104
}

lib/manifestTools/assets/windows10/msapp-error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html>
22
<html>
33
<head>
44
<title>Navigation Error</title>

0 commit comments

Comments
 (0)