зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1741181 - NotifyRequestDestroy() only when the manager is alive r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D131535
This commit is contained in:
Родитель
db1fb88e14
Коммит
220a38db00
|
@ -4859,6 +4859,15 @@ class Document : public nsINode,
|
|||
uint32_t mLazyLoadImageReachViewportLoaded;
|
||||
|
||||
uint32_t mContentEditableCount;
|
||||
/**
|
||||
* Count of the number of active LockRequest objects, including ones from
|
||||
* workers. Note that the value won't be updated while the document is being
|
||||
* destroyed.
|
||||
*
|
||||
* TODO(krosylight): We may want to move this to window object instead, but
|
||||
* it's not clear whether the spec relates locks to the window/agent or the
|
||||
* document. See also https://github.com/WICG/web-locks/issues/95.
|
||||
*/
|
||||
uint32_t mLockCount = 0;
|
||||
EditingState mEditingState;
|
||||
|
||||
|
|
|
@ -54,8 +54,12 @@ LockRequestChild::LockRequestChild(
|
|||
}
|
||||
|
||||
void LockRequestChild::ActorDestroy(ActorDestroyReason aReason) {
|
||||
if (aReason != ActorDestroyReason::AncestorDeletion) {
|
||||
// Ping the manager if it's still alive, otherwise we don't have to as the
|
||||
// document is being destroyed
|
||||
CastedManager()->NotifyRequestDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
IPCResult LockRequestChild::RecvResolve(const LockMode& aLockMode,
|
||||
bool aIsAvailable) {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="test-wait">
|
||||
<meta charset="utf-8">
|
||||
<iframe id="id_0"></iframe>
|
||||
<script>
|
||||
/** @param {HTMLIFrameElement} iframe */
|
||||
function waitForLoad(iframe) {
|
||||
// iframe is initialized immediately on Chrome while it needs some time on Firefox
|
||||
if (iframe.contentDocument.readyState === "complete") {
|
||||
return;
|
||||
}
|
||||
return new Promise(r => iframe.onload = r);
|
||||
}
|
||||
|
||||
const iframe = document.getElementById("id_0");
|
||||
iframe.contentWindow.navigator.locks.request("weblock_0", async () => {
|
||||
await waitForLoad(iframe);
|
||||
document.body.append(iframe);
|
||||
await waitForLoad(iframe);
|
||||
document.documentElement.classList.remove("test-wait");
|
||||
});
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче