Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. 20:20 < gregglind> Sorry to ask Jetpack questions :(
  2. 20:20 < gregglind> is `instanceof Object` ... reliable or funky across modules in jetpacks?
  3. 20:21 < gregglind> i have observed that Error is funky as well.
  4. 20:21 < gregglind> I am not even sure how to phrase it.
  5. 20:25 < The_8472> each module has its own global, including separate instances of the primordial types such as Object, Error, etc.
  6. 20:26 < The_8472> (foo !== null && typeof foo === "object") to check for objectness
  7. 20:27 < The_8472> or you can export the constructor function from that module
  8. 20:28 < The_8472> then foo instanceof MyClass should work. i think.
  9. 20:29 < gregglind> The_8472: different frames :)
  10. 20:29 < The_8472> yes, same thing
  11. 20:29 < gregglind> Thanks for confirming this is at least real.
  12. 20:30 < gregglind> 20:27 < The_8472> or you can export the constructor function from that module <- eplain this a bit more :)
  13. 20:30 < gregglind> so, module M has the isinstance check
  14. 20:31 < gregglind> then in module Q i need to make sure to create things using M's constructors?
  15. 20:32 < gregglind> also, this is going to be a big problem because the actual nasty code is imported `jsonschema` which is littered with this :)
  16. 20:32 < The_8472> no, Q can export the constructor (if it makes sense to have it public) then M can do instanceOfFooInM instanceof q.FooConstructor
  17. 20:32 < gregglind> noted, thanks.
  18. 20:32 < gregglind> this is going to be tough one :)
  19. 20:33 < The_8472> there also is a hacky way with chrome privileges
  20. 20:33 < The_8472> let otherGlobal = Components.utils.getGlobalForObject(foo); foo instanceof otherGlobal.Object
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement