[Phantomas v2] Scope seems to be initialized twice
See original GitHub issueHi Maciej,
I’m seeing an issue when testing any website with phantomas v2. It looks like the process of injecting scope.js files into the browser is done twice.
Here are two extracts of logs when ran with DEBUG=phantomas:scope:log
:
phantomas:scope:log phantomas page scope initialized +0ms
phantomas:scope:log spy: attaching to "open" function with results reporting +0ms
phantomas:scope:log Spying disabled - initializing domComplexity metrics +0ms
phantomas:scope:log Spying enabled +0ms
phantomas:scope:log Spying disabled - initializing hidden content analysis +1ms
phantomas:scope:log Spying enabled +0ms
phantomas:scope:log domQueries: initializing page scope code +0ms
phantomas:scope:log spy: attaching to "getElementById" function with results reporting +2ms
phantomas:scope:log spy: attaching to "getElementsByClassName" function with results reporting +0ms
[... and a bit later ...]
phantomas:scope:log phantomas page scope initialized +324ms
phantomas:scope:log spy: attaching to "open" function with results reporting +0ms
phantomas:scope:log Spying disabled - initializing domComplexity metrics +1ms
phantomas:scope:log Spying enabled +0ms
phantomas:scope:log Spying disabled - initializing hidden content analysis +0ms
phantomas:scope:log Spying enabled +0ms
phantomas:scope:log domQueries: initializing page scope code +0ms
phantomas:scope:log spy: attaching to "getElementById" function with results reporting +0ms
phantomas:scope:log spy: attaching to "getElementsByClassName" function with results reporting +2ms
[...]
Maybe I’m wrong, but it looks like the browser starts by opening a blank page. Phantomas injects scope.js in it. Then the real page is open and scope.js is injected a second time.
Side effects: some events such as milestones (domInteractive, domReady, domComplete) are triggered twice. Some reporting functions are called twice too.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Developers - [Phantomas v2] Scope seems to be initialized twice -
I'm seeing an issue when testing any website with phantomas v2. It looks like the process of injecting scope.js files into the browser...
Read more >Why are there TWO zero points when sighting in a scope?
Im new to this air rifle thing, How do you get 2 distances from ... By aligning the scope as we did, it...
Read more >[Solved]-Declaring Same Static Variable Twice in Global Scope-C++
C 2018 6.9.2 2 says: A declaration of an identifier for an object that has file scope without an initializer, and without a...
Read more >Init method gets called twice in @Viewscoped bean
The problem was this line of code: <p:ajax process="scope" update="schedule, scheduleForm, scheduleFormPG" listener="#{scheduleView.
Read more >The 10 Most Common Mistakes in C# Programming - Toptal
Common C# Programming Mistake #2: Misunderstanding default values for uninitialized variables. In C#, value types can't be null. By definition, value types ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m testing from the node module like this:
File example.js:
When launched with this command:
DEBUG=phantomas:scope:log node example.js 2>&1 | grep "page scope"
The result is:
Note: there is no redirection on this page.