Bug 44827 - If an <object> is removed from the page while its fallback content is being used, Safari will automatically use fallback content when the object is re-inserted.
Summary: If an <object> is removed from the page while its fallback content is being u...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.6
: P2 Normal
Assignee: Ryosuke Niwa
URL: http://www.silverlight.net
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2010-08-28 12:43 PDT by Marc Hoyois
Modified: 2022-06-28 21:43 PDT (History)
5 users (show)

See Also:


Attachments
Simple Safari extension to reproduce the bug (5.35 KB, application/x-safari-extension)
2010-08-28 12:43 PDT, Marc Hoyois
no flags Details
Test case (346 bytes, text/html)
2022-06-27 14:45 PDT, Ryosuke Niwa
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Hoyois 2010-08-28 12:43:01 PDT
Created attachment 65837 [details]
Simple Safari extension to reproduce the bug

Overview:
The bug happens in the following situation. There is an <object> element with fallback content on a page and Safari is currently using its fallback content. If one then removes the <object> element from the DOM tree and re-insert it later on, Safari automatically uses the fallback content again. In particular, no beforeload event is fired by the <object> element when it is re-inserted.

Steps to reproduce:
1. Install the attached extension. It has a simple injected script which does the following:

-> It listens to beforeload events, ignoring events not fired by <object> elements
-> When an object element is detected, it calls event.preventDefault() and, within a setTimeout of 3 seconds, replaces the <object> by a red <div>
-> Clicking on the red <div> restores the original <object> element

2. (requires Silverlight plugin installed) Navigate to http://www.silverlight.net (for example). This page has a single <object> element with an image as fallback content. Observe the alert box confirming that the object has fired a beforeload event.

3. Observe that Safari uses the fallback image, since the <object> has been blocked, and wait three seconds for the image to be replaced by a red rectangle.

4. Click on the red rectangle.

Expected result:
Upon re-insertion, the <object> should fire a beforeload event again (triggering an alert box as in step 2), and the Silverlight content should load normally.

Actual result:
No beforeload event is fired and the Silverlight content does not load. Instead, the fallback image is used.

Build and platform:
Tested in OS X 10.6 with both Safari 5.0.1 and Webkit 6533.17.8 r66130.
Comment 1 Marc Hoyois 2010-08-28 13:23:35 PDT
Forgot to mention that the bug has a workaround:

Everything works as expected if, instead of restoring the original <object> element, one restores a clone element.cloneNode(true).
Comment 2 Ahmad Saleem 2022-06-24 08:44:23 PDT
NPAPI and Webkit Plugins are not supported any more. Can this be marked as "RESOLVED WONTFIX"? Thanks!
Comment 3 Ryosuke Niwa 2022-06-24 11:26:33 PDT
Hm... this is about object element's fallback content being displayed. It might be still relevant if the same issue reproduces with content type that's supported by object element like images and iframe.
Comment 4 Ryosuke Niwa 2022-06-27 14:45:53 PDT
Created attachment 460509 [details]
Test case

The test prints PASS on Firefox but FAIL on Chrome & Safari.
Comment 5 Ryosuke Niwa 2022-06-27 15:33:14 PDT
Pull request: https://github.com/WebKit/WebKit/pull/1836
Comment 6 EWS 2022-06-27 22:27:48 PDT
Committed 251903@main (fdae8b382e05): <https://commits.webkit.org/251903@main>

Reviewed commits have been landed. Closing PR #1836 and removing active labels.
Comment 7 Radar WebKit Bug Importer 2022-06-27 22:28:12 PDT
<rdar://problem/96037185>
Comment 8 Alexey Proskuryakov 2022-06-28 12:29:31 PDT
Sorry for accidentally marking this as WONTFIX among other ones.
Comment 9 Ryosuke Niwa 2022-06-28 21:43:20 PDT
(In reply to Alexey Proskuryakov from comment #8)
> Sorry for accidentally marking this as WONTFIX among other ones.

No problem. I figured you got confused with other bugs.