While implementing the browsingContext.historyUpdated event for WebDriverBidi, we noticed an inconsistency for iframes created via the Debugger API compared to regular iframes. Both DevTools and BiDi use `executeInGlobalWithBindings` in order to evaluate code so they are both affected in the same way.
The issue occurs when adding an empty iframe dynamically in a page and calling `document.open()` on its document:
```js
const frame = document.createElement("iframe");
document.body.append(frame);
frame.contentDocument.open();
console.log(frame.contentDocument.location.href);
```
At this point, per 12.1 of https://html.spec.whatwg.org/#document-open-steps `frame.contentDocument.location.href` should be the URL of the parent page. This is the case when this script is coming from the content page. But evaluating it from DevTools we get about:blank. See attached test case.
Bug 1968705 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
While implementing the browsingContext.historyUpdated event for WebDriverBidi, we noticed an inconsistency for iframes created via the Debugger API compared to regular iframes. Both DevTools and BiDi use `executeInGlobalWithBindings` in order to evaluate code so they are both affected in the same way.
The issue occurs when adding an empty iframe dynamically in a page and calling `document.open()` on its document:
```js
const frame = document.createElement("iframe");
document.body.append(frame);
frame.contentDocument.open();
console.log(frame.contentDocument.location.href);
```
At this point, per 12.1 of https://html.spec.whatwg.org/#document-open-steps `frame.contentDocument.location.href` should be the URL of the parent page. This is the case when this script is coming from the content page. But evaluating it from DevTools we get `about:blank`. See attached test case.