File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,8 +17,10 @@ Development
1717
1818This project is being developed within the [ github.com/firebug/dev-system] ( https://github.com/firebug/dev-system ) . Once installed you can run:
1919
20- pio publish --local firephp-for-firebug.next
21- pio run firephp-for-firebug.next --open
20+ pio bundle --local firephp-for-firebug.next
21+ pio run --local --dev firephp-for-firebug.next --open
22+ pio run --local --dev firephp-for-firebug.next -- components
23+ pio run --local --dev firephp-for-firebug.next -- server
2224 profile run fbn-firephp
2325 profile run fbn-firephp-test
2426
Original file line number Diff line number Diff line change 1+
2+
3+ // Connect to server, on error reconnect and once reconnected
4+ // signal reconnect. Client can this determine when server is rebooted and comes back.
5+ // TODO: Include an instance ID in websocket condition so we can distinguish
6+ // between network issues and server restarts.
7+
8+
9+ function connectAndWaitForError ( first , _onError ) {
10+
11+ var onError = function ( err ) {
12+ if ( ! _onError ) return ;
13+ _onError ( err ) ;
14+ _onError = null ;
15+ }
16+
17+ var ws = new WebSocket ( "ws://localhost:8080" ) ;
18+ ws . onopen = function ( event ) {
19+ if ( first ) {
20+ self . port . emit ( "opened" ) ;
21+ } else {
22+ self . port . emit ( "reopened" ) ;
23+ }
24+ // ws.send("Send test message from client to server!");
25+ } ;
26+
27+ ws . onerror = function ( err ) {
28+ onError ( err ) ;
29+ } ;
30+
31+ /*
32+ ws.onmessage = function (message) {
33+ self.port.emit("message", "got message: " + message);
34+ }
35+ */
36+
37+ ws . onclose = function ( ) {
38+ onError ( new Error ( "closed" ) ) ;
39+ }
40+ }
41+
42+
43+ function reconnect ( first ) {
44+ return setTimeout ( function ( ) {
45+ return connectAndWaitForError ( first , function ( err ) {
46+ if ( first ) {
47+ self . port . emit ( "closed" ) ;
48+ }
49+ return reconnect ( false ) ;
50+ } ) ;
51+ } , 500 ) ;
52+ }
53+
54+
55+ reconnect ( true ) ;
56+
Original file line number Diff line number Diff line change @@ -23,7 +23,11 @@ function main(options, callbacks) {
2323 GDEVTOOLS . on ( "webconsole-init" , onConsoleInit ) ;
2424
2525
26- SANDBOX ( DATA . url ( "bundles/components/main.js" ) , function ( sandbox ) {
26+ var uri = DATA . url ( "bundles/components/main.js" ) ;
27+ // TODO: Get URI from mappings.
28+ uri = "http://localhost:8080/bundles/main.js" ;
29+
30+ SANDBOX ( uri , function ( sandbox ) {
2731
2832 sandbox . main ( {
2933 CC : CC ,
@@ -35,7 +39,13 @@ function main(options, callbacks) {
3539 CLASS : require ( "sdk/core/heritage" ) . Class ,
3640 DEV_PANEL : require ( "dev/panel.js" ) . Panel ,
3741 DEV_TOOL : require ( "dev/toolbox" ) . Tool ,
38- PANEL : require ( "sdk/panel" )
42+ PANEL : require ( "sdk/panel" ) ,
43+ PAGE_WORKER : require ( "sdk/page-worker" ) ,
44+ ADDON_INSTALLER : require ( "sdk/addon/installer" ) ,
45+ TABS : require ( "sdk/tabs" ) ,
46+ getBootOptions : function ( ) {
47+ return options ;
48+ }
3949 } ) ;
4050 } ) ;
4151
Original file line number Diff line number Diff line change 1+
2+ // @see https://github.com/Gozala/jpm-addon/blob/master/core.js
3+
4+ exports . for = function ( API ) {
5+
6+ return {
7+ reload : function ( ) {
8+
9+ var addonId = API . SELF . id ;
10+
11+ return API . ADDON_INSTALLER . disable ( addonId ) . then ( function ( ) {
12+
13+ API . CC [ "@mozilla.org/observer-service;1" ] .
14+ getService ( API . CI . nsIObserverService ) .
15+ notifyObservers ( { } , "startupcache-invalidate" , null ) ;
16+
17+ return API . ADDON_INSTALLER . enable ( addonId ) ;
18+ } ) ;
19+ }
20+ } ;
21+ }
Original file line number Diff line number Diff line change @@ -21,8 +21,28 @@ exports.main = function (API) {
2121
2222 try {
2323
24+ const ADDON_API = makeAPI ( API , {
25+ name : "adapters/addon"
26+ } ) ;
27+ const ADDON_EXPORTS = require ( "./adapters/addon" ) . for ( ADDON_API ) ;
28+
29+
30+
31+ const MONITORS_BUNDLE_SERVER_API = makeAPI ( API , {
32+ name : "monitors/bundle-server"
33+ } ) ;
34+ const MONITORS_BUNDLE_SERVER_EXPORTS = require ( "./monitors/bundle-server" ) . for ( MONITORS_BUNDLE_SERVER_API ) ;
35+
36+ MONITORS_BUNDLE_SERVER_API . once ( "restarted" , function ( ) {
37+
38+ ADDON_EXPORTS . reload ( ) ;
39+
40+ } ) ;
41+
42+
43+
2444 const HTTP_RESPONSE_OBSERVER_API = makeAPI ( API , {
25- name : "http-response-observer"
45+ name : "adapters/ http-response-observer"
2646 } ) ;
2747 const HTTP_RESPONSE_OBSERVER_EXPORTS = require ( "./adapters/http-response-observer" ) . for ( HTTP_RESPONSE_OBSERVER_API ) ;
2848
@@ -33,11 +53,19 @@ exports.main = function (API) {
3353 } ) ;
3454
3555
56+
3657 const UI_DEVTOOLS_PANEL_API = makeAPI ( API , {
37- name : "devtools-panel"
58+ name : "ui/ devtools-panel"
3859 } ) ;
3960 const UI_DEVTOOLS_PANEL_EXPORTS = require ( "./ui/devtools-panel" ) . for ( UI_DEVTOOLS_PANEL_API ) ;
4061
62+
63+
64+ API . console . log ( "Open tab!" ) ;
65+ API . TABS . open ( "http://localhost:49084/" ) ;
66+
67+
68+
4169 } catch ( err ) {
4270 console . error ( err . stack ) ;
4371 throw err ;
Original file line number Diff line number Diff line change 1+
2+ exports . for = function ( API ) {
3+
4+ var pageWorker = API . PAGE_WORKER . Page ( {
5+ contentScriptFile : "./bundle-server-monitor.js"
6+ } ) ;
7+
8+ /*
9+ pageWorker.port.on("message", function (msg) {
10+ API.console.log("monitor worker LOADED: " + msg);
11+ });
12+ */
13+
14+ pageWorker . port . on ( "opened" , function ( ) {
15+ //API.console.log("SERVER OPENED");
16+ } ) ;
17+
18+ pageWorker . port . on ( "closed" , function ( ) {
19+ //API.console.log("SERVER CLOSED: trigger reload!");
20+ } ) ;
21+
22+ pageWorker . port . on ( "reopened" , function ( ) {
23+ //API.console.log("SERVER RE-OPENED!");
24+ API . emit ( "restarted" ) ;
25+ } ) ;
26+
27+ }
Original file line number Diff line number Diff line change 1414 },
1515 "scripts" : {
1616 "install" : " ../node_modules/.bin/smi install" ,
17- "build" : " rm -Rf .rt ; ../node_modules/to.pinf.lib/bin/pinf-bundle ; ../node_modules/pinf-to-browser/bin/pinf-publish" ,
18- "run" : " ../node_modules/pinf-to-browser/bin/pinf-run" ,
19- "start" : " ../node_modules/pinf-to-browser/bin/pinf-start"
17+ "bundle" : " rm -Rf .rt ; ../node_modules/to.pinf.lib/bin/pinf-bundle ; ../node_modules/pinf-to-browser/bin/pinf-publish" ,
18+ "run" : " ../node_modules/pinf-to-browser/bin/pinf-run"
2019 }
2120}
Original file line number Diff line number Diff line change 1919 },
2020 "scripts" : {
2121 "install" : " ./node_modules/.bin/smi install ; cd components ; npm install --unsafe-perm ; cd .. ; cd ./server; npm install --unsafe-perm" ,
22- "publish" : " cd components ; npm run-script build ; cd .. ; cd ./server; npm run-script publish" ,
23- "run" : " ./node_modules/to.pinf.lib/bin/pinf-run" ,
24- "start" : " ./node_modules/to.pinf.lib/bin/pinf-start"
22+ "bundle" : " cd components ; npm run-script bundle ; cd .. ; cd ./server; npm run-script bundle" ,
23+ "run" : " ./node_modules/to.pinf.lib/bin/pinf-run"
2524 },
2625 "config" : {
2726 "smi.cli" : {
Original file line number Diff line number Diff line change 1515 },
1616 "scripts" : {
1717 "install" : " ../node_modules/.bin/smi install ; ./node_modules/pinf-to-docker/bin/pinf-publish --ignore-dirty" ,
18- "publish" : " ./node_modules/pinf-to-docker/bin/pinf-publish" ,
19- "run" : " ./node_modules/pinf-to-docker/bin/pinf-run" ,
20- "start" : " ./node_modules/pinf-to-docker/bin/pinf-start"
18+ "bundle" : " ./node_modules/pinf-to-docker/bin/pinf-publish" ,
19+ "run" : " ./node_modules/pinf-to-docker/bin/pinf-run"
2120 },
2221 "config" : {
2322 "smi.cli" : {
You can’t perform that action at this time.
0 commit comments