Bug 1669961 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.

In a JSWindowActorChild, `this.document` and `this.contentWindow.document` can point to different objects.

For instance, in the patch at https://phabricator.services.mozilla.com/D92648#2985445 , when the document has not yet reached the "complete" readyState, the two objects will be different. Example of differences:
- `this.document.readyState` is "complete" while `this.contentWindow.document.readyState` is "loading"
- `this.document.location` is null while `this.contentWindow.document.location.href` points to the expected URL

Looking at the implementation https://searchfox.org/mozilla-central/rev/f82d5c549f046cb64ce5602bfd894b7ae807c8f8/dom/ipc/jsactor/JSWindowActorChild.cpp#76-109, the `document` getter is not relying on the `contentWindow` getter, which explains why the two objects can differ.

Is the difference intentional? If it is, are there guidelines or documentation to know when we should use `this.document` vs `this.contentWindow.document`? 

Filing
In a JSWindowActorChild, `this.document` and `this.contentWindow.document` can point to different objects.

For instance, in the patch at https://phabricator.services.mozilla.com/D92648#2985445 , when the document has not yet reached the "complete" readyState, the two objects will be different. Example of differences:
- `this.document.readyState` is "complete" while `this.contentWindow.document.readyState` is "loading"
- `this.document.location` is null while `this.contentWindow.document.location.href` points to the expected URL

Looking at the implementation https://searchfox.org/mozilla-central/rev/f82d5c549f046cb64ce5602bfd894b7ae807c8f8/dom/ipc/jsactor/JSWindowActorChild.cpp#76-109, the `document` getter is not relying on the `contentWindow` getter, which explains why the two objects can differ.

Is the difference intentional? If it is, are there guidelines or documentation to know when we should use `this.document` vs `this.contentWindow.document`?
In a JSWindowActorChild, `this.document` and `this.contentWindow.document` can point to different objects.

For instance, in the patch at https://phabricator.services.mozilla.com/D92648#2985445 , when the document has not yet reached the "complete" readyState, the two objects will be different. Example of differences:
- `this.document.readyState` is "complete" while `this.contentWindow.document.readyState` is "loading"
- `this.document.location` is null while `this.contentWindow.location.href` points to the expected URL

Looking at the implementation https://searchfox.org/mozilla-central/rev/f82d5c549f046cb64ce5602bfd894b7ae807c8f8/dom/ipc/jsactor/JSWindowActorChild.cpp#76-109, the `document` getter is not relying on the `contentWindow` getter, which explains why the two objects can differ.

Is the difference intentional? If it is, are there guidelines or documentation to know when we should use `this.document` vs `this.contentWindow.document`?

Back to Bug 1669961 Comment 0