Changes

Jump to: navigation, search

Implementing the Mouse Lock API in Firefox

562 bytes added, 16:02, 14 December 2011
Reviewing Tests: Added harness and focus hint
# Make sure code that relies on things happening in asynchronous code gets called in a callback or event handler, not on the next line. For example, if you call navigator.pointer.lock(), you can't check navigator.pointer.islocked() on the next line, you need to use the successCallback/errorCallback. Same for focus or blur calls and events. Actions that trigger something happening in the future often need a callback or event handler.
# Prefer <code>i++;</code> to <code>i+=1;</code>
# Many tests require the harness and focus, ensure that those tests are correctly written ie:
#* For Harness: See [[#Using the Test Harness|here]]
#* For Focus: Ensure the test resembles the following format-
<pre>
&lt;!-- snip --&gt;
&lt;body onload="runTests();"&gt;
 
&lt;!-- other tags that you may need go here --&gt;
 
&lt;script&gt;
function runTests() {
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
 
// Test code goes here
 
});
}
&lt;/script&gt;
&lt;/body&gt;
&lt;!-- /snip --&gt;</pre>
One or more tests have to deal with switching the lock between multiple elements, and the [[Changes to Fullscreen Unlock|spec is changing]] on that front.

Navigation menu