bustle / ember-mobiledoc-dom-renderer

Render mobiledoc documents in an ember app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DOM Renderer is unable to sanitize href tags in this environment with FastBoot

josemarluedke opened this issue · comments

The latest version (0.5.9) now throws when using FastBoot. Previously this did not happen. So I guess the issue has to do with the updated version of mobiledoc-dom-renderer.

     at getProtocol (/athena/dist/dev/fastboot/vendor.js:137560:13)
     at sanitizeHref (/athena/dist/dev/fastboot/vendor.js:137565:20)
     at sanitizeAttributeValue (/athena/dist/dev/fastboot/vendor.js:137574:14)
     at createElementFromMarkerType (/athena/dist/dev/fastboot/vendor.js:137028:134)
     at Renderer.renderMarkersOnElement (/athena/dist/dev/fastboot/vendor.js:137184:37)
     at Renderer.renderMarkupSection (/athena/dist/dev/fastboot/vendor.js:137464:14)
     at Renderer.renderSection (/athena/dist/dev/fastboot/vendor.js:137135:25)
     at /athena/dist/dev/fastboot/vendor.js:137099:32
     at Array.forEach (native)
     at Renderer.render (/athena/dist/dev/fastboot/vendor.js:137098:23)
     at RendererFactory.render (/athena/dist/dev/fastboot/vendor.js:136621:118)
     at Class._renderMobiledoc (/athena/dist/dev/fastboot/vendor.js:136366:39)
     at Class.didReceiveAttrs (/athena/dist/dev/fastboot/vendor.js:136318:12)
     at Class.trigger (/athena/dist/dev/fastboot/vendor.js:57881:23)
     at Class.superWrapper [as trigger] (/athena/dist/dev/fastboot/vendor.js:56046:22)
     at Class.exports.default._emberMetal.Mixin.create._Mixin$create.(anonymous function) [as __POST_INIT__ [id=__ember1488230946377861277811210]] (/athena/dist/dev/fastboot/vendor.js:56790:10)
     at new Class (/athena/dist/dev/fastboot/vendor.js:51740:22)
     at Function._ClassMixinProps.create (/athena/dist/dev/fastboot/vendor.js:51926:12)
     at CurlyComponentManager.create (/athena/dist/dev/fastboot/vendor.js:28213:29)
     at OpenComponentOpcode.evaluate (/athena/dist/dev/fastboot/vendor.js:62814:37)
     at VM.execute (/athena/dist/dev/fastboot/vendor.js:69405:28)
     at Object.render (/athena/dist/dev/fastboot/vendor.js:68968:23)
     at RootState.render (/athena/dist/dev/fastboot/vendor.js:27469:46)
     at runInTransaction (/athena/dist/dev/fastboot/vendor.js:38654:28)
     at InertRenderer._renderRoots (/athena/dist/dev/fastboot/vendor.js:27734:48)
     at InertRenderer._renderRootsTransaction (/athena/dist/dev/fastboot/vendor.js:27772:14)
     at InertRenderer._renderRoot (/athena/dist/dev/fastboot/vendor.js:27693:12)
     at InertRenderer._appendDefinition (/athena/dist/dev/fastboot/vendor.js:27606:12)
     at InertRenderer.appendOutletView (/athena/dist/dev/fastboot/vendor.js:27589:12)
     at invokeWithOnError (/athena/dist/dev/fastboot/vendor.js:15966:16)
     at Queue.flush (/athena/dist/dev/fastboot/vendor.js:16027:9)
     at DeferredActionQueues.flush (/athena/dist/dev/fastboot/vendor.js:16151:15)
     at Backburner.end (/athena/dist/dev/fastboot/vendor.js:16221:23)
     at Timeout._onTimeout (/athena/dist/dev/fastboot/vendor.js:16787:16)
     at ontimeout (timers.js:365:14)
     at tryOnTimeout (timers.js:237:5)
     at Timer.listOnTimeout (timers.js:207:5)```

@josemarluedke thanks for reporting — I'm taking a look

@josemarluedke I'm not able to reproduce this. Can you give some more details about your setup?
I created a simple ember app that uses ember-mobiledoc-dom-renderer v0.5.9 and ember-cli-fastboot and it seems to work ok: https://github.com/bantic/try-eme-fb

Feel free to contact me on the ember or mobiledoc slacks (I'm @bantic)

Hey @bantic! I managed to get a reproduction of the problem using your repo.

You can find the changes here: https://github.com/josemarluedke/try-eme-fb/commit/c6c96f272c0c3a2b77cf4fe6ea9e7fd4798e26fe

I hope this can help to track the problem.

@josemarluedke thanks for the repro! Looks like this is caused by incorrect node detection by mobiledoc-dom-renderer when run in a fastboot env: bustle/mobiledoc-dom-renderer#48. A fix is forthcoming.

released in v0.5.10 — @josemarluedke Could you try that and let me know if it fixes things for you?