mfikes / ambly

ClojureScript REPL into embedded JavaScriptCore
http://ambly.fikesfarm.com
Eclipse Public License 1.0
541 stars 21 forks source link

Stack parsing tripped up by http source #73

Closed mfikes closed 9 years ago

mfikes commented 9 years ago

Ambly's stack parsing is currently hardcoded to expect file:// URIs.

When experimenting with React Native (letting its bundler pull in stuff), JavaScriptCore gets source loaded in specifying http:// URIs and these can appear in the stack trace emitted by JavaScriptCore:

unmountComponent@http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle:5229:59
unmountComponent@http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle:16238:37
unmountComponentFromNode@http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle:15831:37
unmountComponentAtNode@http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle:15809:43
file:///om/core.js:4642:36
om$core$root@file:///om/core.js:4192:61

global code

which results in anemic information in the mapped stacktrace presented:

     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     (NO_SOURCE_FILE)
     om$dom$render (jar:file:/Users/mfikes/.m2/repository/org/omcljs/om/0.9.0-SNAPSHOT/om-0.9.0-SNAPSHOT.jar!/om/dom.cljs:49:3))
     om$core$root_$_rootf (jar:file:/Users/mfikes/.m2/repository/org/omcljs/om/0.9.0-SNAPSHOT/om-0.9.0-SNAPSHOT.jar!/om/core.cljs:1128:23)
     om$core$root (jar:file:/Users/mfikes/.m2/repository/org/omcljs/om/0.9.0-SNAPSHOT/om-0.9.0-SNAPSHOT.jar!/om/core.cljs:1187:7)
     (NO_SOURCE_FILE)

Even though the bundled React Native JavaScript can't be source mapped back to ClojureScript, there are useful JavaScript function names and line numbers that can at least be extracted.

mfikes commented 9 years ago

Much richer stack trace is possible with changes:

example=> (om/root widget {:text "Hello world!"} {:target 1})
Error: Invariant Violation: ReactCompositeComponent.render(): A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object.
    invariant (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:1804:24)
    _renderValidatedComponent (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:16767:14)
    ReactCompositeComponent__renderValidatedComponent (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:5143:26)
    mountComponent (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:16196:55)
    ReactCompositeComponent_mountComponent (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:5143:26)
    mountComponent (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:5212:49)
    mountComponentIntoNode (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:15669:46)
    perform (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:6275:24)
    batchedMountComponentIntoNode (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:15688:22)
    perform (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:6275:24)
    batchedUpdates (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:13790:26)
    batchedUpdates (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:4807:34)
    renderComponent (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:15740:32)
    ReactMount__renderNewRootComponent (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:5143:26)
    render (NO_SOURCE_FILE <http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle>:1438:32)
    om.dom/render (om/dom.cljs:49:4)
    om$core$root_$_rootf (om/core.cljs:1128:32)
    om$core$root (om/core.cljs:1187:8)
    global code (NO_SOURCE_FILE)