macbre / phantomas

Headless Chromium-based web performance metrics collector and monitoring tool
https://www.npmjs.com/package/phantomas
BSD 2-Clause "Simplified" License
2.25k stars 141 forks source link

appendSpy: TypeError: undefined is not a function #560

Closed macbre closed 9 years ago

macbre commented 9 years ago
$ phantomas "http://poznan.wikia.com/wiki/Koszary_Huzar%C3%B3w?noexternals=1" --phone --webkit2 --verbose

15:38:21.651 recv: HTTP 200 <http://mercury.nocookie.net/mercury-static/vendor/main-244f9429.js> [application/javascript]
15:38:21.652 Event recv emitted
15:38:21.697 Event domQuery emitted
15:38:21.697 DOM query: by selector - "script[src*="webcomponents.js"]" (using querySelectorAll) in #document
15:38:21.805 Event domQuery emitted
15:38:21.814 JS error: TypeError: undefined is not a function (evaluating 'destNodePath.indexOf('DocumentFragment')')
15:38:21.814 Event jserror emitted
15:38:21.815 TypeError: undefined is not a function (evaluating 'destNodePath.indexOf('DocumentFragment')')
15:38:21.815 Backtrace: appendSpy(): phantomjs://webpage.evaluate() @ 70 / unknown fn: /home/macbre/github/phantomas/core/scope.js @ 216 / insertBefore(): http://mercury.nocookie.net/mercury-static/vendor/main-244f9429.js @ 1 / unknown fn: http://mercury.nocookie.net/mercury-static/vendor/main-244f9429.js @ 3

with --skip-modules domQueries:

15:42:17.617 Spying disabled - counting global variables (injecting an empty iframe)
15:42:17.637 JS error: TypeError: null is not an object (evaluating '(document._currentScript || document.currentScript).ownerDocument')
15:42:17.638 Event jserror emitted
15:42:17.638 TypeError: null is not an object (evaluating '(document._currentScript || document.currentScript).ownerDocument')

@rogatty

rogatty commented 9 years ago

This site uses:

"polymer": "1.1.3",
"webcomponentsjs": "~0.7.12",

and has a following snippet of code in header:

<script>
    window.Polymer = window.Polymer || {};
    window.Polymer.dom = 'shadow';
</script>
<link rel="import" href="/front/vendor/wikia-style-guide/dist/components/import-built.html">

where the import comes from https://github.com/Wikia/style-guide/blob/dev/dist/components/import-built.html

Using --skip-modules=domQueries,globalVariables fixes the issue.