Notes on MouseLock DOM Implementation Nov 13, 2011

From CDOT Wiki
Jump to: navigation, search

First attempt at putting MouseLockable and navigator.pointer into the DOM:

https://github.com/humphd/mozilla-central/commit/951c8b505b2be1e4503f1a252e2384b75787eb34

This throws:

var pointer = navigator.pointer
[Exception... "Failure arg 0 [nsIDOMNavigator.pointer]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: Web Console :: <TOP_LEVEL> :: line 1"  data: no]

And in a debug build I see:

###!!! ASSERTION: This XPCOM object fails in QueryInterface to nsISupports!: 'Error', file /Users/dave/repos/mozilla-central/js/xpconnect/src/XPCWrappedNative.cpp, line 352

So I got to irc, first #introduction, then #developers

10:10 <@humph> Ms2ger: you around?
10:10 < Ms2ger> Yep
10:11 <@humph> got a few mins to look at something with me?
10:11 < Ms2ger> Sure
10:11 <@humph> I think I'm doing some dom wiring wrong
10:11 <@humph> I've added navigator.pointer which gives an nsIDOMMouseLockable
10:11 <@humph> https://github.com/humphd/mozilla-central/commit/951c8b505b2be1e4
503f1a252e2384b75787eb34#L1R767
10:12 <@humph> sorry
10:12 <@humph> https://github.com/humphd/mozilla-central/commit/951c8b505b2be1e4
503f1a252e2384b75787eb34
10:12 <@humph> and it is throwing when I try to get the pointer (in js)
10:13 <@humph> I'm wondering if I'm missing various macro magic that's causing 
               it to dislike handing this object out to js
10:14 < Ms2ger> What does it throw?
10:14 <@humph> let me get it, sec
10:14 <@humph> http://pastebin.mozilla.org/1381808
10:16 < Ms2ger> Huh
10:16 <@humph> exactly what I'm thinking
10:16 <@humph> I wondered if the absencd of CC macros and such was the issue
10:16 <@humph> that it wasn't "dom ready" as it were
10:17 <@humph> absence*
10:18 < Ms2ger> You shouldn't need CC macros to get it to work
10:18 <@humph> this is what I hoped
10:18 < Ms2ger> Do you have a raw diff I can apply?
10:18 <@humph> I can get one
10:19 < Ms2ger> Hmm
10:20 <@humph> http://pastebin.mozilla.org/1381809
10:26 < jdm> the code doesn't look incorrect to me :<
10:27 <@humph> yeah, that's my issue, I can't see where to start fixing
10:27 <@humph> it *feels* right to me
10:27 < jdm> huh, "failure arg 0"
10:27 <@humph> but the browser disagrees
10:27 < jdm> that sounds like a searchable string
10:28 < jdm> humph: you'll need to update the IID of nsIDOMNavigator, but I 
             don't think that's the problem
10:28 <@humph> ah yes
10:28 < Ms2ger> Shouldn't be
10:29 -!- ehsan_ [ehsan@F0B20A8D.8458880F.57F33CED.IP] has quit [Input/output 
          error]
10:30 < jdm> ew, I forgot that searching for failure gives me every 
             NS_ERROR_FAILURE
10:31 < khuey> heh
10:32 <@humph> yes, I resisted the urge to narrow it to 'failure' :)
10:30 < jdm> ew, I forgot that searching for failure gives me every 
             NS_ERROR_FAILURE
10:31 < khuey> heh
10:32 <@humph> yes, I resisted the urge to narrow it to 'failure' :)
...
10:27 < Ms2ger> smaug, do you see anything wrong with 
https://github.com/humphd/mozilla-central/commit/951c8b505b2be1e4503f1a252e2384b75787eb34 ?
10:27 < Ms2ger> Throws http://pastebin.mozilla.org/1381808
10:27 < smaug> looking
10:27 -!- TheOne [one@moz-15C7E50B.dip.t-dialin.net] has joined #developers
10:28  * lurking_work wishes that the AV companies would do away  with invasive 
          toolbars - they are NOT needed IMO
10:28 -!- dao [dao@moz-5735B28F.superkabel.de] has joined #developers
10:29 < smaug> Ms2ger: nsNavigator doesn't QI to nsIDOMMouseLockable ?
10:29 < smaug> er
10:29 -!- ehsan_ [ehsan@F0B20A8D.8458880F.57F33CED.IP] has quit [Input/output 
          error]
10:29 < Ms2ger> No
10:30 < smaug> no no
10:30 < smaug> yeah, I was reading the patch wrong
10:32 -!- TheOne [one@moz-15C7E50B.dip.t-dialin.net] has quit [Input/output 
          error]
10:32 < smaug> Ms2ger: I don't see anything wrong
10:32 < Ms2ger> Me neither
10:32 < smaug> lurking_work: indeed
10:33 -!- TheOne [one@moz-15C7E50B.dip.t-dialin.net] has joined #developers
10:33 < smaug> Ms2ger: what is throwing the exception?
10:33 < Ms2ger> humph, ^
10:33 < khuey> step out of hte call and see what goes wrong?
10:33 < smaug> something in quickstub or xpconnect?
10:33 -!- TheOne [one@moz-15C7E50B.dip.t-dialin.net] has quit [Input/output 
          error]
10:34  * lurking_work wonder if we could just block all AV toolbars without 
          getting into trouble with them
10:34 < humph> smaug: how do I answer that?
10:34 < jdm> smaug: looks like quickstub
10:34 < jdm> http://mxr.mozilla.org/mozilla-central/source/js/xpconnect/src/qsgen.py#1018
10:35 < Ms2ger> He hasn't quickstubbed anything
10:35 < Ms2ger> Unless
10:35 < humph> maybe I need to...?
10:35 < Ms2ger> nsIDOMNavigator.* is qs'ed
10:35 < Ms2ger> jdm, there's a space in the error message
10:36 < jdm> oh, good point
10:36 < jdm> bleah
10:37 < Ms2ger> Aha
10:37 < humph> hit me
10:37 < Ms2ger> http://mxr.mozilla.org/mozilla-central/source/js/xpconnect/src/X
PCThrower.cpp?mark=160-160#151
10:39 < Ms2ger> Try putting a breakpoint there, perhaps

The fix turns out to be that I'm not implementing the QI stuff, and the fix is easy: https://github.com/humphd/mozilla-central/commit/a9eec122f119d705196664901571dd8e2184a9c2