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

codepen.io - The text is not highlighted correctly #118350

Closed
danielschneider22 opened this issue Feb 16, 2023 — with webcompat-app · 11 comments
Closed

codepen.io - The text is not highlighted correctly #118350

danielschneider22 opened this issue Feb 16, 2023 — with webcompat-app · 11 comments
Labels
browser-firefox engine-gecko The browser uses the Gecko rendering engine os-mac Issues only happening on macOS. os-win Issues only happening on Windows. priority-normal severity-important A non-core broken piece of functionality, not behaving the way you would expect. status-needsinfo
Milestone

Comments

@danielschneider22
Copy link

URL: https://codepen.io/danielunstack/pen/zYJGrKo?editors=1111

Browser / Version: Firefox 109.0
Operating System: Mac OS X 10.15
Tested Another Browser: No

Problem type: Something else
Description: Firefox Release 109.0.1 Causing Iframe Issue
Steps to Reproduce:
Discrepancy between last version of Firefox and the latest version

  1. Install Firefox version 108.0.2
  2. Go to https://codepen.io/danielunstack/pen/zYJGrKo?editors=1111.
  3. View the console output. The div element within the iframe is classified as an HTMLElement
  4. Upgrade Firefox to version 109.0.1
  5. Go to https://codepen.io/danielunstack/pen/zYJGrKo?editors=1111.
  6. View the console output. The div element within the iframe is NOT classified as an HTMLElement

This discrepancy is causing production issues for us.

Thanks!

Browser Configuration
  • None

From webcompat.com with ❤️

@webcompat-bot webcompat-bot added this to the needstriage milestone Feb 16, 2023
@webcompat-bot webcompat-bot added browser-firefox priority-normal engine-gecko The browser uses the Gecko rendering engine labels Feb 16, 2023
@softvision-raul-bucata softvision-raul-bucata added the os-mac Issues only happening on macOS. label Feb 17, 2023
@sv-calin
Copy link

Thanks for the report. Is this the message from the console are you reffering to?

image

[inv_07/2023]

@danielschneider22
Copy link
Author

Excellent point! My example was a poor reflection of the problem faced as it looks the same in chrome and firefox.

The true issue stems from elements added to the top level document, but that are placed as children within the iframe. It looks like these are treated differently in the latest firefox vs chrome and older versions of firefox.

I've updated my codepen to show this and am showing a screenshot below of chrome, firefox 108.02, and the latest version of firefox.

In older versions of firefox and chrome, elements added are HTMLElements. In the latest firefox versions elements are not HTMLElements.

View the screenshotScreenshot

@sv-calin
Copy link

I was able to reproduce this issue on Windows 10 as well.

image

Tested on:
• Browser / Version: Firefox Nightly 112.0a1 (2023-02-19) / Firefox Release 110 / Chrome 110.0.5481.100
• Operating System: Windows 10

Notes:

  1. Reproducible on both Firefox Release and Nightly
  2. Not reproducible on Chrome

Moving to Needsdiagnosis.

[inv_08/2023]

@sv-calin sv-calin added severity-important A non-core broken piece of functionality, not behaving the way you would expect. os-win Issues only happening on Windows. labels Feb 20, 2023
@sv-calin sv-calin modified the milestones: needstriage, needsdiagnosis Feb 20, 2023
@sv-calin sv-calin changed the title codepen.io - see bug description codepen.io - The text is not highlighted correctly Feb 20, 2023
@danielschneider22
Copy link
Author

Hey @sv-calin , any update on this? This is still causing production issues for our team.

@sv-calin
Copy link

sv-calin commented Mar 9, 2023

I'm sorry but there are not updates at the moment, this is still under investigation.

[inv_10/2023]

@danielschneider22
Copy link
Author

No worries, appreciate the update that it’s still being investigated

@ksy36
Copy link
Contributor

ksy36 commented Mar 10, 2023

This is related to https://bugzilla.mozilla.org/show_bug.cgi?id=1769620 and the changes made in https://bugzilla.mozilla.org/show_bug.cgi?id=1360715.

I've filed https://bugzilla.mozilla.org/show_bug.cgi?id=1821790 for further investigation. There seems to be a difference in instanceof behaviour when used in an iframe in Firefox vs Chrome since 1360715 was shipped.

It returns false in Firefox when instanceof HTMLElement is called as the @danielschneider22 mentioned. And returns true when the iframe window (instanceof iframe.contentWindow.HTMLElement) checked instead. The results in Chrome are exact opposite.

@danielschneider22 while this is being investigated, wonder if applying instanceof iframe.contentWindow.HTMLElement could possibly help as a temporary solution?

So it will be something like:

if( el2 instanceof HTMLElement || el2 instanceof iframe.contentWindow.HTMLElement){

@ksy36 ksy36 modified the milestones: needsdiagnosis, moved Mar 10, 2023
@danielschneider22
Copy link
Author

Yup, good call! That’s a great workaround, but it’s unfortunately a problem in one of node packages we are importing which makes it trickier to implement that solution.

Thanks for the update here though

@ksy36
Copy link
Contributor

ksy36 commented Mar 14, 2023

@danielschneider22 thanks for the update. Wonder which node package are you using? Just trying to understand how widespread this issue is.

@danielschneider22
Copy link
Author

The node package we are using that is creating issues is quill.js. https://quilljs.com/

@ksy36
Copy link
Contributor

ksy36 commented Mar 20, 2023

@danielschneider22 Thanks for your response. I've tried to create a test case using an iframe with quill js locally, and it seems to be working fine. But I imagine your usecase is more complex than that. Wonder if you could possibly provide a testcase with quill js included? That would help us with prioritizing the issue.

(For my test case I used this example code from quill documentation site locally in an iframe).

A bit more context from investigation in comment 3:

Before v. 109 instanceof behavior returned true regardless of the realm the object is from (i.e. regardless whether it's in an iframe). So from the testcase provided here both of these returned true:

    `el2 instanceof HTMLElement` > true
    `el2 instanceof iframe.contentWindow.HTMLElement` > true

To match other browsers this has been changed in 1360715 to take into account the current realm, so it results in:

    `el2 instanceof HTMLElement` > true
    `el2 instanceof iframe.contentWindow.HTMLElement` > false

(given that el2 is created with document.createElement("div") and not iframe.contentWindow.document.createElement).

It matches in all browsers to this point, however once this element is appended with el.appendChild(el2) it changes the appended node prototype in Firefox:

    `el2 instanceof HTMLElement >  false`
    `el2 instanceof iframe.contentWindow.HTMLElement >  true`

In Chrome it remains the same:

    `el2 instanceof HTMLElement >  true`
    `el2 instanceof iframe.contentWindow.HTMLElement >  false`

So this compatibility issue has been around for some time and tracked in https://bugzilla.mozilla.org/show_bug.cgi?id=1470017. It's related to node adoption and not instanceof behavior, but only surfaced after 1360715 was shipped.

dmo-odoo added a commit to odoo-dev/odoo that referenced this issue Apr 27, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
robodoo pushed a commit to odoo/odoo that referenced this issue Apr 28, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

closes #120003

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this issue Apr 28, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

X-original-commit: c0da01c
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this issue Apr 28, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

X-original-commit: c0da01c
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this issue Apr 28, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

X-original-commit: c0da01c
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this issue Apr 28, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

X-original-commit: c0da01c
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this issue Apr 28, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

X-original-commit: c0da01c
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
robodoo pushed a commit to odoo/odoo that referenced this issue May 2, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

closes #120112

X-original-commit: c0da01c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
robodoo pushed a commit to odoo/odoo that referenced this issue May 2, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

closes #120157

X-original-commit: c0da01c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
robodoo pushed a commit to odoo/odoo that referenced this issue May 2, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

closes #120122

X-original-commit: c0da01c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
robodoo pushed a commit to odoo/odoo that referenced this issue May 2, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

closes #120141

X-original-commit: c0da01c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
robodoo pushed a commit to odoo/odoo that referenced this issue May 2, 2023
Starting with Firefox 109, a widget element prototype that is put
inside an iframe will not be instanceof its original constructor.
See: webcompat/web-bugs#118350

This is because a node that is adopted by an iframe will have its
prototype changed to match the constructor from within the iframe
instead of its original one. This has been the case for a long time.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1470017

It largely went unnoticed because of another quirk of Firefox related
to the use of instanceof which was fixed in version 109.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1360715

Since this bug was fixed it became apparent, in the form of a
traceback, that the wrong instance of ClipboardJS was being used
in the case of Firefox, due to the forced prototype change.

This commit could be reverted once Firefox is fixed.

Steps to reproduce the issue in Firefox > 109:
- Create a new mass mailing.
- Choose the third template with "Thank you for joining us!".
- Click on the "LOGIN" button link inside the email.
- Get a traceback about a paremeter not being the right type.

Task-3186513
OPW-3172914

closes #120171

X-original-commit: c0da01c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Jinjiu Liu <jili@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser-firefox engine-gecko The browser uses the Gecko rendering engine os-mac Issues only happening on macOS. os-win Issues only happening on Windows. priority-normal severity-important A non-core broken piece of functionality, not behaving the way you would expect. status-needsinfo
Projects
None yet
Development

No branches or pull requests

5 participants