On Thu, Jan 11, 2018 at 12:06 PM, Kris Maglione <kmagli...@mozilla.com> wrote:
> On Thu, Jan 11, 2018 at 05:12:37PM +0100, Tom Schuster wrote: > >> This could be an issue for WebExtensions as well. I think the >> contentscript >> sandbox runs in a different compartment. >> > > It runs in a different compartment, but the DOM constructors it has access > to come from the same content window as the nodes it would be checking, so > this isn't an issue. Oh, I guess Xrays behavior would be unaffected by Cameron's proposal. Ignore my previous message. > > 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