Archive

Archive for November, 2011

Release 0.3!

November 23, 2011 Leave a comment

Whew! It’s been a while but my 0.3 has now been released! In this release, I’ve been working on Paladin/configurator subsystem. By now, it has become quite mature and achieves all required functionality. Also being used is IndexedDB as the load/store backend. Also important is that the codebase has now been brought up-to-date with the rest of the engine.

Changelog:

  • Added comments to all of the Configurator tests that didn’t have any. Improved some of the comments that were there before as well as improving some test structures slightly.
  • Removed Cookie.js from the engine. Cookies are no longer used as load/store backend, now replaced with IndexedDB.
  • Many functions had vague local variable names; their names have been improved.
  • load/store are now both asynchronous.
  • Added config/default.js for local configurations that need to be baked into the engine.
  • Configurator now uses gameID to load/save configurations.
  • Brought Configurator codebase up-to-date.

commit: a94ea288daabd84ea222a5a08da78ec4095479b3

issue thread: https://github.com/alankligman/gladius/issues/21

pull request: https://github.com/alankligman/gladius/pull/52

I also have some work to do for XSS Me but that has taken a back-seat to the work on Paladin. Currently, the plan is to dedicate most of 0.4 towards XSS Me. We’ll see how this all pans out.

Advertisements

X-Men. On netflix.

November 15, 2011 Leave a comment

In other news, X-Men.

JACKPOT! AGAIN! And this time for something more/less nerdy:

X-MEN!!!! From your childhood. On netflix. So much win. I clicked play today and I was so impressed by how this show beats the shit out of every other kid’s show on the air right now. Voice acting is godly and the jokes are hilarious. WATCH EPISODE 1 NOW!

Non-Netflix Member Link: https://signup.netflix.com/movie/X-Men/70172490
Netflix Member Link: http://ca.movies.netflix.com/WiMovie/X-Men/70172490?trkid=4022489

For some strange reason, if you’re signed into netflix, you can’t view the non-netflix link and vice versa with the other link.

Rome

November 15, 2011 4 comments

Rome is awesome. Rome is a build server that is speedy and hooked up to a fat pype ( I was getting ~5.5MB/s downloading from github ( ! )  ). I got acquainted with Rome just tonight when I asked @humph for an account on it ( which he kindly obliged ❤ ). Long story short, complete make do nothing cycle in ~52 seconds; this is down from ~10 minutes on my supercomputer of a laptop. To get started, follow the following easy steps:

  1. Ask @humph to get you an account on Rome.
  2. Configure your environment to forward X11 to a local X11 server. On Linux, this should be as simple as passing -CX to ssh when connecting. On Windows, this is a bit more involved but boils down to the following steps:
    1. Get Xming
    2. Start Xming.
    3. Start PuTTy.
    4. In the options on the left, select Connection -> SSH -> X11
    5. On this window, click “Enable X11 forwarding” and in the box labeled “X display location” enter 127.0.0.1:0.0
    6. You probably want to save your configuration options. Switch back to the session options by selecting Session in the options on the left.
    7. Enter a reasonable name for this configuration, something like 01 – Rome should be fine.
    8. Enter rome.proximity.on.ca as the server address.
    9. Hit save and you should now be set to login and forward X11!
  3. Execute any application that you desire. In the case of our firefox build, you will probably want to call the debug firefox binary. This should be as simple as navigating to the top-level of your mozilla-central repo and calling:
    [whatever your build directory is]/dist/bin/firefox -ProfileManager -no-remote

    • If you already have a profile that you like to use on this machine for nightlies, you can substitute -ProfileManager on the commandline with -P [whatever the profile name is]
    • Obviously, you will need to build firefox first before you can call the binary 😉
  4. Sit back, relax and enjoy the lightning speed builds.

0.3 Coming Up Fast

November 14, 2011 Leave a comment

So the due date for 0.3 is coming up soon and I’m honestly just a tad bit worried… The project that I’ve picked up for 0.3 ( migrating XSS Me to web workers ) is proving to be too big for the time that I have left for 0.3 so I’m thinking that I’ll push most of the work that has to go into it to 0.4 with some preliminary work done for 0.3 but I’m wondering if that will be enough…

As for Paladin, unfortunately the guys are fairly busy so for now I’m just waiting till they have some time to take another look at the issue thread. Still, I’m confident that my questions will get some attention at some point and until then… I only have to wait.

Done and Done, Pt. 2

November 13, 2011 5 comments

Success! I’ve managed to alter the reported location of the cursor! Here’s what I did to get it to work:

The file that I had to modify was content/events/src/nsDOMMouseEvent.cpp, this is the implementation file of the DOM MouseEvent in firefox.
The updates were as follows:

// ... snip ... line 223

NS_METHOD nsDOMMouseEvent::GetScreenX(PRInt32* aScreenX)
{
  NS_ENSURE_ARG_POINTER(aScreenX);
  //*aScreenX = GetScreenPoint().x;
  *aScreenX = 17000;
  return NS_OK;
}

