October 2015


Spent some time getting the B2G build system working again. This seems to be a repeating pattern, that every time I touch anything B2G related something is broken or has changed and requires reconfiguration.

The build of b2g-bin itself seems to be fine, but when mach calls out to the Gaia checkout to generate a new profile, it has about a 50% pass rate with some stacktrace originating from chrome JS. This error then trickles up to mach, causing it to look like the build failed.

Then I spent a great deal of time working out why my build would not run any tests. It turned out that there was some code that was incompatible with B2G. I ended up writing a wiki page detailing how to write JS code that is safe for B2G for Marionette.

One of the issues was that the Object prototype in B2G is locked down or frozen. This means object that extend it, which is basically every custom object, cannot override functions associated with its prototype. This means that you, amongst other functions, cannot redefine toString.

I know B2G uses a single global to reduce memory consumption, but I’m not sure why the Object prototype needs to be locked down to achieve this.

With some help of pamadini, I discovered that you can redefine the whole prototype in order to provide a toString:

this.MyObject = function() {};

MyObject.prototype = {
  toString: function() { return "foo"; },

This also works with class expressions:

this.MyObject = class {
  toString() { return "foo"; }

But strangly replacing the prototype and then defining the function on the prototype does not:

this.MyObject = function() {};

MyObject.prototype = {};
MyObject.prototype.toString = function() { return "foo"; };


Reviewed r/5862.

Continued work on the message format changes. Specifically worked on adding backwards compatibility to the Node.js Marionette client in Gaia.


Replied to WebDriver bug 29157.

Resolved bug 1207564 as invalid because we will explicitly code the Marionette server so that it can receive asynchronous requests.


Filed bug 1211450 about an intermittent build failure on running integration tests in Gaia.

Continued investigation into why bug 1202663 about converting the screen capture command in the listener to use the new dispatching technique passes try runs, but fails on inbound. Triggered a new try run with both debug- and optimised builds.

Rebased and continued work on protocol changes. Finally got around to file bug 1211489 about the upcoming changes, with bug 1211501 (Node.js) and bug 1211503 (Python) as dependents.


Reviewed bug 977899.


Pointed out there was no try run associated with the patch, but cleared rb/21345 for integration. This patch addresses a bug where navigation in Marionette affects the current frame instead of the top-level browsing context.

Continued work on bug 1211503 that provides support for the new level 3 Marionette protocol. As always, the hardest part is providing backwards-compatibility. I’m really looking forward to getting rid of this shim.

I decided to make one ad-hoc change to the protocol, however. The first packet sent will always be a JSON Object containing a marionetteProtocol field that is useful to tell the client which level to use for communication. I find this is a better and more fail-safe approach than inspecting the packet and looking for the trademarks of a level 3 message format.

1:1 with dburns delayed until Friday.


Continued work on bug 1211503 to add level 3 support to the Marionette Python client. More work than I had anticipated, but it’s now mostly working.

Published an article on my website where I make a case against visibility checks in WebDriver.


Continued work on bug 1211503.

1:1 with dburns, decided on deliverables &c.


Drafted up deliverables and sent to dburns for approval.

Looked into Marionette screen capture tests, and found that they are not really testing what they say they are. Before resuming work on bug 1211503, it might be wise to submit a patch with rewritten screenshot tests.


Applying the new dispatching technique to takeScreenshot revealed that we were silently dropping errors previously, and further investigation showed our assumptions about the document element of SVG documents were wrong. Looking at the code, I decided to refactor the whole thing.

Having given the screen capture refactor some further thought, I think we should land the rewrite of the tests first–separately. To assert that the rewritten tests are correct, I should export the sizes of the elements and the screenshots as files and then compare them to the new tests.

Filed bug 1213884 which prevents me from pushing bookmarks to review.

Filed and patched bug 1213800 which refactors the Marionette screen capture tests as explained above.


Provided feedback on patch for bug 1202381 about removing the null check in Switch To Frame in Marionette.

Looking into the inbound error for bug 1213800, I discovered that taking a “full” window screenshot in chrome context is not infact of the window.outerHeight and window.outerWidth attributes, but rather of the first <window> object inside the <browser>. Made the necessary modifications to reflect this in the test, and trigged a new try run.

In terms of deliverables, I’ve taken on starting the work to supply an exahaustive WebDriver specification test suite for some of the chapters as my primary deliverable in Q4. My other deliverable is bug 1123506 about evaluating scripts in content with side-effects, which is considered quite a high impact bug; both in terms of specification conformance, but also for a number of other Mozilla projects.

For landing the screen capture changes I decided to put them all in the same review request to provide enough context for the reviewers. See rb/21747. Also triggered a combined try run.

Sent some MozReview review request UX design comments to mdoglio as requested.


Filed bug 1214512 about the back button in Nightly having turned oval.

Investigated a bit if bug 1213800 et al. broke the Wr job, but it appears a combination of jgraham and philor fixed it whilst I was asleep.

Did a try run for bug 1202381 which removes a null check in the Marionette switchToFrame command.

Started work on the transition to level 3 of the Marionette protocol again by doing a try run of the Python client patch running against a level 2 server, and of the level 3 server running against a level 3 client.


Found a small mistake in the level 3 future-proofing patch for Python (bug 1211503) that I fixed, and pushed a new try run.

Rebased bug 1211489, bug 1211501, and bug 1211503.

My suspicions from the other week turned out to be true: B2G Desktop is picking up Gecko’s from m-c, rather than the code pushed to try. If you compare the test results in the try run I did for the level 3 server (bug 1211489), I’d expect the same test failures from Mulet to show on B2G Desktop.

Furthermore the luciddeam test harness is failing, and I’m suspecting this is because it’s not picking up Marionette from in-tree.

Published reviews rb/22201 and rb/22205.

Hosted a big CodingEvening event in the Mozilla London space in the evening.


Rebased and fixed up code review issues for bug 1211503.

Added solution on how to specify B2G-safe toString methods on objects in the B2Gisms wiki page I added a few weeks back.

Rebased bug 1211489.

Addressed and fixed up code review issues for bug 1211501.


Worked on bug 1211501, bug 1211503, and bug 1211489.

Hosted a NewsGames meetup at the London office.


New try runs:

Pushed bug 1211503 to inbound.


Filed bug 1216967 about releasing new Python packages for Marionette. Submitted rb/22817.

Had an interesting discussion with smaug about window focus and DOM events dispatching. Apparently a lot of input events as well as some protected privacy features are not available, and are “queued”, when the window is out of focus. When the window comes back into focus, the events fire as expected.

Current WebDriver implementation practices expect the driver to be able to work on windows that are in the background. This was apparently implemented for Marionette as part of bug 704583 which adds a focusmanager.testmode preference.

davehunt reported bug 1216949 which might suggest this is broken (recently?). smaug on the other hand brought up some prudent concern about the WebDriver behaviour. If one is testing web platform features, one would expect Marionette to respect the rules and not use some special “testing mode” to circumvent them.

I think this is a good quesiton, and certainly something we should discuss more in depth in the WebDriver WG because it is something I feel we need to call out in the specification.

Filed bug 1217058 about preserving the expanded grouping state on Treeherder.

Did my fortnightly 1:1 with dburns.


I eventually found the source of my problems with bug 1211501 (the Node.js client patch to support protocol level 3), and it turned out that the newly rewritten TcpSync#send method was missing a return statement. Latest try run confirms this.

Rebased and addressed some code review issues for bug 1205687, about adding support for mach test FILE to Marionette. Pushed the remaining issue back to chmanchester for more feedback.

Rebased and addressed a code review issue for bug 1211489, which is the bug that provides the actual new message sequencing to the Marionette server.

Addressed test failure issues with LucidDream for bug 1216967 (rb/22815). I’m not confident upgrading the dependencies will work, however, because the harness uses wo different versions of Marionette.

Pushed bug 1216967 to inbound.


Travel day to Tokyo via Copenhagen.


Travel day to Sapporo.


W3C Browser Testing- and Tools Working Group meeting at TPAC in Sapporo, Japan.


Another day of meetings.


Plenary day at TPAC.


Travel day from Sapporo back to Tokyo.

Submitted many commits to the WebDriver specification to implement the actions and resolutions from the WG’s meeting at TPAC.


Reviewed r/5916 which adds support for the Edge browser to wptrunner.

Merged PR 1890 to web-platform-tests unconditionally to allow Microsoft not to maintain their own fork of the WebDriver tests.


Resolved W3C bug 29219 about confusing cookie deletion endpoints.

Provided feedback on mcote’s blog post on MozReview’s parental issues.

Finished up the project description for the Quarter of Contributions project that I’m mentoring on providing WebDriver infrastructure to WPT.