Closed Bug 1590718 Opened 5 years ago Closed 5 years ago

RemoteWebNavigation redefines load flags with different values from nsIWebNavigation

Categories

(Core :: DOM: Navigation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: Gijs, Assigned: Gijs)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I haven't fully looked at repercussions because I'm on a hispeed train and connectivity is mediocre at best. But the one I noticed in bug 1588118 is:

nsIWebNavigation.idl:
const unsigned long LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x100000;
( https://searchfox.org/mozilla-central/source/docshell/base/nsIWebNavigation.idl#211 )
RemoteWebNavigation.jsm:
LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP: 8192,
https://searchfox.org/mozilla-central/source/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm#44

As far as I can tell this has been broken since 2013 (bug 822367 and bug 900675 are what annotate throws up, though I haven't investigated if they're just moving things and didn't notice - see above point about connectivity).

As johannh noted on slack, I think there aren't really users of the "wrong" flag here.

It also seems that from outside the class, accessing it gives you the interface value (!?). That is, in my browser console, after loading any website that loads in the content process:

> gBrowser.selectedBrowser.webNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP
< 1048576
> gBrowser.selectedBrowser.webNavigation.wrappedJSObject.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP
< 8192

So that kind of helps, maybe? I think this is thanks to XPCOM-related wrappers of the JS thing.

Checking the other flags programmatically on nightly yields:

for (let k in gBrowser.selectedBrowser.webNavigation) {
  if (k.startsWith("LOAD_FLAGS") && gBrowser.selectedBrowser.webNavigation[k] !== gBrowser.selectedBrowser.webNavigation.wrappedJSObject[k]) {
    console.log(k, gBrowser.selectedBrowser.webNavigation[k], gBrowser.selectedBrowser.webNavigation.wrappedJSObject[k]);
  }
}
LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP 1048576 8192
LOAD_FLAGS_ALLOW_MIXED_CONTENT 8192 undefined
LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL 262144 undefined
LOAD_FLAGS_ERROR_LOAD_CHANGES_RV 524288 undefined
LOAD_FLAGS_FIXUP_SCHEME_TYPOS 2097152 undefined
LOAD_FLAGS_FORCE_ALLOW_DATA_URI 4194304 undefined
LOAD_FLAGS_IS_REDIRECT 8388608 undefined

So there's 6 flags that aren't even defined, and the broken ALLOW_THIRD_PARTY_FIXUP one.

Auditing these turned up https://searchfox.org/mozilla-central/rev/088e2cf29c59d733d57af43903eb0267dbf72e2a/mobile/android/geckoview/api.txt#608-615 which I don't understand.

Ignoring that for the moment, everyone seems to use the interface to look up these constants, save for reader mode using LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL off of an actual docshell reference (which is fine).

I'll put up a patch to just rm-rf the RemoteWebNavigation copies.

Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
See Also: → 1590993
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/ab7d802dcfdb
remove bogus unused constants (one with wrong value) from RemoteWebNavigation, r=johannh
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: