coverage-ext icon indicating copy to clipboard operation
coverage-ext copied to clipboard

initial try to update to current chrome extensions APIs

Open spite opened this issue 9 years ago • 2 comments

This is just a test to see if the original behaviour can be replicated.

Might need a better handling of script loading (for instance, WebRequest for dynamically loaded scripts). I have no idea about dynamically injected scripts, may be polling and checking the document's script tags.

spite avatar Sep 16 '16 18:09 spite

maybe this has actually has legs... ?

injected script will run before any page script. :) that means we could wrap eval :D we can also set up a mutationobserver early to watch for all scripts.

will mutationobserver run after script element has been created but before that script executes? :/

paulirish avatar Sep 16 '16 20:09 paulirish

I've added support for eval and inline scripts https://github.com/spite/coverage-ext/commit/3c170828507f51b7d58f4d6a350e025306adabf3 but at this point what I'm having trouble is understanding what the instrumenting code actually does and expects the extension to do (I'm not familiar with Istanbul and its workings and format)

Since it seems that originally the extension used the eval'd result of the script processor, and we might be able to do away with it, may be it makes more sense to use message dispatching and chrome.runtime to pass the result to the devtools page, and even include the report directly intro the panel.

Re: mutationobserver, it should be tested. We can time things more or less accurately with content and injected scripts, and monitoring WebRequests.

spite avatar Sep 16 '16 22:09 spite