mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1748342, don't start FileReader's timer if the worker is shutting down, r=dom-worker-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D135078
This commit is contained in:
parent
a3884ad516
commit
4ea70a7334
@ -501,6 +501,14 @@ JSObject* FileReader::WrapObject(JSContext* aCx,
|
||||
}
|
||||
|
||||
void FileReader::StartProgressEventTimer() {
|
||||
if (!NS_IsMainThread() && !mWeakWorkerRef) {
|
||||
// The worker is possibly shutting down if dispatching a DOM event right
|
||||
// before this call triggered an InterruptCallback call.
|
||||
// XXX Note, the check is limited to workers for now, since it is unclear
|
||||
// in the spec how FileReader should behave in this case on the main thread.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mProgressNotifier) {
|
||||
mProgressNotifier = NS_NewTimer(mTarget);
|
||||
}
|
||||
|
26
dom/file/tests/crashtests/1748342.html
Normal file
26
dom/file/tests/crashtests/1748342.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script id="worker1" type="javascript/worker">
|
||||
self.onmessage = async function (e) {
|
||||
self.close()
|
||||
const reader = new FileReader()
|
||||
for (let i = 0; i < 25; i++) {
|
||||
try { reader.readAsBinaryString(e.data[0]) } catch (e) {}
|
||||
}
|
||||
reader.addEventListener("progress", () => {}, {})
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
window.addEventListener("load", () => {
|
||||
const script = new Blob([document.querySelector("#worker1").textContent], { type: "text/javascript" })
|
||||
const worker = new Worker(window.URL.createObjectURL(script))
|
||||
const data = new Blob(["70\nℽ㮼٠\0𛃧كe۰҅妽𝅧𡴶𝌋쮁偵97\r𐇽0🥂.\b፟+⍳፟D3𣚽🐾<F3A09C8E>c_߰a<<=𝅦9𝆭𛰅9ௌΐ0<CE90>⡖‑뢈/-᭰*٠٪᷁e <65>‑걢V*=**\u2028שּׁ&0󠄯e\n𛰵𫍰,𝅥t\nl𧶈a𦜠09k䴋<F0AF9486>|󠄷🦻𖭄", "*۰0\u2029/\n\r+𖼣k*=\r٪\r慑B<E68591>\r\r\n\"\r\\۹c卑4鴗ꛌ\0⌕:\r\n𝚨9ꛅ٠\nJ9\r゙鈷P\u2029҉۹e \b緁︡𤆥^゚|٫揅ᷛ𩊜s2凅9c8H𦰤-\f%٠𨮫‑2𫈮P𝋄窥57\n-゙҄H𣃂-ᷢשּׁ貌솽|𝉃c㙡᭯mL\r"], {
|
||||
"type": "image/png",
|
||||
"endings": "transparent"
|
||||
})
|
||||
worker.postMessage([data], [])
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
@ -1,3 +1,4 @@
|
||||
skip-if(ThreadSanitizer) load 1480354.html
|
||||
load 1562891.html
|
||||
skip-if(Android||ThreadSanitizer) load 1747185.html # Crashes on Android, times out on TSan.
|
||||
load 1748342.html
|
||||
|
Loading…
Reference in New Issue
Block a user