Closed Bug 1813499 Opened 2 years ago Closed 2 years ago

Element prototype modified by appending it into iframe

Categories

(Core :: DOM: Core & HTML, defect)

Firefox 109
defect

Tracking

()

RESOLVED DUPLICATE of bug 1470017

People

(Reporter: sad, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

Steps to reproduce:

iframe = document.createElement("iframe");
document.body.appendChild(iframe);
div = document.createElement("div");
HTMLElement.prototype.test = 2;
console.log(div.test);
iframe.contentDocument.body.appendChild(div);
console.log(div.test);
console.log(div instanceof HTMLElement)
console.log(div instanceof iframe.contentDocument.defaultView.HTMLElement)

Actual results:

These are the logs of the previous snippet:
2
undefined
false
true

Expected results:

This is what I expected to be logged, and also the behaviour in firefox 108 (and chrome):
2
2
true
false

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core

peterv: Do you have any ideas about this?

Flags: needinfo?(peterv)
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1470017
Flags: needinfo?(peterv)
Resolution: --- → DUPLICATE

I was under the incorrect impression that this was a regression introduced by firefox 108 but it was a result from my incorrect testing. I can confirm that this behaviour is in fact not new and I don't have a strong opinion on whether this should be changed, please disregard.

You need to log in before you can comment on or make changes to this bug.