Non-extension use cases of these events include monkey-patching code (e.g. for script loaders) and gathering statistics (e.g. for debugging).
I'm not sure we should implement these events.On Mon Mar 24 2014 at 2:29:10 PM, Rob Wu <r...@robwu.nl> wrote:Non-extension use cases of these events include monkey-patching code (e.g. for script loaders) and gathering statistics (e.g. for debugging).The extension use cases are probably better served with extension-specific APIs that don't require extensions to inject content script into every web page. For example, maybe we need to elaborate the declarative web request API in some way to handle these use cases.
If you want to write a monkey-patching script loader, you probably should use a service worker to be able to manipulate responses at the network layer instead of in the DOM.
As for statistics, we can address those use cases via something like the WebPerformance API.
2014-03-24 22:36 GMT+01:00 Adam Barth <aba...@google.com>:I'm not sure we should implement these events.
On Mon Mar 24 2014 at 2:29:10 PM, Rob Wu <r...@robwu.nl> wrote:Non-extension use cases of these events include monkey-patching code (e.g. for script loaders) and gathering statistics (e.g. for debugging).The extension use cases are probably better served with extension-specific APIs that don't require extensions to inject content script into every web page. For example, maybe we need to elaborate the declarative web request API in some way to handle these use cases.
The webRequest APIs cannot be used to detect and block inline scripts.And it cannot be used to modify response bodies either (read-only access is in development though).
[...]
As for statistics, we can address those use cases via something like the WebPerformance API.
How would you profile the time spent on running scripts without before-script-execute and after-script-execute events, without editing all involved code and insert console.time(++globalCounter); and console.timeEnd(globalCounter);?
Mutation observers won't fit the bill, because these can only detect tag insertion, not execution.
If you want to write a monkey-patching script loader, you probably should use a service worker to be able to manipulate responses at the network layer instead of in the DOM. As for statistics, we can address those use cases via something like the WebPerformance API.
On Monday, March 24, 2014 5:36:43 PM UTC-4, Adam Barth wrote:If you want to write a monkey-patching script loader, you probably should use a service worker to be able to manipulate responses at the network layer instead of in the DOM. As for statistics, we can address those use cases via something like the WebPerformance API.
This is very interesting. It seems feasible to me, based on my limited service-worker knowledge, that you could create a 100% faithful polyfill for these events using service worker. Can someone with more knowledge confirm? If so, that is great news in terms of service worker being a primitive that addresses many use cases.
I would like to understand better what people's specific concerns are
here, because to me this looks nothing like mutation events. The key
difference, again, is that mutation events had script running in the
middle of an algorithm that could mess with the data structure the
algorithm was working on, while here we have script running when we were
going to run script anyway.
> Sounds like we haven't explained enough of how HTMLScriptElement works to let developers create a custom script element. Perhaps we need some sort of script loading/executing API that can load and execute OpaqueResponses.
I believe this may tie in to the work Dave Herman is doing on the ES6 Realms API [1] [2]. CC'ing him. Note especially slides near the end starting with "future-proofing with polymorphism," which could allow sending OpaqueResponses into the Realms API for execution.
[1]: https://speakerdeck.com/dherman/status-report-es6-modules
[2]: https://gist.github.com/dherman/7568885
From: Adam Barth <aba...@google.com>
> Sounds like we haven't explained enough of how HTMLScriptElement works to let developers create a custom script element. Perhaps we need some sort of script loading/executing API that can load and execute OpaqueResponses.
I believe this may tie in to the work Dave Herman is doing on the ES6 Realms API [1] [2]. CC'ing him. Note especially slides near the end starting with "future-proofing with polymorphism," which could allow sending OpaqueResponses into the Realms API for execution.
- If Blink's position is that these events should not exist due to inherently-problematic characteristics, would it be appropriate to request they be removed from the standard, and coordinate with Firefox on such a removal? Alternately, do the Firefox developers have any feedback on if perhaps there is an implementation strategy that avoids the problems of mutation events? Or would there be a revision to the standard that would be more palatable (e.g. a "ScriptObserver")?
This is very important functionality. The developers of AdBlock Plus (one of the most installed addons) need this to implement a new feature: https://issues.adblockplus.org/ticket/3207 But they can't because Chromium developers refuse to implement a feature that is officially part of the W3C HTML5 standard.
Firefox already implemented this, you didn't. Therefore Chromium browsers fail certain HTML5 tests, like this one: http://www.w3c-test.org/html/semantics/scripting-1/the-script-element/script-before-after-events.html Firefox passes all these tests. I thought Chromium is all about supporting standards like HTML5?
How hard can it be?
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
If you remove it, please add it back to the extension api (which is my use case). -steve |
|
Steven Roussey |
☆PhistucK
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
Steven Roussey
I gather data about the state in between scripts running. See Though you already know about that one. -steve |
|
Steven Roussey |