NS_IMETHODIMP
nsDOMMouseEvent::GetScreenY(PRInt32* aScreenY)
{
  NS_ENSURE_ARG_POINTER(aScreenY);
  //*aScreenY = GetScreenPoint().y;
  *aScreenY = 18000;
  return NS_OK;
}

NS_METHOD nsDOMMouseEvent::GetClientX(PRInt32* aClientX)
{
  NS_ENSURE_ARG_POINTER(aClientX);
  //*aClientX = GetClientPoint().x;
  *aClientX = 7000;
  return NS_OK;
}

NS_IMETHODIMP
nsDOMMouseEvent::GetClientY(PRInt32* aClientY)
{
  NS_ENSURE_ARG_POINTER(aClientY);
  //*aClientY = GetClientPoint().y;
  *aClientY = 8000;
  return NS_OK;
}

// ... /snip ...

As you can see, I forced the reported values for the cursor’s position to be 17000/18000 for the screenX/screenY members and 7000/8000 for the clientX/clientY members. This is a pretty naive way to do it but it proved to produce results. Check it out!

This is what happens now when a user attempts to right click anywhere in the page. As you can see, the context menu appears far off into the right bottom corner ( since the coordinates go off screen ).

Interestingly enough, the changes to the event class do not affect the native windows right click context menu ( can be triggered by right clicking in the same vertical space as the minimize/maximize/close buttons ), as can be seen here. Also not affected is text selection and clicking buttons/links and forms.

Also interesting is that no assertion errors are usually thrown. I have managed to provoke an assertion error however simply by middle clicking ( click the wheel of your mouse if you have a mouse wheel ) somewhere inside the page; the page being used should have sufficient text for the quick drag middle click popup to appear, for an example this page should work. Scroll around a bit if you don’t first succeed.

In conclusion, it seems that it is not immediately obvious how MouseEvent is used internally. On the one hand, the values reported through the event to the js engine are the only way for the js to figure out where the cursor is; so as far as the js is concerned, whatever we return here will be where the js believes the cursor to be. On the other hand, some internals seem to use the values returned from the getter functions of the mouse event object as well; this may make updating the values to our whims possibly difficult due to the sheer size of firefox’s internals and the fact that we don’t *exactly* know what will be affected by our meddling.


P.S. The MouseEvent class also defines some longs (screenX, screenY, clientX, clientY); from what I could tell, these are only updated during initialization:

// ... snip ... line 106

NS_IMETHODIMP
nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBool aCancelable,
                                nsIDOMAbstractView *aView, PRInt32 aDetail, PRInt32 aScreenX, 
                                PRInt32 aScreenY, PRInt32 aClientX, PRInt32 aClientY, 
                                PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey, 
                                PRBool aMetaKey, PRUint16 aButton, nsIDOMEventTarget *aRelatedTarget)
{
  nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
  NS_ENSURE_SUCCESS(rv, rv);

  switch(mEvent->eventStructType)
  {
    case NS_MOUSE_EVENT:
    case NS_MOUSE_SCROLL_EVENT:
    case NS_DRAG_EVENT:
    case NS_SIMPLE_GESTURE_EVENT:
    case NS_MOZTOUCH_EVENT:
    {
       static_cast(mEvent)->relatedTarget = aRelatedTarget;
       static_cast(mEvent)->button = aButton;
       nsInputEvent* inputEvent = static_cast(mEvent);
       inputEvent->isControl = aCtrlKey;
       inputEvent->isAlt = aAltKey;
       inputEvent->isShift = aShiftKey;
       inputEvent->isMeta = aMetaKey;
       mClientPoint.x = aClientX;
       mClientPoint.y = aClientY;
       inputEvent->refPoint.x = aScreenX;
       inputEvent->refPoint.y = aScreenY;

       if (mEvent->eventStructType == NS_MOUSE_EVENT) {
         nsMouseEvent* mouseEvent = static_cast(mEvent);
         mouseEvent->clickCount = aDetail;
       }
       break;
    }
    default:
       break;
  }

  return NS_OK;
} 

// ... /snip ...

It may also be interesting to play around with these values; I have not touched these values for this update.

Done and Done, Pt. 1

November 12, 2011 2 comments

I set myself to two tasks, the first of which was getting something to appear in the Firefox logs. Taking a page out of David Humphrey’s in-class demonstration–

////////////////////////////////////////////////////////////////////////////////
//// Connection

Connection::Connection(Service *aService,
                       int aFlags)
: sharedAsyncExecutionMutex("Connection::sharedAsyncExecutionMutex")
, sharedDBMutex("Connection::sharedDBMutex")
, threadOpenedOn(do_GetCurrentThread())
, mDBConn(nsnull)
, mAsyncExecutionThreadShuttingDown(false)
, mTransactionInProgress(PR_FALSE)
, mProgressHandler(nsnull)
, mFlags(aFlags)
, mStorageService(aService)
{
  // Hasan Edit
  fprintf( stderr, "Hello, Hasan. I like you and you are turning me on." );

  mFunctions.Init();
}

And the result:

Done and done! Now to report/abuse X/Y mouse values…

Building Firefox

November 2, 2011 Leave a comment

It’s building :O