Both of these become self-contained with their own arena, which can be cleaned
up when (a) we don't need it anymore and (b) v8 doens't need it. The "we don't
need it anymore" is true when there's nothing being observed.
The underlying records also get their own arena and are handed off to v8 to
finalize whenever they fall out of scope.
Not sure if this should be in `EventTarget` or `EventManager`, here goes nothing.
`Image`: dispatch `load` event when `src` set
add load event test
remove `hasListener`
let `Scheduler` dispatch `load` event
Simulates async nature.
update test
free `args` when done
implement `load` event dispatch for `<img>` tags
This dispatches `load` events tied to `EventManager` but not the `onload` for some reason...
`"load"` event must be dispatched even if `onload` not set
Resolves the bug that cause event listeners added through `EventTarget` not executing if `onload` not set.
add `onload` getter/setter for `Image`
prefer `attributeChange` to run side-effects
This should give more consistent results than using `setSrc`.
add inline `<img src="..." />` test
`Image`: prefer `inline_lookup` for `onload`
remove incorrect URL check + prefer 0ms in `Scheduler`
change after rebase
On a blocking request that requires authentication, we now handle the two cases
correctly:
1 - if the request is aborted, we don't continue processing (if we did, that
would result in (a) transfer.deinit being called twice and (b) the callbacks
being called twice
2 - if the request is "continue", we queue the transfer to be re-issued, as
opposed to just processing it as-is. We have to queue it because we're
currently inside a process loop and it [probaby] isn't safe to re-enter it.
By using the queue, we wait until the next call to `tick` to re-issue the
request.
First, for macrotasks, it ensures that the correct context is entered.
More important, for microtasks, it protects against use-after-free. This is
something we already did, to some degree, in page.deinit: we would run
microtasks before erasing the page, in case any microtasks referenced the page.
The new approach moves the guard to the context (since we have multiple
contexts) and protects against a microtasks enqueue a new task during shutdown
(something the original never did).
This seems to solve some potential use-after-free issues. By informing the
Inspector that the context is gone, it seems to effectively ensure that no more
messages are sent from the inspector for things related to the context.