Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use shadow DOM for rendering <object>/<embed> #7244

Merged

Conversation

Rob--W
Copy link
Member

@Rob--W Rob--W commented Apr 23, 2016

Multiple shadow roots are not supported any more in Chrome 51+ (https://crbug.com/603448#c6), so this patch changes the way that PDF are rendered in <embed> / <object> tags.

I used shadow roots because their content is not visible from the web page, so the odds of conflicts were minimal. Now I have to render the PDF frame directly in the page, which can be observed from the page (unfortunately).

Now the following happens when an embedded PDF tag is detected:

  • <embed> tags: The type and src attributes are updated.
  • <object> tags: The type attribute is changed and the fallback content is set and displayed.

Tested as follows:

  1. Optional: Check out to pull/7202/head (Refactors dependencies of PDFViewerApplication on external services #7202), because in the current master, the Chrome extension fails at loading any PDFs because of an undefined ChromeCom reference.
  2. Visit http://pdfobject.com/static.html
  3. Observe that PDF.js is shown in all <embed> and <object> tags.
  4. Repeat step 2 and 3 for each of the following cases:
    • Visit chrome://plugins, disable the built-in PDF viewer.
    • Enable the built-in PDF viewer again, and enable click-to-play plugins ("Let me choose when to run plugin content" at https://support.google.com/chrome/answer/142064).
    • (by default the built-in viewer is enabled and set to run automatically)
  5. Optional: Try the test cases from <object> / <embed> support in Chrome / Opera #4549.

Verified in Chromium 35.0.1916.15 / 49.0.2623.75 / 50.0.2661.75 / 52.0.2714.0 on Linux.

Fixes #7220

Multiple shadow roots are not supported any more in Chrome 51+
(https://crbug.com/603448#c6), so this patch changes the way that PDFs
are rendered in `<embed>` / `<object>` tags.

I used shadow roots because their content is not visible from the web
page, so the odds of conflicts were minimal. Now I have to render the
PDF frame directly in the page, which can be observed from the page
(unfortunately).

Now the following happens when an embedded PDF tag is detected:

- `<embed>` tags: The type and src attributes are updated.
- `<object>` tags: The type attribute is changed and the fallback
  content is set and displayed.
@timvandermeij timvandermeij merged commit 8dcc727 into mozilla:master May 9, 2016
@timvandermeij
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants