This could be an issue for WebExtensions as well. I think the contentscript sandbox runs in a different compartment.
On Thu, Jan 11, 2018 at 3:58 PM, Gijs Kruitbosch <gijskruitbo...@gmail.com> wrote: > On 11/01/2018 05:29, Cameron McCormack wrote: > >> For use in the meantime, I just landed bug 1428531 on inbound, which adds >> a new chrome-only static method "isInstance" to Web IDL defined interfaces, >> so you can write for example: >> >> Document.isInstance(otherWindow.document) >> >> So that we don't have even more call sites we need to fix up once we >> start looking at bug 1360715, please try to use isInstance rather than >> instanceof if you need to do cross-context DOM object tests from chrome JS. >> > > Assuming we're happy to update all sites (not only sites where we're sure > the DOM instance is sometimes cross-context), this type of thing is > relatively easy to automatically rewrite with an xpcshell script like the > ones Florian has been using to update other conventions (e.g. use of > Services.prefs instead of manually Cc[...].getService(Ci.nsIPrefBranch) > etc. ). If we rewrite the extant callsites, we can add eslint checks that > warn and can do similar rewrites for people, which will be better at > avoiding new callsites than just convention (which people are liable to > forget in a few days/weeks/months), and would make the transition > relatively "easy". > > ~ Gijs > > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform