Skip to content

Commit 00b8eaa

Browse files
committed
- fix a bug with runtime.install on server
1 parent 690f7d2 commit 00b8eaa

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

build/system/system.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ var system = {
16041604
"_id": "1ef951f1411b895",
16051605
"component": "RuntimeOSGi",
16061606
"state": "install",
1607-
"action": "function install(url, autoStart, async) { \n var importedSystem = null,\n system = {},\n systemId = '',\n callbackLoad = null,\n xhr = null,\n result = '',\n channel = $component.get('channel');\n \n if (typeof url === 'object') {\n importedSystem = url;\n } else {\n if (url.indexOf('{') === 0) {\n importedSystem = JSON.parse(url);\n }\n }\n \n if (importedSystem) {\n systemId = this.require('db').system(importedSystem); \n if (systemId) {\n system = this.require(systemId);\n \n system.status('installed'); \n channel.$systemInstalled(systemId);\n system.status('resolved');\n channel.$systemResolved(systemId);\n \n if (autoStart) {\n system.status('starting');\n system.main(); // deprecated\n system.start();\n channel.$systemStarted(systemId);\n system.status('active');\n }\n \n result = systemId;\n }\n } else { \n if (typeof global !== 'undefined') {\n if (url.indexOf('.json') !== -1) {\n system = global.require(global.process.env.PWD + '/' + url);\n } else {\n system = global.require(url);\n }\n systemId = this.require('db').system(system);\n system = this.require(systemId);\n \n system.status('installed'); \n channel.$systemInstalled(systemId);\n if (!system.master()) {\n system.status('resolved');\n channel.$systemResolved(systemId);\n }\n if (autoStart) {\n if (system.master()) {\n system.status('resolved');\n channel.$systemResolved(systemId);\n }\n system.status('starting');\n if (this.require(systemId).main) {\n this.require(systemId).main();\n }\n if (this.require(systemId).start) {\n this.require(systemId).start();\n }\n channel.$systemStarted(systemId);\n system.status('active');\n }\n \n result = systemId;\n } else {\n xhr = new XMLHttpRequest();\n callbackLoad = function callbackLoad(system) {\n var sysId = $db.system(system),\n sys = $component.get(sysId),\n channel = $component.get('channel');\n \n sys.status('installed'); \n channel.$systemInstalled(sysId);\n if (!sys.master()) {\n sys.status('resolved');\n channel.$systemResolved(sysId);\n }\n if (sys && autoStart) {\n if (sys.master()) {\n sys.status('resolved');\n channel.$systemResolved(sysId);\n }\n sys.status('starting');\n if (sys.main) {\n sys.main(); // deprecated\n }\n if (sys.start) {\n sys.start();\n }\n channel.$systemStarted(sysId);\n sys.status('active');\n } \n \n result = sysId;\n };\n \n if (async) {\n xhr.open('GET', url, true);\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n callbackLoad(JSON.parse(xhr.response));\n }\n }\n };\n xhr.send(null);\n } else {\n xhr.open('GET', url, false);\n xhr.send(null);\n if (xhr.status === 200) {\n callbackLoad(JSON.parse(xhr.response));\n }\n }\n }\n }\n return result;\n}",
1607+
"action": "function install(url, autoStart, async) { \n var importedSystem = null,\n system = {},\n systemId = '',\n callbackLoad = null,\n xhr = null,\n result = '',\n channel = $component.get('channel');\n \n if (typeof url === 'object') {\n importedSystem = url;\n } else {\n if (url.indexOf('{') === 0) {\n importedSystem = JSON.parse(url);\n }\n }\n \n if (importedSystem) {\n systemId = this.require('db').system(importedSystem); \n if (systemId) {\n system = this.require(systemId);\n \n system.status('installed'); \n channel.$systemInstalled(systemId);\n system.status('resolved');\n channel.$systemResolved(systemId);\n \n if (autoStart) {\n system.status('starting');\n system.main(); // deprecated\n system.start();\n channel.$systemStarted(systemId);\n system.status('active');\n }\n \n result = systemId;\n }\n } else { \n if (typeof global !== 'undefined') {\n if (url.indexOf('.json') !== -1) {\n system = global.require(global.process.env.PWD + '/' + url);\n } else {\n system = global.require(url);\n }\n systemId = this.require('db').system(system);\n system = this.require(systemId);\n \n system.status('installed'); \n channel.$systemInstalled(systemId);\n system.status('resolved');\n channel.$systemResolved(systemId);\n if (autoStart) {\n system.status('starting');\n \n if (this.require(systemId).main) {\n this.require(systemId).main();\n }\n if (this.require(systemId).start) {\n this.require(systemId).start();\n }\n channel.$systemStarted(systemId);\n system.status('active');\n }\n \n result = systemId;\n } else {\n xhr = new XMLHttpRequest();\n callbackLoad = function callbackLoad(system) {\n var sysId = $db.system(system),\n sys = $component.get(sysId),\n channel = $component.get('channel');\n \n sys.status('installed'); \n channel.$systemInstalled(sysId);\n sys.status('resolved');\n channel.$systemResolved(sysId);\n \n if (sys && autoStart) {\n sys.status('starting');\n if (sys.main) {\n sys.main(); // deprecated\n }\n if (sys.start) {\n sys.start();\n }\n channel.$systemStarted(sysId);\n sys.status('active');\n } \n \n result = sysId;\n };\n \n if (async) {\n xhr.open('GET', url, true);\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n callbackLoad(JSON.parse(xhr.response));\n }\n }\n };\n xhr.send(null);\n } else {\n xhr.open('GET', url, false);\n xhr.send(null);\n if (xhr.status === 200) {\n callbackLoad(JSON.parse(xhr.response));\n }\n }\n }\n }\n return result;\n}",
16081608
"useCoreAPI": true,
16091609
"core": true
16101610
},
@@ -1628,7 +1628,7 @@ var system = {
16281628
"_id": "105f219c6813643",
16291629
"component": "RuntimeOSGi",
16301630
"state": "start",
1631-
"action": "function start(id) { \n\tvar system = this.require(id),\n\t channel = this.require('channel');\n\t\n\tif (system.status() === 'resolved') {\n \tsystem.status('starting');\n \tif (system.main) {\n \t system.main();\n \t}\n \tif (system.start) {\n \t system.start();\n \t}\n \tchannel.$systemStarted(id);\n \tsystem.status('active');\n\t}\n}",
1631+
"action": "function start(id) { \n\tvar system = this.require(id),\n\t channel = this.require('channel');\n\t\n\tif (system.status() === 'resolved' || system.status() === 'installed') {\n \tsystem.status('starting');\n \tif (system.main) {\n \t system.main();\n \t}\n \tif (system.start) {\n \t system.start();\n \t}\n \tchannel.$systemStarted(id);\n \tsystem.status('active');\n\t}\n}",
16321632
"useCoreAPI": false,
16331633
"core": true
16341634
},

build/sytem-runtime.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@
17301730
"_id": "1ef951f1411b895",
17311731
"component": "RuntimeOSGi",
17321732
"state": "install",
1733-
"action": "function install(url, autoStart, async) { \n var importedSystem = null,\n system = {},\n systemId = '',\n callbackLoad = null,\n xhr = null,\n result = '',\n channel = $component.get('channel');\n \n if (typeof url === 'object') {\n importedSystem = url;\n } else {\n if (url.indexOf('{') === 0) {\n importedSystem = JSON.parse(url);\n }\n }\n \n if (importedSystem) {\n systemId = this.require('db').system(importedSystem); \n if (systemId) {\n system = this.require(systemId);\n \n system.status('installed'); \n channel.$systemInstalled(systemId);\n system.status('resolved');\n channel.$systemResolved(systemId);\n \n if (autoStart) {\n system.status('starting');\n system.main(); // deprecated\n system.start();\n channel.$systemStarted(systemId);\n system.status('active');\n }\n \n result = systemId;\n }\n } else { \n if (typeof global !== 'undefined') {\n if (url.indexOf('.json') !== -1) {\n system = global.require(global.process.env.PWD + '/' + url);\n } else {\n system = global.require(url);\n }\n systemId = this.require('db').system(system);\n system = this.require(systemId);\n \n system.status('installed'); \n channel.$systemInstalled(systemId);\n if (!system.master()) {\n system.status('resolved');\n channel.$systemResolved(systemId);\n }\n if (autoStart) {\n if (system.master()) {\n system.status('resolved');\n channel.$systemResolved(systemId);\n }\n system.status('starting');\n if (this.require(systemId).main) {\n this.require(systemId).main();\n }\n if (this.require(systemId).start) {\n this.require(systemId).start();\n }\n channel.$systemStarted(systemId);\n system.status('active');\n }\n \n result = systemId;\n } else {\n xhr = new XMLHttpRequest();\n callbackLoad = function callbackLoad(system) {\n var sysId = $db.system(system),\n sys = $component.get(sysId),\n channel = $component.get('channel');\n \n sys.status('installed'); \n channel.$systemInstalled(sysId);\n if (!sys.master()) {\n sys.status('resolved');\n channel.$systemResolved(sysId);\n }\n if (sys && autoStart) {\n if (sys.master()) {\n sys.status('resolved');\n channel.$systemResolved(sysId);\n }\n sys.status('starting');\n if (sys.main) {\n sys.main(); // deprecated\n }\n if (sys.start) {\n sys.start();\n }\n channel.$systemStarted(sysId);\n sys.status('active');\n } \n \n result = sysId;\n };\n \n if (async) {\n xhr.open('GET', url, true);\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n callbackLoad(JSON.parse(xhr.response));\n }\n }\n };\n xhr.send(null);\n } else {\n xhr.open('GET', url, false);\n xhr.send(null);\n if (xhr.status === 200) {\n callbackLoad(JSON.parse(xhr.response));\n }\n }\n }\n }\n return result;\n}",
1733+
"action": "function install(url, autoStart, async) { \n var importedSystem = null,\n system = {},\n systemId = '',\n callbackLoad = null,\n xhr = null,\n result = '',\n channel = $component.get('channel');\n \n if (typeof url === 'object') {\n importedSystem = url;\n } else {\n if (url.indexOf('{') === 0) {\n importedSystem = JSON.parse(url);\n }\n }\n \n if (importedSystem) {\n systemId = this.require('db').system(importedSystem); \n if (systemId) {\n system = this.require(systemId);\n \n system.status('installed'); \n channel.$systemInstalled(systemId);\n system.status('resolved');\n channel.$systemResolved(systemId);\n \n if (autoStart) {\n system.status('starting');\n system.main(); // deprecated\n system.start();\n channel.$systemStarted(systemId);\n system.status('active');\n }\n \n result = systemId;\n }\n } else { \n if (typeof global !== 'undefined') {\n if (url.indexOf('.json') !== -1) {\n system = global.require(global.process.env.PWD + '/' + url);\n } else {\n system = global.require(url);\n }\n systemId = this.require('db').system(system);\n system = this.require(systemId);\n \n system.status('installed'); \n channel.$systemInstalled(systemId);\n system.status('resolved');\n channel.$systemResolved(systemId);\n if (autoStart) {\n system.status('starting');\n \n if (this.require(systemId).main) {\n this.require(systemId).main();\n }\n if (this.require(systemId).start) {\n this.require(systemId).start();\n }\n channel.$systemStarted(systemId);\n system.status('active');\n }\n \n result = systemId;\n } else {\n xhr = new XMLHttpRequest();\n callbackLoad = function callbackLoad(system) {\n var sysId = $db.system(system),\n sys = $component.get(sysId),\n channel = $component.get('channel');\n \n sys.status('installed'); \n channel.$systemInstalled(sysId);\n sys.status('resolved');\n channel.$systemResolved(sysId);\n \n if (sys && autoStart) {\n sys.status('starting');\n if (sys.main) {\n sys.main(); // deprecated\n }\n if (sys.start) {\n sys.start();\n }\n channel.$systemStarted(sysId);\n sys.status('active');\n } \n \n result = sysId;\n };\n \n if (async) {\n xhr.open('GET', url, true);\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n callbackLoad(JSON.parse(xhr.response));\n }\n }\n };\n xhr.send(null);\n } else {\n xhr.open('GET', url, false);\n xhr.send(null);\n if (xhr.status === 200) {\n callbackLoad(JSON.parse(xhr.response));\n }\n }\n }\n }\n return result;\n}",
17341734
"useCoreAPI": true,
17351735
"core": true
17361736
},
@@ -1754,7 +1754,7 @@
17541754
"_id": "105f219c6813643",
17551755
"component": "RuntimeOSGi",
17561756
"state": "start",
1757-
"action": "function start(id) { \n\tvar system = this.require(id),\n\t channel = this.require('channel');\n\t\n\tif (system.status() === 'resolved') {\n \tsystem.status('starting');\n \tif (system.main) {\n \t system.main();\n \t}\n \tif (system.start) {\n \t system.start();\n \t}\n \tchannel.$systemStarted(id);\n \tsystem.status('active');\n\t}\n}",
1757+
"action": "function start(id) { \n\tvar system = this.require(id),\n\t channel = this.require('channel');\n\t\n\tif (system.status() === 'resolved' || system.status() === 'installed') {\n \tsystem.status('starting');\n \tif (system.main) {\n \t system.main();\n \t}\n \tif (system.start) {\n \t system.start();\n \t}\n \tchannel.$systemStarted(id);\n \tsystem.status('active');\n\t}\n}",
17581758
"useCoreAPI": false,
17591759
"core": true
17601760
},

0 commit comments

Comments
 (0)