New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 915355 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 908135
Owner:
Closed: Dec 17
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Script onload function does not fire if added from an iframe that later gets removed

Reported by andrewpa...@gmail.com, Dec 14

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36

Steps to reproduce the problem:
See linked JSFiddle example reproduction:
https://jsfiddle.net/v35dz64L

Display only link: https://jsfiddle.net/v35dz64L/show

What is the expected behavior?
There should be 4 loaded script messages displayed on the page. There are four example scripts and each has a onload method that gets called and displays "loaded script [1-4]".

What went wrong?
In chrome 71 and later, script example 3 does not fire the onload method and the "loaded script 3" message does not display.

Did this work before? Yes 70.0.3538.110

Chrome version: 73.0.3640.0  Channel: n/a
OS Version: 10.0
Flash Version: 

A working workaround for chrome 71 and later is provided in the loaded script 4 example where instead of using script.onload = function(){}, the example sets a onload attribute on the element instead.

The cause of this issue seems related the fact that the iframe that adds the onload function is removed at a later time.

This jsfiddle reproduction link has also been tested to work correctly and show all 4 scripts onload functions working on Firefox Quantum 64.0, Internet Explorer 11, MS Edge 41.16299/EdgeHTML 16.16299, and Chrome 70.0.3538.110.
 
Labels: Needs-Triage-M73 Needs-Bisect
Bisected to r597054 = 1b2f95835607dbb9c6021df8893fb18f4c7aee9e = https://crrev.com/c/1215512 by yukiy@google.com
"Create new EventHandler and base class for EventListener/EventHandler"
Landed in 71.0.3572.0
Components: -Blink Blink>Bindings
Labels: -Pri-2 Hotlist-Interop Pri-1
Cc: yukiy@google.com susan.boorgula@chromium.org
Labels: -Needs-Bisect RegressedIn-71 ReleaseBlock-Stable Triaged-ET Target-71 Target-72 Target-73 M-71 FoundIn-71 FoundIn-73 FoundIn-72 hasbisect OS-Linux OS-Mac
Owner: haraken@chromium.org
Status: Assigned (was: Unconfirmed)
andrewpanfelsherpa@ Thanks for the issue.

Able to reproduce this issue on Windows 10, Ubuntu 17.10 and Mac OS 10.13.6 on the latest Stable 71.0.3578.98 and latest Canary 73.0.3642.0.

Bisect Information:
====================
Good Build: 71.0.3571.0
Bad Build : 71.0.3572.0

As per comment #2, suspecting the below Change.
Reviewed-on: https://chromium-review.googlesource.com/c/1215512

As the owner yukiy@ is not available, assigning the issue to reviewer haraken@.
haraken@ Please check and confirm if this issue is related to your change, else help us in assigning to the right owner.

Adding 'ReleaseBlock-Stable' for M-71 as this is a recent regression. Please feel free to remove if it is not applicable.

Thanks...
Cc: haraken@chromium.org
Owner: yukishiino@chromium.org
I think yukishiino is a better assignee for this one.
Labels: -ReleaseBlock-Stable
Mergedinto: 908135
Status: Duplicate (was: Assigned)

Comment 7 Deleted

Thanks for the information regarding the likely root cause.
I have since created another workaround where the iframe is removed at the end of the onload function, which ensures the iframe is not removed before the callback is fired.
JSFiddle: https://jsfiddle.net/andrewpanfelsherpa/smoapy0n/
For example script 5, I remove the iframe only after the "loaded script 5" message is written to the page. This does require more work, as the iframe will now be visible until the script has finished loading, and now also requires css to hide the iframe.
I do wish chrome would behave like every other browser in this regard, so no workaround would be required. Hope this example helps someone else.

Sign in to add a comment