Closed
Bug 1056851
Opened 12 years ago
Closed 11 years ago
Change existing callers of SpecialPowers.setBoolPref/setIntPref/setCharPref to SpecialPowers.pushPrefEnv
Categories
(Testing :: Mochitest, defect)
Tracking
(firefox37 wontfix, firefox38 fixed, b2g-v2.2 fixed, b2g-master fixed)
RESOLVED
FIXED
mozilla38
People
(Reporter: martijn.martijn, Assigned: kaustabh93, Mentored)
References
Details
(Whiteboard: [lang=js])
Attachments
(3 files, 17 obsolete files)
|
12.75 KB,
patch
|
jmaher
:
review+
|
Details | Diff | Splinter Review |
|
2.31 KB,
patch
|
Details | Diff | Splinter Review | |
|
128.96 KB,
patch
|
Details | Diff | Splinter Review |
In mochitests, there is a lot of use of SpecialPowers.setBoolPref/setIntPref/setCharPref, this has to be converted to use SpecialPowers.pushPrefEnv.
2 reasons:
- With SpecialPowers.pushPrefEnv, the pref is automatically reset after the mochitest has run
- SpecialPowers.pushPrefEnv is guaranteed to work in OOP
Here are some searches of the mochitests that would need to be rewritten:
http://mxr.mozilla.org/mozilla-central/search?string=specialpowers.setboolpref
http://mxr.mozilla.org/mozilla-central/search?string=specialpowers.setintpref&find=&findi=&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central
http://mxr.mozilla.org/mozilla-central/search?string=specialpowers.setcharpref&find=&findi=&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central
This test should not be rewritten:
http://mxr.mozilla.org/mozilla-central/source/testing/mochitest/tests/Harness_sanity/test_SpecialPowersPushPrefEnv.html?force=1#23
| Reporter | ||
Updated•12 years ago
|
Mentor: martijn.martijn
Updated•12 years ago
|
Whiteboard: [lang=js]
| Assignee | ||
Comment 1•11 years ago
|
||
Comment 2•11 years ago
|
||
Comment on attachment 8560599 [details] [diff] [review]
layout_pref_changes.patch
Review of attachment 8560599 [details] [diff] [review]:
-----------------------------------------------------------------
this is great- almost a r+, I would like to do bonus work on test_bug749186.html (setTimeout(func, 100) <- we don't like the 100, it should be 0 which is what the callback does by default in pushPrefEnv).
Please take another pass at this.
::: layout/base/tests/bidi_numeral_test.js
@@ +79,2 @@
>
> + function callback(){
nit: callback() {
@@ +83,3 @@
>
> + var refCanvas = new RemoteCanvas(fileprefix + file + "-ref.html", "ref-" + currentPass);
> + refCanvas.load(callbackTestCanvas);
nit: trailingwhitespace here.
@@ +83,4 @@
>
> + var refCanvas = new RemoteCanvas(fileprefix + file + "-ref.html", "ref-" + currentPass);
> + refCanvas.load(callbackTestCanvas);
> + }
this } is not indented properly.
::: layout/base/tests/test_after_paint_pref.html
@@ +101,5 @@
>
> window.removeEventListener("MozAfterPaint", failstep, false);
>
> // Set the pref back in its initial state.
> + SpecialPowers.pushPrefEnv({'set': [['dom.send_after_paint_to_content', true]]}, SimpleTest.finish);
nit: trailing whitespace
::: layout/base/tests/test_bug749186.html
@@ +22,5 @@
> }
>
> function removeBoldStyle() {
> document.getElementById('b').removeAttribute('style');
> setTimeout(setEmPerLineTo0, 100);
here we should be able to remove the setEmPerLineTo0 and call pushPrefEnv directly here. For the callback it should just be endTest.
@@ +32,5 @@
>
> function startTest() {
> SimpleTest.waitForExplicitFinish();
> SimpleTest.requestFlakyTimeout("untriaged");
> setTimeout(setEmPerLineTo8, 100);
here we could do the pushprefenv and get rid of setEmPerLineTo8, ideally the callback should be removeBoldStyle instead of function() {setTimeout(removeBoldStyle, 100);}
::: layout/base/tests/test_reftests_with_caret.html
@@ +105,5 @@
> [ 'bug989012-2.html' , 'bug989012-2-ref.html' ] ,
> [ 'bug989012-3.html' , 'bug989012-3-ref.html' ] ,
> + [ 'bug989012-1.html' , 'bug989012-1-ref.html' ] ,
> + [ 'bug989012-2.html' , 'bug989012-2-ref.html' ] ,
> + [ 'bug989012-3.html' , 'bug989012-3-ref.html' ] ,
these are duplicated.
@@ +155,5 @@
> + [ 'bug1109968-1.html', 'bug1109968-1-ref.html'] ,
> + [ 'bug1109968-2.html', 'bug1109968-2-ref.html'] ,
> + // [ 'bug1123067-1.html' , 'bug1123067-ref.html' ] , TODO: bug 1129205
> + [ 'bug1123067-2.html' , 'bug1123067-ref.html' ] ,
> + [ 'bug1123067-3.html' , 'bug1123067-ref.html' ] ,
these 5 lines are duplicated
Attachment #8560599 -
Flags: review-
| Assignee | ||
Comment 3•11 years ago
|
||
Attachment #8560599 -
Attachment is obsolete: true
Comment 4•11 years ago
|
||
Comment on attachment 8560622 [details] [diff] [review]
layout_pref_changes.patch
Review of attachment 8560622 [details] [diff] [review]:
-----------------------------------------------------------------
this is really nice, one more optimization, but please do test after making these changes. I am r+, once the changes are made and tested locally, please upload the final patch.
::: layout/base/tests/test_bug749186.html
@@ +20,3 @@
> function removeBoldStyle() {
> document.getElementById('b').removeAttribute('style');
> + SpecialPowers.pushPrefEnv({'set': [['font.size.inflation.emPerLine', 0]]},function() {setTimeout(endTest, 100);} );
instead of:
function() {setTimeout(endTest, 100);}
just put:
endTest
@@ +24,5 @@
>
> function startTest() {
> SimpleTest.waitForExplicitFinish();
> SimpleTest.requestFlakyTimeout("untriaged");
> + SpecialPowers.pushPrefEnv({'set': [['font.size.inflation.emPerLine', 8]]},function() {setTimeout(removeBoldStyle, 100);} );
instead of:
function() {setTimeout(removeBoldStyle, 100);}
just put:
removeBoldStyle
Attachment #8560622 -
Flags: review+
| Assignee | ||
Comment 5•11 years ago
|
||
| Assignee | ||
Comment 6•11 years ago
|
||
Attachment #8560622 -
Attachment is obsolete: true
Attachment #8560628 -
Attachment is obsolete: true
Updated•11 years ago
|
Attachment #8560629 -
Flags: review+
Comment 7•11 years ago
|
||
| Reporter | ||
Comment 8•11 years ago
|
||
Thanks for working on this, Kaustabh!
Assignee: nobody → kaustabh93
Comment 9•11 years ago
|
||
fyi: this patch is only for layout/* test cases, we will need many other tests converted- this is a GREAT start.
Updated•11 years ago
|
Keywords: checkin-needed,
leave-open
Comment 10•11 years ago
|
||
The changes for the html files containing setBool till dom/events
| Reporter | ||
Comment 11•11 years ago
|
||
(In reply to Anish from comment #10)
> Created attachment 8561001 [details] [diff] [review]
> setBool.patch
>
> The changes for the html files containing setBool till dom/events
Thanks Anish! Pushed to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=27ef4ab96234
| Reporter | ||
Comment 12•11 years ago
|
||
Comment on attachment 8561001 [details] [diff] [review]
setBool.patch
Review of attachment 8561001 [details] [diff] [review]:
-----------------------------------------------------------------
Several of the mochitests failed on try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=27ef4ab96234
You'll need to fix those in your patch. You can click on the orange numbers to see which mochitests failed.
Attachment #8561001 -
Flags: review-
| Reporter | ||
Comment 13•11 years ago
|
||
Comment on attachment 8561001 [details] [diff] [review]
setBool.patch
># HG changeset patch
># Parent 940118b1adcd83967fbd49c96217857a91a2b2d0
>diff --git a/accessible/tests/mochitest/elm/test_canvas.html b/accessible/tests/mochitest/elm/test_canvas.html
>--- a/accessible/tests/mochitest/elm/test_canvas.html
>+++ b/accessible/tests/mochitest/elm/test_canvas.html
> SimpleTest.waitForExplicitFinish();
>- addA11yLoadEvent(doTest);
>- </script>
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['canvas.hitregions.enabled', true]
>+ ]
>+}, function fn(){addA11yLoadEvent(doTest);})
You have the indentation wrong here.
=
> SimpleTest.waitForExplicitFinish();
>- addA11yLoadEvent(doTest);
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['canvas.hitregions.enabled', true]
>+ ]
>+}, function fn(){addA11yLoadEvent(doTest);})
Again, indentation seems wrong here, please fix that.
> </script>
> </head>
> <body>
>
> <a target="_blank"
> href="https://bugzilla.mozilla.org/show_bug.cgi?id=966591"
> title="nsIAccessible::childAtPoint() for canvas hit regions from browser tests">Mozilla Bug 966591</a>
>
>diff --git a/browser/base/content/test/general/test_contextmenu.html b/browser/base/content/test/general/test_contextmenu.html
>--- a/browser/base/content/test/general/test_contextmenu.html
>+++ b/browser/base/content/test/general/test_contextmenu.html
>-var subwindow = window.open("./subtst_contextmenu.html", "contextmenu-subtext", "width=600,height=800");
>-subwindow.addEventListener("MozAfterPaint", waitForEvents, false);
>-subwindow.onload = waitForEvents;
>+function onLoad()
>+{
>+ var subwindow = window.open("./subtst_contextmenu.html", "contextmenu-subtext", "width=600,height=800");
>+ subwindow.addEventListener("MozAfterPaint", waitForEvents, false);
>+ subwindow.onload = waitForEvents;
>+}
>
>+SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['full-screen-api.approval-required', false],
>+ ['full-screen-api.allow-trusted-requests-only', false],
>+ ['plugins.click_to_play', true]
>+ ]
>+}, onLoad())
The () part of onLoad can be removed. Also, perhaps better do name the function startTest or something? I don't think the name onLoad is really correct here.
> SimpleTest.waitForExplicitFinish();
> </script>
> </pre>
> </body>
> </html>
>diff --git a/caps/tests/mochitest/test_app_principal_equality.html b/caps/tests/mochitest/test_app_principal_equality.html
>--- a/caps/tests/mochitest/test_app_principal_equality.html
>+++ b/caps/tests/mochitest/test_app_principal_equality.html
>@@ -11,19 +11,16 @@ https://bugzilla.mozilla.org/show_bug.cg
> </head>
> <body>
> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=777467">Mozilla Bug 777467</a>
> <p id="display"></p>
> <script>
> // Initialization.
> SpecialPowers.addPermission("browser", true, document);
> SpecialPowers.addPermission("embed-apps", true, document);
You can replace these addPermission calls with pushPermissions. It's a similar api as pushPrefEnv. Otoh, you can do that later, if you prefer.
>-
>- SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
>- SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", false);
> </script>
> <div id="content" style="display: none;">
> <iframe src="error404"></iframe>
> <iframe mozbrowser src="error404"></iframe>
> <iframe mozapp="http://example.org/manifest.webapp" mozbrowser src="error404"></iframe>
> </div>
> <pre id="test">
> <script type="application/javascript">
>@@ -37,32 +34,36 @@ function canAccessDocument(win) {
> try {
> win.document;
> } catch(e) {
> result = false;
> }
> return result;
> }
>
>-addLoadEvent(function() {
>+SimpleTest.waitForExplicitFinish();
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['dom.mozBrowserFramesEnabled', true],
>+ ['dom.ipc.browser_frames.oop_by_default', false]
>+ ]
>+}, function fn(){addLoadEvent(function() {
I think it's better to just name a function (startTest?) and then seperate it from pushPrefEnv, it makes it easier to read.
So SpecialPowers.pushPrefEnv("set": [prefs], startTest)
Or in this case when you also do the pushPermissions thing, then you do something like: SpecialPowers.pushPrefEnv("set": [prefs], function(){ SpecialPowers.pushPermissions([....], startTest))
>diff --git a/docshell/test/navigation/test_bug430723.html b/docshell/test/navigation/test_bug430723.html
>--- a/docshell/test/navigation/test_bug430723.html
>+++ b/docshell/test/navigation/test_bug430723.html
>@@ -32,25 +32,27 @@ var gTallRedBoxURI = "data:text/html;cha
> var gTallBlueBoxURI = "data:text/html;charset=utf-8;base64,PGh0bWw%2BPGhlYWQ%2BPHNjcmlwdD53aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigncGFnZXNob3cnLCBmdW5jdGlvbigpe29wZW5lci5uZXh0VGVzdCgpO30sIGZhbHNlKTs8L3NjcmlwdD48L2hlYWQ%2BPGJvZHk%2BPGRpdiBzdHlsZT0icG9zaXRpb246YWJzb2x1dGU7IGxlZnQ6MHB4OyB0b3A6MHB4OyB3aWR0aDo1MCU7IGhlaWdodDoxNTAlOyBiYWNrZ3JvdW5kLWNvbG9yOmJsdWUiPjxwPlRoaXMgaXMgYSB2ZXJ5IHRhbGwgYmx1ZSBib3guPC9wPjwvZGl2PjwvYm9keT48L2h0bWw%2B";
> // <html><head>
> // < script > window.addEventListener("pageshow", function(){opener.nextTest();}, false); < /script >
> // </head><body>
> // <div style="position:absolute; left:0px; top:0px; width:50%; height:150%; background-color:blue">
> // <p>This is a very tall blue box.</p>
> // </div></body></html>
>
>-
>-window.onload = runTest;
>+var smoothScrollPref = "general.smoothScroll";
>+SpecialPowers.pushPrefEnv({
>+ "set": [
>+ [smoothScrollPref, false]
>+ ]
>+}, function fn(){window.onload = runTest;})
This is not good. This pushPrefEnv call might be finished before or after the window has loaded. You should call the pushPrefEnv function inside the window.onload.
>diff --git a/dom/apps/tests/test_app_update.html b/dom/apps/tests/test_app_update.html
>--- a/dom/apps/tests/test_app_update.html
>+++ b/dom/apps/tests/test_app_update.html
>@@ -13,25 +13,24 @@ https://bugzilla.mozilla.org/show_bug.cg
> /** Test for Bug 826058 **/
>
> SimpleTest.waitForExplicitFinish();
>
> var gBaseURL = 'http://test/tests/dom/apps/tests/';
> var gHostedManifestURL = gBaseURL + 'file_app.sjs?apptype=hosted&getmanifest=true';
> var gCachedManifestURL = gBaseURL + 'file_app.sjs?apptype=cached&getmanifest=true';
> var gTrustedManifestURL = gBaseURL + 'file_app.sjs?apptype=trusted&getmanifest=true';
>- var gGenerator = runTest();
>-
>+ var gGenerator;
> // We need to set the trusted hosted app csp pref since it's only in
> // b2g.js for now.
> function setCSPPrefs() {
> SpecialPowers.pushPrefEnv({'set':
> [["security.apps.trusted.CSP.default",
>- "default-src *; object-src 'none'"]]},
>- function() { gGenerator.next(); });
>+ "default-src *; object-src 'none'"],["dom.mozBrowserFramesEnabled",true]]},
>+ function() { gGenerator = runTest(); gGenerator.next(); });
I hope this works. runTest() seems like an asynchronous function, which gGenerator.next() might depend upon.
>diff --git a/dom/base/test/test_EventSource_redirects.html b/dom/base/test/test_EventSource_redirects.html
>--- a/dom/base/test/test_EventSource_redirects.html
>+++ b/dom/base/test/test_EventSource_redirects.html
>@@ -44,16 +43,20 @@ https://bugzilla.mozilla.org/show_bug.cg
> ok(false, "received onError: " + event);
> source.close();
> SimpleTest.finish();
> };
>
> }
>
> SimpleTest.waitForExplicitFinish();
>- addLoadEvent(doTest);
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['dom.server-events.enabled', true]
>+ ]
>+}, function fn(){addLoadEvent(doTest);})
The other way around please. The pushPrefEnv call inside the addLoadEvent function.
>diff --git a/dom/base/test/test_bug666604.html b/dom/base/test/test_bug666604.html
>--- a/dom/base/test/test_bug666604.html
>+++ b/dom/base/test/test_bug666604.html
>@@ -111,43 +111,48 @@ function test6() {
> test7();
> }
> dispatchDOMActivate(testlink);
> }
>
> var oldPref;
> function test7() {
> oldPref = SpecialPowers.getBoolPref("dom.disable_open_during_load");
>- SpecialPowers.setBoolPref("dom.disable_open_during_load", false);
> testlink.href = "javascript:opener.activationListener(); window.close();";
> testlink.target = "_blank";
> activationListener =
> function() {
> ok(true, "Click() should activate a link");
>- setTimeout(test8, 0);
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['dom.disable_open_during_load', false]
>+ ]
>+}, function fn(){setTimeout(test8, 0);})
That seems weird to put it in here. Also the indentation is wrong.
> }
>
> function test8() {
>- SpecialPowers.setBoolPref("dom.disable_open_during_load", true);
> testlink.href = "javascript:opener.activationListener(); window.close();";
> testlink.target = "_blank";
> activationListener =
> function() {
> ok(false, "Click() should not activate a link");
>- setTimeout(test9, 0);
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['dom.disable_open_during_load', true]
>+ ]
>+}, function fn(){setTimeout(test9, 0);});
Here also.
>diff --git a/dom/base/test/test_bug715041.xul b/dom/base/test/test_bug715041.xul
>--- a/dom/base/test/test_bug715041.xul
>+++ b/dom/base/test/test_bug715041.xul
>@@ -14,18 +14,17 @@ xmlns="http://www.mozilla.org/keymaster/
>- caseZero();
>-
>+ SimpleTest.waitForExplicitFinish();
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['dom.idle-observers-api.fuzz_time.disabled', true]
>+ ]
>+}, caseZero();)
Indentation wrong and get rid of () in caseZero.
>diff --git a/dom/base/test/test_bug715041_removal.xul b/dom/base/test/test_bug715041_removal.xul
>--- a/dom/base/test/test_bug715041_removal.xul
>+++ b/dom/base/test/test_bug715041_removal.xul
>+
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['dom.idle-observers-api.fuzz_time.disabled', true]
>+ ]
>+}, RemoveHeadIdleObserverWhileActive();})
>+
Indentation wrong.
> ]]>
> </script>
> </window>
>
>diff --git a/dom/base/test/test_child_process_shutdown_message.html b/dom/base/test/test_child_process_shutdown_message.html
>--- a/dom/base/test/test_child_process_shutdown_message.html
>+++ b/dom/base/test/test_child_process_shutdown_message.html
>@@ -112,25 +112,26 @@ function expectFrameProcessShutdown(ifra
> ok(true, "Received 'message-manager-disconnect' notification with " +
> "frame message manager");
> countMessage();
> }
> }, "message-manager-disconnect", false);
> }
>
> function setUp() {
>- SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
>- SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
> SpecialPowers.addPermission("browser", true, window.document);
> SpecialPowers.addPermission("embed-apps", true, window.document);
>
>- // TODO: remove in bug 820712
>- SpecialPowers.setBoolPref("network.disable.ipc.security", true);
>-
>- runNextTest();
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['dom.mozBrowserFramesEnabled', true],
>+ ['dom.ipc.browser_frames.oop_by_default', true],
>+ ['network.disable.ipc.security', true]
>+ ]
>+}, function fn(){runNextTest();})
> }
Indentation wrong and just use runNextTest here.
>diff --git a/dom/base/test/test_messagemanager_assertpermission.html b/dom/base/test/test_messagemanager_assertpermission.html
>--- a/dom/base/test/test_messagemanager_assertpermission.html
>+++ b/dom/base/test/test_messagemanager_assertpermission.html
>@@ -22,26 +22,29 @@ const CHILD_PROCESS_SHUTDOWN_MESSAGE = "
> let ppmm = SpecialPowers.Cc["@mozilla.org/parentprocessmessagemanager;1"]
> .getService(SpecialPowers.Ci.nsIMessageBroadcaster);
> let cpmm = SpecialPowers.Cc["@mozilla.org/childprocessmessagemanager;1"]
> .getService(SpecialPowers.Ci.nsISyncMessageSender);
> let gAppsService = SpecialPowers.Cc["@mozilla.org/AppsService;1"]
> .getService(SpecialPowers.Ci.nsIAppsService);
>
> function setUp() {
>- SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
>- SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
> SpecialPowers.addPermission("browser", true, window.document);
> SpecialPowers.addPermission("embed-apps", true, window.document);
>
> let appId = gAppsService.getAppLocalIdByManifestURL(APP_MANIFEST);
> SpecialPowers.addPermission("foobar", true, { url: APP_URL,
> appId: appId,
> isInBrowserElement: false });
>- runNextTest();
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['dom.mozBrowserFramesEnabled', true],
>+ ['dom.ipc.browser_frames.oop_by_default', true]
>+ ]
>+}, runNextTest());
> }
Indentation wrong and get rid of ().
>diff --git a/dom/base/test/test_websocket_permessage_deflate.html b/dom/base/test/test_websocket_permessage_deflate.html
>--- a/dom/base/test/test_websocket_permessage_deflate.html
>+++ b/dom/base/test/test_websocket_permessage_deflate.html
>+function loadDeflate(){
>+ SpecialPowers.pushPrefEnv({
>+ "set": [
>+ ['network.websocket.extensions.permessage-deflate', tests[testIdx][0]]
>+ ]
>+}, testDeflate()})
>+}
Indentation wrong and get rid of ().
> SimpleTest.waitForExplicitFinish();
>
> </script>
> </pre>
> </body>
> </html>
>diff --git a/dom/browser-element/mochitest/priority/test_Preallocated.html b/dom/browser-element/mochitest/priority/test_Preallocated.html
>--- a/dom/browser-element/mochitest/priority/test_Preallocated.html
>+++ b/dom/browser-element/mochitest/priority/test_Preallocated.html
>-addEventListener('testready', runTest);
>+SpecialPowers.pushPrefEnv({'set':
>+ [["dom.ipc.processPrelaunch.enabled",true]]},
>+ function() { addEventListener('testready', runTest); });
I assume 'testready' can't fire earlier than the pushPrefEnv call?
I'm going to skip the rest of the patch.
But I saw there also cases where you made similar mistakes as I described before.
Also make sure that the mochitests run still fine afterwards. If you can't get them to pass, then just leave them out of the patch for now.
Comment 14•11 years ago
|
||
Keywords: checkin-needed
Comment 15•11 years ago
|
||
Comment on attachment 8561001 [details] [diff] [review]
setBool.patch
Review of attachment 8561001 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/browser-element/mochitest/priority/test_Preallocated.html
@@ +66,4 @@
> }
> +SpecialPowers.pushPrefEnv({'set':
> + [["dom.ipc.processPrelaunch.enabled",true]]},
> + function() { addEventListener('testready', runTest); });
This should be convoluted like
addEventListener('testready', function() {
SpecialPowers.pushPrefEnv({...}, runTest)
});
Comment 16•11 years ago
|
||
Updated based on comments with additional files
Attachment #8561001 -
Attachment is obsolete: true
Comment 17•11 years ago
|
||
Comment 18•11 years ago
|
||
Comment on attachment 8562119 [details] [diff] [review]
setBool.patch
Review of attachment 8562119 [details] [diff] [review]:
-----------------------------------------------------------------
made it to dom/datastore/tests/test_basic.html, a handful of cleanup items. Lets see what try looks like and maybe a second round of reviewing changes.
::: accessible/tests/mochitest/elm/test_canvas.html
@@ +37,5 @@
> SimpleTest.finish();
> }
>
> SimpleTest.waitForExplicitFinish();
> + SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]},
nit: trailing whitespace
::: caps/tests/mochitest/test_app_principal_equality.html
@@ +19,1 @@
> SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
addPerfmission and setBoolPref still in this file- I see you took care of it below. Please delete these (or mention why they should stay)
@@ +43,5 @@
> +SpecialPowers.pushPrefEnv({"set": [['dom.mozBrowserFramesEnabled', true],
> + ["dom.ipc.browser_frames.oop_by_default", false]]},
> + function(){SpecialPowers.pushPermissions([
> + {type: "browser", allow: true, context: document},
> + {type: "embed-apps", allow: true, context: document}], startTest);});
nit; trailing whitespace
::: docshell/test/navigation/test_bug430723.html
@@ +44,5 @@
> var testNum = 0;
>
> var smoothScrollPref = "general.smoothScroll";
> function runTest() {
> + SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]},
nit: trailing whitespace
::: dom/apps/tests/test_app_update.html
@@ +23,5 @@
> // b2g.js for now.
> function setCSPPrefs() {
> + SpecialPowers.pushPrefEnv({'set':[["security.apps.trusted.CSP.default",
> +"default-src *; object-src 'none'"],["dom.mozBrowserFramesEnabled",true]]},
> + function() { gGenerator = runTest(); gGenerator.next(); });
this in inside setCSPPrefs, I assume this is the right place to do this.
::: dom/base/test/test_bug666604.html
@@ +115,5 @@
>
> var oldPref;
> function test7() {
> oldPref = SpecialPowers.getBoolPref("dom.disable_open_during_load");
> + SpecialPowers.pushPrefEnv({"set":[["dom.disable_open_during_load", true]]},function(){});
please make this a real callback. whomever calls test7 could pushPrefEnv and do a callback on test7, likewise a few lines down you can do:
SpecialPowers.pushPrefEnv({"set":[["dom.disable_open_during_load", false]]}, test8);
@@ +141,5 @@
> }
>
>
> function test9() {
> + SpecialPowers.pushPrefEnv({"set":[["dom.disable_open_during_load", !oldPref]]},function(){});
this is just resetting a preference, no need for it, and in fact test9 could be removed and we could just replace line 140:
hitEventLoop(10, SimpleTest.finish);
::: dom/base/test/test_bug715041_removal.xul
@@ +833,5 @@
> var RemoveLocalIdleTimerLastElementEnabled = true;
> var RemoveHeadAfterLastLocalFiredEnabled = true;
> var RemoveHeadIdleObserverWhileIdleCase1Enabled = true;
> var RemoveLastAddLastEnabled = true;
> +
nit: blank line with extra whitespace
@@ +834,5 @@
> var RemoveHeadAfterLastLocalFiredEnabled = true;
> var RemoveHeadIdleObserverWhileIdleCase1Enabled = true;
> var RemoveLastAddLastEnabled = true;
> +
> + SpecialPowers.pushPrefEnv({"set":[['dom.idle-observers-api.fuzz_time.disabled', true]]}, RemoveHeadIdleObserverWhileActive());
this callback is calling the function, please remove the () so we reference the function code, not the return value.
::: dom/base/test/test_child_process_shutdown_message.html
@@ -122,4 @@
> SpecialPowers.addPermission("browser", true, window.document);
> SpecialPowers.addPermission("embed-apps", true, window.document);
>
> - // TODO: remove in bug 820712
keep this comment around, but make sure it retains the pref it is referring to.
::: dom/base/test/test_websocket_permessage_deflate.html
@@ +95,5 @@
> }
> }
>
> +function loadDeflate()
> +{
nit: bring the { to the function declaration line
@@ +96,5 @@
> }
>
> +function loadDeflate()
> +{
> + SpecialPowers.pushPrefEnv({"set":[['network.websocket.extensions.permessage-deflate', tests[testIdx][0]]]}, testDeflate);
will we have testIdx defined here when onload is fired?
::: dom/canvas/test/test_hitregion_canvas.html
@@ +79,3 @@
> }
>
> +SpecialPowers.pushPrefEnv({"set":[["canvas.hitregions.enabled", true]]}, addLoadEvent(runTests))
this callback should be:
function() { addLoadEvent(runTests); }
::: dom/datastore/tests/test_app_install.html
@@ +49,5 @@
> ok("getDataStores" in navigator, "getDataStores exists");
> is(typeof navigator.getDataStores, "function", "getDataStores exists and it's a function");
>
> SpecialPowers.setAllAppsLaunchable(true);
> +
nit blank line with whitepsace, please remove this blank line
Comment 19•11 years ago
|
||
| Reporter | ||
Comment 20•11 years ago
|
||
Anish asked me to look at test_bug640321.html. I think this makes it work (tested locally).
Comment 21•11 years ago
|
||
Comment 22•11 years ago
|
||
Based on previous try and review
Attachment #8562119 -
Attachment is obsolete: true
Comment 23•11 years ago
|
||
| Reporter | ||
Comment 24•11 years ago
|
||
I see one failure in test_classified_annotations.html .
It might be because you're doing
["privacy.trackingprotection.enabled", true], ["channelclassifier.allowlist_exampl", true] 2 times with pushPrefEnv.
You need to get rid of the 2nd one later in the file.
For the rest, it seems to be going all well.
I noticed various indentation issues in your patch, though. They are easily noticeable, you might want to fix them, before I'll raise them in my review.
Comment 25•11 years ago
|
||
Comment on attachment 8562970 [details] [diff] [review]
setBool.patch
Review of attachment 8562970 [details] [diff] [review]:
-----------------------------------------------------------------
lots of little things, the try server is very green in comparison to previous ones! Lets give this one more cleanup and then we can test on all the platforms.
::: accessible/tests/mochitest/jsat/test_alive.html
@@ +73,5 @@
> title="[AccessFu] Add mochitest for enabling">
> Mozilla Bug 811307
> </a>
> </body>
> +</html>
if there are no changes to this file, please revert any whitespace changes so we don't accidentally modify it.
::: accessible/tests/mochitest/jsat/test_live_regions.html
@@ +471,5 @@
> <p id="text_remove_descendant2">Descendant Text Removed</p>
> </div>
> </div>
> </body>
> +</html>
no changes to this file either, please revert
::: accessible/tests/mochitest/jsat/test_quicknav_modes.html
@@ +99,5 @@
> title="[AccessFu] Add mochitest for enabling">
> Mozilla Bug 811307
> </a>
> </body>
> +</html>
no changes to this file either, please revert
::: accessible/tests/mochitest/jsat/test_tables.html
@@ +569,5 @@
> <tr><td>Row2</td></tr>
> </table>
> </div>
> </body>
> +</html>
no changes to this file either, please revert
::: caps/tests/mochitest/test_app_principal_equality.html
@@ +19,1 @@
> SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
I understand there are issues with removing these 3 lines, we can address them in a followup. Please add a comment to indicate that, or remove all changes to this file.
::: dom/base/test/test_bug666604.html
@@ +133,3 @@
> }
> + testlink.click();
> +SimpleTest.finish();
whitespace after .click();
please indent SimpleTest.finish() properly.
::: dom/base/test/test_child_process_shutdown_message.html
@@ +122,1 @@
> // TODO: remove in bug 820712
this comment should apply only to: network.disable.ipc.security, please change it to be:
// TODO: remove "network.disable.ipc.security" in bug 820712
::: dom/base/test/test_websocket_permessage_deflate.html
@@ +94,5 @@
> }
> }
> }
>
> +function loadDeflate(){
nit: space between () {
::: dom/canvas/test/test_canvas_focusring.html
@@ +90,5 @@
> SimpleTest.finish();
> }
>
> +SpecialPowers.pushPrefEnv({"set":[["canvas.focusring.enabled", true],
> + ["canvas.customfocusring.enabled", true]]}, addLoadEvent(runTests))
add a ; at the end
the callback should be: function () { addLoadEvent(runTests); }
::: dom/canvas/test/test_canvas_path.html
@@ +436,4 @@
> SimpleTest.finish();
> }
>
> +SpecialPowers.pushPrefEnv({"set":[["canvas.path.enabled", true]]},function(){addLoadEvent(runTests);})
; at the end
::: dom/canvas/test/test_hitregion_canvas.html
@@ +79,3 @@
> }
>
> +SpecialPowers.pushPrefEnv({"set":[["canvas.hitregions.enabled", true]]}, addLoadEvent(runTests))
nit: ; at the end.
::: dom/datastore/tests/test_bug976311.html
@@ +93,5 @@
> SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm");
> }
>
> SpecialPowers.setAllAppsLaunchable(true);
> + SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest)
nit: missing ; at the end.
::: dom/datastore/tests/test_oop_events.html
@@ +117,5 @@
> SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm");
> }
>
> SpecialPowers.setAllAppsLaunchable(true);
> + SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest)
nit: ; at the end.
::: dom/datastore/tests/test_readonly.html
@@ +13,5 @@
> var gHostedManifestURL2 = 'http://example.com/tests/dom/datastore/tests/file_app.sjs?testToken=file_readonly.html&template=file_app2.template.webapp';
> + var gGenerator;
> +
> + SpecialPowers.pushPrefEnv({"set": [["dom.mozBrowserFramesEnabled", true]]}, function(){gGenerator = runTest()});
> +
nit: lines 15 and 17 are blank with just whitespace.
::: dom/datastore/tests/test_sync_worker.html
@@ +87,5 @@
> if (SpecialPowers.isMainProcess()) {
> SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm");
> }
>
> + SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest)
nit: ; at the end.
::: dom/datastore/tests/test_worker_close.html
@@ +88,5 @@
> SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm");
> }
>
> SpecialPowers.setAllAppsLaunchable(true);
> + SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest)
nit: ; at the end.
::: dom/events/test/test_bug607464.html
@@ +73,5 @@
> + SpecialPowers.pushPrefEnv({"set":[["general.smoothScroll", true],
> + ["mousewheel.acceleration.start", -1],
> + ["mousewheel.system_scroll_override_on_root_content.enabled", false]
> + ]},function(){ SimpleTest.executeSoon(runTest);});
> +
nit: blank line with whitespace, just remove the blank line.
::: dom/events/test/test_eventTimeStamp.html
@@ +118,5 @@
> </script>
> </pre>
> </body>
> </html>
> +
only a blank line added in this file, please revert this.
::: dom/html/test/file_fullscreen-denied.html
@@ +42,5 @@
>
> // Request full-screen from a non trusted context (this script isn't a user
> // generated event!).
> + SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", true]]}, startTest);
> +
nit: remove the whitespace at tend of line 45, and whitespace on line 46.
@@ +43,5 @@
> // Request full-screen from a non trusted context (this script isn't a user
> // generated event!).
> + SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", true]]}, startTest);
> +
> + function startTest(){
nit: add space between: () {
Comment 26•11 years ago
|
||
Attachment #8562970 -
Attachment is obsolete: true
| Reporter | ||
Comment 27•11 years ago
|
||
(In reply to Anish from comment #26)
> Created attachment 8563237 [details] [diff] [review]
> setBool.patch
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7d014685984b
| Reporter | ||
Comment 28•11 years ago
|
||
2 failures in the try run:
+++ b/dom/canvas/test/test_canvas_focusring.html
-addLoadEvent(runTests);
+SpecialPowers.pushPrefEnv({"set":[["canvas.focusring.enabled", true],
+ ["canvas.customfocusring.enabled", true]]}, function() { addLoadEvent(runTests) });
You need to put the pushPrefEnv call inside the addLoadEvent (and runTests then has to be inside the pushPrefEnv call.
+++ b/toolkit/components/url-classifier/tests/mochitest/test_classified_annotations.html
Like I tried to explain you on irc, don't try to set all the prefs here in 1 place, try to keep the pref setting in the same place as it was (so 2 pushPrefEnv calls in 2 separate places). Not sure if it would fix this timeout failure, though. If it doesn't, then leave this test out of the patch, for now.
| Reporter | ||
Comment 29•11 years ago
|
||
Comment on attachment 8563237 [details] [diff] [review]
setBool.patch
Review of attachment 8563237 [details] [diff] [review]:
-----------------------------------------------------------------
I started a bit with reviewing some of the files, tomorrow I'll try to review the rest.
::: accessible/tests/mochitest/elm/test_canvas.html
@@ +38,5 @@
> }
>
> SimpleTest.waitForExplicitFinish();
> + SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]},
> + function(){addA11yLoadEvent(doTest);})
This line has to be indented by 2 spaces.
::: accessible/tests/mochitest/hittest/test_canvas_hitregion.html
@@ +70,3 @@
> SimpleTest.waitForExplicitFinish();
> + SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]},
> + function(){addA11yLoadEvent(doTest);})
Same here.
::: browser/base/content/test/general/test_contextmenu.html
@@ +850,3 @@
> setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
>
> +function strtTest()
strtTest? Make it startTest please.
::: caps/tests/mochitest/test_app_principal_equality.html
@@ +13,5 @@
> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=777467">Mozilla Bug 777467</a>
> <p id="display"></p>
> <script>
> // Initialization.
> + //Removing these lines causes error even after the introduction of pushPrefEnv
That's because mozbrowser and mozapp iframes are only instantiated during creation, not afterwards.
So you'll have to create the iframes dynamically if you want to get this to work.
Perhaps better to tackle this file in a different patch, though.
::: docshell/test/navigation/test_bug430723.html
@@ +40,2 @@
>
> window.onload = runTest;
Why not put the anonmous function with the pushPrefEnv call here, with inside it, the reference to the runTest function?
That seems less messy to me.
::: dom/apps/tests/test_app_update.html
@@ +22,5 @@
> // We need to set the trusted hosted app csp pref since it's only in
> // b2g.js for now.
> function setCSPPrefs() {
> + SpecialPowers.pushPrefEnv({'set':[["security.apps.trusted.CSP.default",
> +"default-src *; object-src 'none'"],["dom.mozBrowserFramesEnabled",true]]},
Note that the common style is to do "], [", not "],[". So please fix that, if you can.
Attachment #8563237 -
Flags: review-
Comment 30•11 years ago
|
||
(In reply to Martijn Wargers [:mwargers] (QA) from comment #29)
> Comment on attachment 8563237 [details] [diff] [review]
> setBool.patch
>
> Review of attachment 8563237 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> I started a bit with reviewing some of the files, tomorrow I'll try to
> review the rest.
>
> ::: accessible/tests/mochitest/elm/test_canvas.html
> @@ +38,5 @@
> > }
> >
> > SimpleTest.waitForExplicitFinish();
> > + SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]},
> > + function(){addA11yLoadEvent(doTest);})
>
> This line has to be indented by 2 spaces.
>
> ::: accessible/tests/mochitest/hittest/test_canvas_hitregion.html
> @@ +70,3 @@
> > SimpleTest.waitForExplicitFinish();
> > + SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]},
> > + function(){addA11yLoadEvent(doTest);})
>
> Same here.
>
> ::: browser/base/content/test/general/test_contextmenu.html
> @@ +850,3 @@
> > setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
> >
> > +function strtTest()
>
> strtTest? Make it startTest please.
>
> ::: caps/tests/mochitest/test_app_principal_equality.html
> @@ +13,5 @@
> > <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=777467">Mozilla Bug 777467</a>
> > <p id="display"></p>
> > <script>
> > // Initialization.
> > + //Removing these lines causes error even after the introduction of pushPrefEnv
>
> That's because mozbrowser and mozapp iframes are only instantiated during
> creation, not afterwards.
> So you'll have to create the iframes dynamically if you want to get this to
> work.
> Perhaps better to tackle this file in a different patch, though.
>
> ::: docshell/test/navigation/test_bug430723.html
> @@ +40,2 @@
> >
> > window.onload = runTest;
>
> Why not put the anonmous function with the pushPrefEnv call here, with
> inside it, the reference to the runTest function?
> That seems less messy to me.
>
> ::: dom/apps/tests/test_app_update.html
> @@ +22,5 @@
> > // We need to set the trusted hosted app csp pref since it's only in
> > // b2g.js for now.
> > function setCSPPrefs() {
> > + SpecialPowers.pushPrefEnv({'set':[["security.apps.trusted.CSP.default",
> > +"default-src *; object-src 'none'"],["dom.mozBrowserFramesEnabled",true]]},
>
> Note that the common style is to do "], [", not "],[". So please fix that,
> if you can.
yah mwargers ! regarding caps/tests/mochitest/test_app_principal_equality.html I am considering it to be done in another patch ! thinking of getting this landed first!
And regarding docshell/test/navigation/test_bug430723.html both does the same thing but your idea seems to be great ! so will change it in the next patch !
Comment 31•11 years ago
|
||
Attachment #8563237 -
Attachment is obsolete: true
Comment 32•11 years ago
|
||
Attachment #8563470 -
Attachment is obsolete: true
Comment 33•11 years ago
|
||
| Reporter | ||
Comment 34•11 years ago
|
||
(In reply to Joel Maher (:jmaher) from comment #33)
> pushed to try:
> https://treeherder.mozilla.org/#/jobs?repo=try&revision=5d86375be9be
I see these failures:
dom/tests/mochitest/general/test_clipboard_events.html
dom/canvas/test/test_hitregion_canvas.html
dom/base/test/test_EventSource_redirects.html on Android
toolkit/components/satchel/test/test_form_submission.html
browser/base/content/test/general/test_contextmenu.html
I took a brief look at them. I think you should remove those files out of the patch for now. Fixing them is a little bit more complicated. Except for test_EventSource_redirects.html, I'll give you directions on how to fix that in my review, so you may want to do that in this patch, but you can also do that in a follow-up patch.
| Reporter | ||
Comment 35•11 years ago
|
||
Comment on attachment 8563576 [details] [diff] [review]
setBool.patch
Review of attachment 8563576 [details] [diff] [review]:
-----------------------------------------------------------------
::: accessible/tests/mochitest/elm/test_canvas.html
@@ +38,5 @@
> }
>
> SimpleTest.waitForExplicitFinish();
> + SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]},
> + function(){addA11yLoadEvent(doTest);})
This has to be the other way around, e.g like:
addA11yLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]}, doTest);
});
Because you can not know if the a11yloadEvent already fired while this code is not finished yet doing this pushPrefEnv (remember, it's async, it can happen directly, but could also take 10 seconds).
::: accessible/tests/mochitest/hittest/test_canvas_hitregion.html
@@ +70,3 @@
> SimpleTest.waitForExplicitFinish();
> + SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]},
> + function(){addA11yLoadEvent(doTest);})
Like in test_canvas.html, this has to be the other way around.
::: browser/base/content/test/general/test_contextmenu.html
@@ +850,1 @@
> setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
This depends on the plugins.click_to_play pref to be true, which now isn't anymore.
I think this has also be put in the setupTest() function.
@@ +850,5 @@
> setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
>
> +function setupTest()
> +{
> + var subwindow = window.open("./subtst_contextmenu.html", "contextmenu-subtext", "width=600,height=800");
Ok, this test was failing on try, because subwindow is not defined anymore in the global scope.
You need to add "var subwindow;" just before setupTest and then go subwindow = window.open( inside setupTest().
I think that should fix the tryserver failure.
::: caps/tests/mochitest/test_app_principal_equality.html
@@ +18,2 @@
> SpecialPowers.addPermission("browser", true, document);
> SpecialPowers.addPermission("embed-apps", true, document);
See description hereunder on how to be able to remove this.
@@ +47,5 @@
> + {type: "browser", allow: true, context: document},
> + {type: "embed-apps", allow: true, context: document}], startTest);});
> +
> +function startTest(){
> + addLoadEvent(function() {
The addLoadEvent has to run at first.
So from order or execution addLoadEvent, which calls pushPrefEnv, which calls pushPermissions, which calls startTest.
Also, you need to dynamically create the iframes:
<iframe src="error404"></iframe>
<iframe mozbrowser src="error404"></iframe>
<iframe mozapp="http://example.org/manifest.webapp" mozbrowser src="error404"></iframe>
The "browser" and "embed-apps" permissions are only checked at instantiation of documents, not dynamically, I believe.
Then, it should be possible to remove the above addPermission calls.
This can be a little bit tricky, so you might want to do this in a new patch.
::: docshell/test/navigation/test_bug430723.html
@@ +44,5 @@
>
> var smoothScrollPref = "general.smoothScroll";
> function runTest() {
> + SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]},
> + function(){
I would keep this on the same line as the pushPrefEnv function, but it's your call.
::: dom/base/test/test_EventSource_redirects.html
@@ +47,5 @@
> }
>
> SimpleTest.waitForExplicitFinish();
> + SpecialPowers.pushPrefEnv({"set": [['dom.server-events.enabled', true]]},
> + function(){addLoadEvent(doTest);});
Other way around again. First the addLoadEvent, which calls pushPrefEnv, which calls doTest.
::: dom/base/test/test_bug715041.xul
@@ +807,5 @@
> TestActiveToActiveNotificationEnabled = true;
> AddShiftLocalEnabled = true;
> AddIdleObserverWithInvalidTimeEnabled = false;
>
> + SimpleTest.waitForExplicitFinish();
Huh? There should already be a waitForExplicitFinish call in this file, so you shouldn't add this one.
::: dom/base/test/test_child_process_shutdown_message.html
@@ +122,5 @@
> // TODO: remove in bug 820712
> + SpecialPowers.pushPrefEnv({
> + "set": [['dom.mozBrowserFramesEnabled', true],
> + ['dom.ipc.browser_frames.oop_by_default', true],
> + ['network.disable.ipc.security', true]]}, runNextTest);
I like how these prefs are neatly indented, I think this is ideal.
If you could also do that for the other ones, that would be great!
But I think you need to indent it 2 extra lines. "set": should not be at the same line as SpecialPowers.
::: dom/base/test/test_websocket_permessage_deflate.html
@@ +96,5 @@
> }
>
> +function loadDeflate() {
> + SpecialPowers.pushPrefEnv({"set":[['network.websocket.extensions.permessage-deflate', tests[testIdx][0]]]}, testDeflate);
> +}
Good solution!
::: dom/browser-element/mochitest/priority/test_Preallocated.html
@@ +64,4 @@
> }
> +// Setting this pref to true should cause us to prelaunch a process.
> +SpecialPowers.pushPrefEnv({'set':[["dom.ipc.processPrelaunch.enabled",true]]},
> + function() { addEventListener('testready', runTest); });
Why indent it so much, why not indent 2 lines, like normally?
::: dom/canvas/test/test_2d_composite_canvaspattern_setTransform.html
@@ +65,5 @@
> }
> SimpleTest.finish();
> }
>
> +SpecialPowers.pushPrefEnv({"set":[["canvas.path.enabled", true]]}, function() { addLoadEvent(runTests); })
Other way around. First addLoadEvent, which calls pushPrefEnv, which calls runTests.
::: dom/canvas/test/test_canvas_focusring.html
@@ +90,5 @@
> SimpleTest.finish();
> }
>
> +SpecialPowers.pushPrefEnv({"set":[["canvas.focusring.enabled", true],
> + ["canvas.customfocusring.enabled", true]]}, addLoadEvent(runTests));
Other way around again. I think you should get the story by now.
::: dom/canvas/test/test_canvas_path.html
@@ +436,4 @@
> SimpleTest.finish();
> }
>
> +SpecialPowers.pushPrefEnv({"set":[["canvas.path.enabled", true]]},function() { addLoadEvent(runTests); });
Other way around again.
::: dom/canvas/test/test_hitregion_canvas.html
@@ +79,3 @@
> }
>
> +SpecialPowers.pushPrefEnv({"set":[["canvas.hitregions.enabled", true]]}, function() { addLoadEvent(runTests) });
This has to be the other way around, just like I described in test_canvas.html.
I think this is also the reason why you saw this timeout failure on Android on tryserver.
::: dom/datastore/tests/test_readonly.html
@@ +11,5 @@
> <script type="application/javascript;version=1.7">
> var gHostedManifestURL = 'http://test/tests/dom/datastore/tests/file_app.sjs?testToken=file_readonly.html';
> var gHostedManifestURL2 = 'http://example.com/tests/dom/datastore/tests/file_app.sjs?testToken=file_readonly.html&template=file_app2.template.webapp';
> + var gGenerator;
> + SpecialPowers.pushPrefEnv({"set": [["dom.mozBrowserFramesEnabled", true]]}, function() { gGenerator = runTest() });
The pushPermissions call has to be inside pushPrefEnv call too, otherwise gGenerator.next() might be called earlier than gGenerator = runTest() in certain situations.
::: dom/events/test/test_bug422132.html
@@ +28,5 @@
> SimpleTest.requestFlakyTimeout("untriaged");
> +SpecialPowers.pushPrefEnv({"set":[["general.smoothScroll", false],
> + ["mousewheel.min_line_scroll_amount", 1],
> + ["mousewheel.transaction.timeout", 100000]]},
> + function() { SimpleTest.waitForFocus(runTests, window); });
This has to be the other way around: waitForFocus should call pushPrefEnv, which should call runTests.
::: dom/events/test/test_bug563329.html
@@ +76,1 @@
>
Otherway around. addLoadEvent->pushPrefEnv->doTest.
::: dom/events/test/test_bug574663.html
@@ +100,4 @@
> window.onload = function () {
> + SpecialPowers.pushPrefEnv({"set":[["general.smoothScroll", false],
> + ["mousewheel.acceleration.start", -1],
> + ["mousewheel.system_scroll_override_on_root_content.enabled", false],
The indentation looks completely wrong here.
@@ +100,5 @@
> window.onload = function () {
> + SpecialPowers.pushPrefEnv({"set":[["general.smoothScroll", false],
> + ["mousewheel.acceleration.start", -1],
> + ["mousewheel.system_scroll_override_on_root_content.enabled", false],
> + ["mousewheel.with_control.action", 3]]},function() { SimpleTest.executeSoon(runTest) });
I don't think the SimpleTest.executeSoon is necesary anymore, since we made the prefs setting asynchronous now.
::: dom/events/test/test_bug607464.html
@@ +72,4 @@
> window.onload = function () {
> + SpecialPowers.pushPrefEnv({"set":[["general.smoothScroll", true],
> + ["mousewheel.acceleration.start", -1],
> + ["mousewheel.system_scroll_override_on_root_content.enabled", false]
Indentation wrong.
@@ +72,5 @@
> window.onload = function () {
> + SpecialPowers.pushPrefEnv({"set":[["general.smoothScroll", true],
> + ["mousewheel.acceleration.start", -1],
> + ["mousewheel.system_scroll_override_on_root_content.enabled", false]
> + ]},function() { SimpleTest.executeSoon(runTest); });
I think you can remove SimpleTest.executeSoon call.
::: dom/events/test/test_bug822898.html
@@ +339,3 @@
> window.onload = function () {
> + SpecialPowers.pushPrefEnv({"set":[["dom.w3c_pointer_events.enabled", true]]}, function() {
> + SimpleTest.executeSoon(runTests); });
SimpleTest.executeSoon can be removed (not the runTests part of course).
::: dom/html/test/file_fullscreen-api.html
@@ +208,5 @@
> }
>
> function exit4(event) {
> ok(!document.mozFullScreen, "38. Should be back in non-full-screen mode (fifth time)");
> + SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", true]]}, function() {
The indentation here is wrong (and so also for the following lines).
@@ +238,5 @@
> is(document.mozFullScreenEnabled, false, "document.mozFullScreenEnabled should be false if full-screen-api.enabled is false");
>
> addFullscreenErrorContinuation(error3);
> fullScreenElement().mozRequestFullScreen();
> + });
The indentation for this whole block looks wrong this way.
@@ +249,4 @@
> is(document.mozFullScreenEnabled, true, "document.mozFullScreenEnabled should be true if full-screen-api.enabled is true");
>
> opener.nextTest();
> + });
You can't just add brackets, you need to indent the inside then by 2 spaces.
::: dom/html/test/file_fullscreen-denied.html
@@ +43,5 @@
> // Request full-screen from a non trusted context (this script isn't a user
> // generated event!).
> + SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", true]]}, startTest);
> + function startTest() {
> + addFullscreenErrorContinuation(
You need to indent by 2 spaces (sorry, I feel really anal by now).
@@ +77,5 @@
> // event in this document.
> var iframe = document.createElement("iframe");
> iframe.src = "file_fullscreen-denied-inner.html";
> document.body.appendChild(iframe);
> + });
Add the right indentation inside the brackets.
::: dom/html/test/file_fullscreen-esc-context-menu.html
@@ +60,2 @@
> document.body.mozRequestFullScreen();
> + });
Fix the indentation here.
::: dom/html/test/forms/test_input_number_key_events.html
@@ +33,1 @@
> });
This line needs to be indented by 2 spaces.
::: dom/html/test/forms/test_input_range_key_events.html
@@ +26,5 @@
> SimpleTest.waitForExplicitFinish();
>
> // Turn off Spatial Navigation because it hijacks arrow keydown events:
> +SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, function() {
> + SimpleTest.waitForFocus(function() {
1 space extra indentation here.
::: dom/html/test/forms/test_input_range_rounding.html
@@ +30,5 @@
> +SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, function() {
> + SimpleTest.waitForFocus(function() {
> + test();
> + SimpleTest.finish();
> + });
First waitForFocus, then pushPrefEnv, then function() {test(); SimpleTest.finish()}
::: dom/html/test/forms/test_valueAsDate_pref.html
@@ +20,5 @@
> var state = states.shift();
>
> if (state == 'end') {
> + SpecialPowers.pushPrefEnv({"set":[["dom.experimental_forms", pref]]},
> + function() { SimpleTest.finish(); });
This pushPrefEnv call should not be there. Just call SimpleTest.finish();
::: dom/html/test/test_bug369370.html
@@ +95,5 @@
>
> SimpleTest.waitForExplicitFinish();
> + SpecialPowers.pushPrefEnv({"set":[["browser.enable_automatic_image_resizing", true]]},
> + function() {
> + var kidDoc; // will init onload
kidDoc needs also need to defined globally, no?
You need to indent by 2 spaces here, btw.
kidWin = window.open needs also be called inside this function instead of outside it.
But kidWin still needs to be defined globally.
::: dom/html/test/test_bug633058.html
@@ +24,5 @@
>
> // Turn off Spatial Navigation so that the 'keypress' event fires.
> +SpecialPowers.pushPrefEnv({"set":[['snav.enabled', false]]}, startTest);
> +function startTest() {
> + SimpleTest.waitForFocus(function() {
I think SimpleTest.waitForFocus needs to be called first, then pushPrefEnv, which then calls startTest.
@@ +59,5 @@
> synthesizeKey('VK_ESCAPE', {});
> synthesizeKey('VK_RETURN', {});
> }, false);
> input.focus();
> });
This is not indented right.
::: dom/html/test/test_bug674558.html
@@ +26,3 @@
>
> +function startTest() {
> + SimpleTest.waitForFocus(function() {
Again, like previous test file. Firs call SimpleTest.waitForFocus, which calls pushPrefEnv, which calls startTest.
@@ +29,1 @@
> function textAreaCtor() {
This line and following lines need to be indented by 2 spaces, because of the added brackets.
::: dom/html/test/test_fullscreen-api.html
@@ +104,5 @@
> + SpecialPowers.pushPrefEnv({"set":[["full-screen-api.enabled", true],
> + ["full-screen-api.allow-trusted-requests-only", false]]},
> + function() {
> + addLoadEvent(nextTest);
> + SimpleTest.waitForExplicitFinish();
Above 2 lines need to be called first, then inside the addLoadEvent, call pushPrefEnv, which calls nextTest.
::: dom/ipc/tests/test_NuwaProcessCreation.html
@@ +89,5 @@
> }
>
> +// Shutdown preallocated process before starting test.
> +SpecialPowers.pushPrefEnv({"set":[['dom.ipc.processPrelaunch.enabled', false]]},
> + function() { testLoader.onTestReady = runTest; });
First call testLoader.onTestReady, which should call pushPrefEnv, which should call runTest.
::: dom/ipc/tests/test_NuwaProcessDeadlock.html
@@ +91,5 @@
> }
>
> +// Shutdown preallocated process before starting test.
> +SpecialPowers.pushPrefEnv({"set": [['dom.ipc.processPrelaunch.enabled', false]]},
> + function() { testLoader.onTestReady = runTest; });
Again, like previous file.
::: dom/network/tests/test_networkstats_enabled_no_perm.html
@@ +15,5 @@
> // Test to ensure NetworkStats is enabled but mozNetworkStats.getAvailableNetworks
> // does not work in content because mozNetworkStats is null when no permission.
> +SimpleTest.waitForExplicitFinish();
> +SpecialPowers.pushPrefEnv({"set": [['dom.mozNetworkStats.enabled', true]]}, runTest);
> + function runTest(){
Indentation has to be with 2 spaces.
::: dom/network/tests/test_tcpsocket_enabled_no_perm.html
@@ +18,5 @@
> **/
> +SimpleTest.waitForExplicitFinish();
> +SpecialPowers.pushPrefEnv({"set": [['dom.mozTCPSocket.enabled', true]]}, runTest);
> +function runTest(){
> + ok('mozTCPSocket' in navigator, "navigator.mozTCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
Indentation by 2 spaces please.
@@ +26,5 @@
> throw new Error("Error: navigator.mozTCPSocket.open should raise for content that does not have the tcp-socket permission");
> } catch (e) {
> ok(true, "navigator.mozTCPSocket.open should raise for content that does not have the tcp-socket permission");
> }
> +SimpleTest.finish();
This needs to be indented by 2 lines.
::: dom/network/tests/test_tcpsocket_enabled_with_perm.html
@@ +24,5 @@
> ok('mozTCPSocket' in navigator, "navigator.mozTCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
>
> ok(navigator.mozTCPSocket.open('localhost', 80), "navigator.mozTCPSocket.open should work for content that has the tcp-socket permission");
> +SimpleTest.finish();
> +}
Apart from the indentation, this is good.
::: dom/tests/mochitest/chrome/test_clipboard_events_chrome.html
@@ +17,3 @@
> window.open("data:text/html,<body onload='window.opener.doChecks(this)'><input id='i' value='Sample Text'></body>",
> "_blank", "chrome,width=200,height=200");
> + });
Correct indentation inside the brackets, please.
::: dom/tests/mochitest/general/test_clipboard_events.html
@@ +562,5 @@
> } finally {
> contentInput.oncut = null;
> contentInput.oncopy = null;
> contentInput.onpaste = null;
> }
Indentation is not good here, because of the extra brackets added.
::: dom/tests/mochitest/general/test_vibrator.html
@@ +81,1 @@
> tests();
This one needs to be removed, no?
::: dom/tests/mochitest/localstorage/test_appIsolation.html
@@ +125,5 @@
>
> var gTestRunner = runTest();
>
> +SpecialPowers.pushPrefEnv({"set": [['dom.mozBrowserFramesEnabled', true]]}, startTest);
> +
I'd rather keep the addLoadEvent, run the pushPrefEnv call in there.
::: dom/tests/mochitest/pointerlock/file_pointerLockPref.html
@@ +59,3 @@
> }
> else {
> + SpecialPowers.pushPrefEnv({"set": [['full-screen-api.pointer-lock.enabled', false]]}, runTests);
I don't think pushPrefEnv is necessary. The setBoolPref call was used to set it back to the beginstate.
::: dom/tests/mochitest/pointerlock/test_pointerlock-api.html
@@ +107,5 @@
> + // Ensure the full-screen api is enabled, and will be disabled on test exit.
> + // Disable the requirement for trusted contexts only, so the tests are easier to write.
> + SpecialPowers.pushPrefEnv({"set": [['full-screen-api.enabled', true]
> + ['full-screen-api.allow-trusted-requests-only', false]]},
> + function() { addLoadEvent(nextTest); });
Other way around again. First addLoadEvent, then pushPrefEnv, then nextTest.
::: dom/xul/test/test_bug757137.xul
@@ +37,1 @@
> otherWindow.onload = function () {
You are sure that otherWindow.onload is not called by now?
Also, indentation.
::: editor/libeditor/tests/test_bug549262.html
@@ +29,5 @@
> function step() {
> cwu.advanceTimeAndRefresh(100);
> }
> +SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, startTest);
> + function startTest() {
First waitForFocus, which calls pushPrefEnv, which calls startTest.
Also indent by 2 spaces please, instead of 1.
::: editor/libeditor/tests/test_bug578771.html
@@ +44,3 @@
>
> + function startTest() {
> + SimpleTest.waitForFocus(function() {
First waitForFocus, which calls pushPrefEnv, which calls startTest.
::: editor/libeditor/tests/test_bug640321.html
@@ +186,1 @@
>
Very good!
::: editor/libeditor/tests/test_bug645914.html
@@ +23,5 @@
> SimpleTest.waitForExplicitFinish();
> +SpecialPowers.pushPrefEnv({"set":[["layout.word_select.eat_space_to_next_word", true],
> + ["browser.triple_click_selects_paragraph", false]]}, startTest);
> +function startTest() {
> + SimpleTest.waitForFocus(function() {
First waitforFocus, then ... etc.
::: editor/libeditor/tests/test_bug674770-1.html
@@ +24,5 @@
>
> SimpleTest.waitForExplicitFinish();
> +SpecialPowers.pushPrefEnv({"set":[["middlemouse.paste", true]]}, startTest);
> +function startTest() {
> + SimpleTest.waitForFocus(function() {
First waitForFocus, then etc.
::: editor/libeditor/tests/test_bug674770-2.html
@@ +51,3 @@
>
> +function startTest() {
> + SimpleTest.waitForFocus(function() {
You should know what to change here.
::: editor/libeditor/tests/test_bug795785.html
@@ +31,5 @@
> // events.
> +SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]},
> +function() {
> + SimpleTest.waitForFocus(runTests);
> +});
Again.
::: extensions/cookie/test/test_permissionmanager_app_isolation.html
@@ +156,5 @@
> +SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]},
> + function() {
> + gTestRunner = runTest();
> + gTestRunner.next();
> + });
Indent by 2 spaces, please.
You still need to add var gTestRunner before the pushPrefEnv to declare the variable, that's more correct.
::: image/test/crashtests/ownerdiscard.html
@@ +44,5 @@
> }
> + SpecialPowers.pushPrefEnv({"set":[["min_discard_timeout_ms", 1]]},
> + function() {
> + window.addEventListener("load", loadhandler, false);
> + });
First window.addEventListener, then ...
::: testing/mochitest/tests/Harness_sanity/test_SpecialPowersExtension.html
@@ +33,5 @@
> var startTime = new Date();
> function starttest(){
> + SpecialPowers.pushPrefEnv({"set":[["extensions.checkCompatibility", true],
> + ["extensions.foobar", 42],
> + ["extensions.foobaz", "hi there"]]}, function() {
You shouldn't change this file at all. This is actually to test that the setBoolPref functions work correctly.
::: testing/mochitest/tests/Harness_sanity/test_SpecialPowersPushPrefEnv.html
@@ +14,2 @@
> SpecialPowers.setIntPref("test.int", 1);
> + SpecialPowers.setCharPref("test.char", 'test');
Don't change this file. This is for testing the setBoolPref/setIntPref/setCharPref functions.
::: toolkit/components/passwordmgr/test/test_basic_form_2.html
@@ +56,5 @@
> +// Assume that the pref starts out true, so set to false
> +SpecialPowers.pushPrefEnv({"set":[["signon.autofillForms", false]]}, setup);
> +function setup() {
> + window.addEventListener("runTests", startTest);
> +}
I think first window.addEventListener, then pushPrefEnv, then setup.
::: toolkit/components/satchel/test/test_form_submission.html
@@ +457,5 @@
> {
> // Forms 13 and 14 would trigger a save-password notification. Temporarily
> // disable pwmgr, then reenable it.
> if (formNum == 12)
> + SpecialPowers.pushPrefEnv({"set":[["signon.rememberSignons", false]]}, timeOut());
Remove the () from timeOut().
@@ +463,5 @@
> SpecialPowers.clearUserPref("signon.rememberSignons");
>
> // Forms 20 and 21 requires browser.formfill.saveHttpsForms to be false
> if (formNum == 19)
> + SpecialPowers.pushPrefEnv({"set":[["browser.formfill.saveHttpsForms", false]]}, timeOut());
Remove the () from timeOut().
@@ +483,5 @@
>
> // Form 109 requires browser.formfill.save_https_forms to be true;
> // Form 110 requires it to be false.
> if (formNum == 108)
> + SpecialPowers.pushPrefEnv({"set":[["browser.formfill.saveHttpsForms", true]]}, timeOut());
Remove the () from timeOut().
@@ +488,2 @@
> if (formNum == 109)
> + SpecialPowers.pushPrefEnv({"set":[["browser.formfill.saveHttpsForms", false]]}, timeOut());
Remove the () from timeOut().
@@ +504,5 @@
> // immediately.
> //
> // This in itself is fine, but if there are errors in the code, mochitests
> // will in some cases give you "server too busy", which is hard to debug!
> + function timeOut() {
Because of the pushPrefEnv calls, you'll be calling this function 4 times.
Is that correct? I almost can't imagine.
::: widget/tests/test_assign_event_data.html
@@ +643,5 @@
> + ["mousewheel.with_control.action.override_x", -1],
> + ["mousewheel.with_alt.action", 0],
> + ["mousewheel.with_alt.action.override_x", -1],
> + ["mousewheel.with_meta.action", 0],
> + ["mousewheel.with_meta.action.override_x", -1]]}, runNextTest);
Nicely done!
Attachment #8563576 -
Flags: review-
Comment 36•11 years ago
|
||
Attachment #8563576 -
Attachment is obsolete: true
| Reporter | ||
Comment 37•11 years ago
|
||
(In reply to Anish from comment #36)
> Created attachment 8564784 [details] [diff] [review]
> setBool.patch
https://tbpl.mozilla.org/?tree=Try&rev=9fbb145565ce
Comment 38•11 years ago
|
||
| Reporter | ||
Comment 39•11 years ago
|
||
Comment on attachment 8564784 [details] [diff] [review]
setBool.patch
Review of attachment 8564784 [details] [diff] [review]:
-----------------------------------------------------------------
(In reply to Martijn Wargers [:mwargers] (QA) from comment #37)
> (In reply to Anish from comment #36)
> > Created attachment 8564784 [details] [diff] [review]
> > setBool.patch
>
> https://tbpl.mozilla.org/?tree=Try&rev=9fbb145565ce
All tests are green!
I still found some things that you need to fix (and some minor things), but we're almost there, I think.
::: caps/tests/mochitest/test_app_principal_equality.html
@@ +57,5 @@
> for (var i=1; i<frames.length; ++i) {
> is(canAccessDocument(frames[i]), false,
> "should not be able to access the other frames");
> }
>
You didn't improve this file. I think it's better to not include this file in this patch, currently.
This file needs some major changes, to make it use pushPrefEnv and pushPermissions.
::: dom/base/test/test_bug666604.html
@@ +135,1 @@
> SimpleTest.finish();
This should probably be SimpleTest.executeSoon(SimpleTest.finish);
::: dom/html/test/forms/test_input_number_key_events.html
@@ +34,1 @@
> });
Sorry, I missed that in my previous review.
First call waitForFocus, then pushPrefEnv, then function() {etc..
::: dom/html/test/forms/test_input_range_key_events.html
@@ +34,1 @@
> });
First waitForFocus, then pushPrefEnv, then function() {test(); SimpleTest.finish()}
::: dom/tests/mochitest/general/test_vibrator.html
@@ +78,3 @@
> // Everything should be the same when the vibrator is disabled -- in
> // particular, a disabled vibrator shouldn't eat failures we'd otherwise
> // observe.
You removed the case for with dom.vibrator.enabled=false.
I think you need to do something like:
SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', true]]}, function() {
tests();
SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', false]]}, tests);
});
::: dom/tests/mochitest/localstorage/test_appIsolation.html
@@ +18,5 @@
>
> try {
> previousPrefs.mozBrowserFramesEnabled = SpecialPowers.getBoolPref('dom.mozBrowserFramesEnabled');
> } catch(e)
> {
I think you can also remove the previousPrefs.mozBrowserFramesEnabled references.
::: dom/xul/test/test_bug757137.xul
@@ +44,5 @@
> + ok(chromeWindow === null, 'mozbrowser iframe should not get ChromeWindow');
> +
> + otherWindow.close();
> + SimpleTest.waitForFocus(function() {
> + SimpleTest.finish();
I think SimpleTest.waitForFocus(SimpleTest.finish)) also works.
::: extensions/cookie/test/test_permissionmanager_app_isolation.html
@@ +35,5 @@
> };
>
> try {
> previousPrefs.mozBrowserFramesEnabled = SpecialPowers.getBoolPref('dom.mozBrowserFramesEnabled');
> } catch(e)
I think you can remove the previousPrefs.mozBrowserFramesEnabled part now in this test.
Attachment #8564784 -
Flags: review-
| Reporter | ||
Comment 40•11 years ago
|
||
(In reply to Joel Maher (:jmaher) from comment #38)
> https://tbpl.mozilla.org/?tree=Try&rev=ef52c2ba8186
Thanks Joel. I should have done a complete mochitest try run for all platforms. There are some failures there:
dom/canvas/test/test_canvas_focusring.html on Win7/WinXP:
- There is bug 1005846, which calls it an intermittent failure. I think this is because of the use of canvas.customfocusring.enabled pref, which enables drawCustomFocusRing. This will be removed in bug 1120371. There is nothing wrong with your code here. In fact, this change here exposes an otherwise intermittent failure lurking in Windows (which is bug 1005846). We should disable this test on Windows. I'll do that in bug 1005846.
dom/tests/mochitest/pointerlock/test_pointerlock-api.html on MacOSX 10.6:
- you forgot a comma between ['full-screen-api.enabled', true] and ['full-screen-api.allow-trusted-requests-only', false].
editor/libeditor/tests/test_bug674770-2.html on MacOSX10.6 and Windows.
- You forgot to set the prefs there, it seems:
+ SpecialPowers.pushPrefEnv({"set":[["", false], ["", true]]}, startTest);
dom/html/test/forms/test_input_radio_radiogroup.html on Android:
- You haven't modified this test. However, because of some other files you've changed, you might have exposed a bug that some pref has not been undone with these tests. I suspect that the snav.enabled pref has something to do with this, which is enabled by default on Android. So I think you need to modify this test to enable the snav.enabled pref, e.g., use SpecialPowers.pushPrefEnv snav.enabled here.
dom/ipc/tests/test_NuwaProcessCreation.html on B2G emulator:
- I think onTestReady might be called more than once in this case. I would just leave this test file out of the patch for now. The test author already knew to use pushPrefEnv, but didn't use it there for some reason.
Comment 41•11 years ago
|
||
Thanks :mwargers! A good summary of the failures and a review of the patch. Good news is we are down to roughly 5 failures and smaller review feedback- this is shaping up to be a good week :)
Comment 42•11 years ago
|
||
Attachment #8564784 -
Attachment is obsolete: true
| Reporter | ||
Comment 43•11 years ago
|
||
(In reply to Anish from comment #42)
> Created attachment 8565070 [details] [diff] [review]
> setBool.patch
https://treeherder.mozilla.org/#/jobs?repo=try&revision=33a2908a4367
| Reporter | ||
Comment 44•11 years ago
|
||
(In reply to Martijn Wargers [:mwargers] (QA) from comment #43)
> (In reply to Anish from comment #42)
> > Created attachment 8565070 [details] [diff] [review]
> > setBool.patch
>
> https://treeherder.mozilla.org/#/jobs?repo=try&revision=33a2908a4367
Failures in:
dom/tests/mochitest/general/test_vibrator.html
- you mixed up the false and true pref setting. The first time, the pref has to be set to false, the second one, it has to be set to true. I think you can also remove all references to origVibratorEnabled.
dom/tests/mochitest/pointerlock/test_pointerlock-api.html
dom/xul/test/test_bug486990.xul
dom/xul/test/test_bug757137.xul
- + SimpleTest.waitForFocus(SimpleTest.finish)); - you made an obvious mistake here.
dom/canvas/test/test_canvas_focusring.html
- Just leave this test out of the patch for now (this needs to removed anyway as part of bug 1120371),
dom/html/test/forms/test_radio_in_label.html
Some of these failures, you could have circumvented if you tested it locally. I would always test your changes first, before asking review or kick of a tryserver build.
Comment 45•11 years ago
|
||
(In reply to Martijn Wargers [:mwargers] (QA) from comment #44)
> (In reply to Martijn Wargers [:mwargers] (QA) from comment #43)
> > (In reply to Anish from comment #42)
> > > Created attachment 8565070 [details] [diff] [review]
> > > setBool.patch
> >
> > https://treeherder.mozilla.org/#/jobs?repo=try&revision=33a2908a4367
>
> Failures in:
> dom/tests/mochitest/general/test_vibrator.html
> - you mixed up the false and true pref setting. The first time, the pref has
> to be set to false, the second one, it has to be set to true. I think you
> can also remove all references to origVibratorEnabled.
>
> dom/tests/mochitest/pointerlock/test_pointerlock-api.html
>
> dom/xul/test/test_bug486990.xul
>
> dom/xul/test/test_bug757137.xul
> - + SimpleTest.waitForFocus(SimpleTest.finish)); - you made an obvious
> mistake here.
>
> dom/canvas/test/test_canvas_focusring.html
> - Just leave this test out of the patch for now (this needs to removed
> anyway as part of bug 1120371),
>
> dom/html/test/forms/test_radio_in_label.html
>
> Some of these failures, you could have circumvented if you tested it
> locally. I would always test your changes first, before asking review or
> kick of a tryserver build.
I did test it locally ! test_vibrator.html is working well in my system,the tests didnt show any error.I think the order of prefs is true followed by false only.
I had nothing to do with dom/xul/test/test_bug486990.xul and dom/html/test/forms/test_radio_in_label.html
The only thing I was careless about was in not removing the extra brackets in test_bug757137.xul
dom/tests/mochitest/pointerlock/test_pointerlock-api.html I dunno how to check it since none of the tests are working for it !
Sorry !
Comment 46•11 years ago
|
||
keep in mind that some of these fail on different platforms and not on linux, which makes it complicated. Another thing to watch out for is that changing a test can affect another test. This is problematic in two ways:
1) you actually break something
2) the test that is now failing depends on a preference or state of the browser which was incorrectly set before and now is fixed - in this case we need to fix the test that is failing.
Keep in mind some tests don't run on your local system while they might only run on windows opt or b2g.
| Reporter | ||
Comment 47•11 years ago
|
||
(In reply to Anish from comment #45)
> I did test it locally ! test_vibrator.html is working well in my system,the
> tests didnt show any error.I think the order of prefs is true followed by
> false only.
Sorry, I was wrong here. In this case, you need to add SimpleTest.waitForExplicitFinish() and SimpleTest.finish() (because this test didn't have that yet). Also, remove the origVibratorEnabled references and remove the try{} finally{} call
> I had nothing to do with dom/xul/test/test_bug486990.xul and
> dom/html/test/forms/test_radio_in_label.html
On irc:
17:02 Anish: dom/html/test/forms/test_radio_in_label.html I didnt touch this
17:03 mwargers: yes, I suspect you need to add the snav.enabled pref here, just like you did with test_input_radio_radiogroup.html
17:04 mwargers: could you add it to that file?
> dom/tests/mochitest/pointerlock/test_pointerlock-api.html I dunno how to
> check it since none of the tests are working for it !
> Sorry !
Regarding test_pointerlock-api.html , you moved the pref setting later in the document. I think SpecialPowers.setFullscreenAllowed needs those prefs already to be set. So make sure that those prefs are already set when SpecialPowers.setFullscreenAllowed is called.
Comment 48•11 years ago
|
||
| Reporter | ||
Updated•11 years ago
|
Attachment #8565070 -
Attachment is obsolete: true
Comment 49•11 years ago
|
||
Attachment #8565531 -
Attachment is obsolete: true
Comment 50•11 years ago
|
||
Comment on attachment 8565531 [details] [diff] [review]
setBool.patch
Review of attachment 8565531 [details] [diff] [review]:
-----------------------------------------------------------------
a few nits I saw- then this patch was updated before I could hit submit- made it though about half of the files.
::: accessible/tests/mochitest/jsat/test_alive.html
@@ +73,5 @@
> title="[AccessFu] Add mochitest for enabling">
> Mozilla Bug 811307
> </a>
> </body>
> +</html>
lets not change this one line.
::: accessible/tests/mochitest/jsat/test_live_regions.html
@@ +471,5 @@
> <p id="text_remove_descendant2">Descendant Text Removed</p>
> </div>
> </div>
> </body>
> +</html>
lets not change this one line.
::: accessible/tests/mochitest/jsat/test_quicknav_modes.html
@@ +99,5 @@
> title="[AccessFu] Add mochitest for enabling">
> Mozilla Bug 811307
> </a>
> </body>
> +</html>
this file should have no changes
::: accessible/tests/mochitest/jsat/test_tables.html
@@ +569,5 @@
> <tr><td>Row2</td></tr>
> </table>
> </div>
> </body>
> +</html>
this file should have no changes
::: dom/datastore/tests/test_readonly.html
@@ +11,5 @@
> <script type="application/javascript;version=1.7">
> var gHostedManifestURL = 'http://test/tests/dom/datastore/tests/file_app.sjs?testToken=file_readonly.html';
> var gHostedManifestURL2 = 'http://example.com/tests/dom/datastore/tests/file_app.sjs?testToken=file_readonly.html&template=file_app2.template.webapp';
> + var gGenerator;
> + SpecialPowers.pushPrefEnv({"set": [["dom.mozBrowserFramesEnabled", true]]}, function() {
nit: trailing space after {
Attachment #8565531 -
Attachment is obsolete: false
Comment 51•11 years ago
|
||
Attachment #8565531 -
Attachment is obsolete: true
Attachment #8565548 -
Attachment is obsolete: true
Comment 52•11 years ago
|
||
| Reporter | ||
Comment 53•11 years ago
|
||
(In reply to Joel Maher (:jmaher) from comment #52)
> https://tbpl.mozilla.org/?tree=Try&rev=5a704af3b8f2
Try linux all green, so now pushing to try to all platforms:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=5a684acadffb
https://tbpl.mozilla.org/?tree=Try&rev=5a684acadffb
Comment 54•11 years ago
|
||
osx 10.6 has mochitest-4 failures on:
dom/tests/mochitest/pointerlock/test_pointerlock-api.html
* https://treeherder.mozilla.org/logviewer.html#?job_id=5008108&repo=try
* this seems to be related to dom/tests/mochitest/pointerlock/file_pointerLockPref.html where we call div.mozRequestPointerLock from the callback.
* either play with this locally (odd that it runs on osx 10.6 since we turn it off here: https://dxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/pointerlock/test_pointerlock-api.html?from=test_pointerlock-api.html#94, or remove your changes for these two files.
* there are a lot of other tests which fail after this, I don't know if it is a side effect or not
b2g ICS emulator:
dom/ipc/tests/test_NuwaProcessDeadlock.html
* https://treeherder.mozilla.org/logviewer.html#?job_id=5005759&repo=try
* I wonder if the test itself requires us to not fix this- maybe we can revert the changes to this specific test case.
| Reporter | ||
Comment 55•11 years ago
|
||
(In reply to Joel Maher (:jmaher) from comment #54)
> odd that it runs on osx 10.6 since we turn
> it off here:
> https://dxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/
> pointerlock/test_pointerlock-api.html?from=test_pointerlock-api.html#94, or
OSX Lion is 10.7, so this test is disabled for 10.7 and higher.
Regarding file_pointerLockPref.html, I think in your patch, you've set the full-screen-api.pointer-lock.enabled pref to false, where it should have been set to true.
Not sure if that would fix the failures on MacOSX10.6, though. I'm surprised it didn't cause failures elsewhere.
Perhaps better to just leave out the changes regarding pointerLock for now. We really want to strive for a green try run.
I also think it is better to just leave the changes to test_NuwaProcessDeadlock.html out of this patch.
Comment 56•11 years ago
|
||
Attachment #8565587 -
Attachment is obsolete: true
Comment 57•11 years ago
|
||
Attachment #8565945 -
Attachment is obsolete: true
Comment 58•11 years ago
|
||
Comment on attachment 8565967 [details] [diff] [review]
setBool.patch
Review of attachment 8565967 [details] [diff] [review]:
-----------------------------------------------------------------
just a few small nits and questions- please address these and we can do a final push to try.
::: dom/base/test/test_child_process_shutdown_message.html
@@ +122,1 @@
> // TODO: remove in bug 820712
please indicate which preference to remove in bug 820712
::: dom/browser-element/mochitest/priority/test_Preallocated.html
@@ +64,4 @@
> }
> +// Setting this pref to true should cause us to prelaunch a process.
> +SpecialPowers.pushPrefEnv({'set':[["dom.ipc.processPrelaunch.enabled",true]]},
> + function() { addEventListener('testready', runTest); });
I think this is fine, would it make sense to reverse this and do:
addEventListener('testready', SpecialPowers.pushPrefEnv({...}, runTest));
::: dom/datastore/tests/test_readonly.html
@@ +18,5 @@
> + [{ "type": "browser", "allow": 1, "context": document },
> + { "type": "embed-apps", "allow": 1, "context": document },
> + { "type": "webapps-manage", "allow": 1, "context": document }],
> + function() { gGenerator.next() });
> + });
any reason why we couldn't do this in the other pushPrevEnv on line 105? This could be just fine.
::: dom/network/tests/test_networkstats_enabled_no_perm.html
@@ +15,5 @@
> // Test to ensure NetworkStats is enabled but mozNetworkStats.getAvailableNetworks
> // does not work in content because mozNetworkStats is null when no permission.
> + SimpleTest.waitForExplicitFinish();
> + SpecialPowers.pushPrefEnv({"set": [['dom.mozNetworkStats.enabled', true]]}, runTest);
> + function runTest(){
nit: space between runTest() and {
::: dom/network/tests/test_tcpsocket_enabled_with_perm.html
@@ +17,5 @@
> the tcp-socket permission has been granted.
> **/
> +SimpleTest.waitForExplicitFinish();
> +SpecialPowers.pushPrefEnv({"set": [['dom.mozTCPSocket.enabled', true]]}, runTest);
> +function runTest(){
nit: space between runTest() and {
::: editor/libeditor/tests/test_bug640321.html
@@ +176,5 @@
> testResizer( 0, 0, 10, 10, -10, -10);
> + }
> + SpecialPowers.pushPrefEnv({"set": [["editor.resizing.preserve_ratio", false]]}, function() {
> + runTests(false);
> + SpecialPowers.pushPrefEnv({"set": [["editor.resizing.preserve_ratio", true]]}, function() {
do we need to set this twice? I assume this is needed to toggle to value and test stuff in both modes.
::: editor/libeditor/tests/test_bug674770-2.html
@@ +50,2 @@
> SimpleTest.waitForFocus(function() {
> + SpecialPowers.pushPrefEnv({"set":[["middlemouse.contentLoadURL", false],
nit: trailing whitespace
::: toolkit/content/tests/chrome/test_preferences_beforeaccept.xul
@@ +17,4 @@
>
> // No instant-apply for this test
> + var prefWindow = openDialog("window_preferences_beforeaccept.xul", "", "", windowOnload);
> +
nit: blank line with whitespace, make it a blank line.
Comment 59•11 years ago
|
||
(In reply to Joel Maher (:jmaher) from comment #58)
> Comment on attachment 8565967 [details] [diff] [review]
> setBool.patch
>
> Review of attachment 8565967 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> just a few small nits and questions- please address these and we can do a
> final push to try.
>
> ::: dom/base/test/test_child_process_shutdown_message.html
> @@ +122,1 @@
> > // TODO: remove in bug 820712
>
> please indicate which preference to remove in bug 820712
>
> ::: dom/browser-element/mochitest/priority/test_Preallocated.html
> @@ +64,4 @@
> > }
> > +// Setting this pref to true should cause us to prelaunch a process.
> > +SpecialPowers.pushPrefEnv({'set':[["dom.ipc.processPrelaunch.enabled",true]]},
> > + function() { addEventListener('testready', runTest); });
>
> I think this is fine, would it make sense to reverse this and do:
> addEventListener('testready', SpecialPowers.pushPrefEnv({...}, runTest));
>
> ::: dom/datastore/tests/test_readonly.html
> @@ +18,5 @@
> > + [{ "type": "browser", "allow": 1, "context": document },
> > + { "type": "embed-apps", "allow": 1, "context": document },
> > + { "type": "webapps-manage", "allow": 1, "context": document }],
> > + function() { gGenerator.next() });
> > + });
>
> any reason why we couldn't do this in the other pushPrevEnv on line 105?
> This could be just fine.
>
> ::: dom/network/tests/test_networkstats_enabled_no_perm.html
> @@ +15,5 @@
> > // Test to ensure NetworkStats is enabled but mozNetworkStats.getAvailableNetworks
> > // does not work in content because mozNetworkStats is null when no permission.
> > + SimpleTest.waitForExplicitFinish();
> > + SpecialPowers.pushPrefEnv({"set": [['dom.mozNetworkStats.enabled', true]]}, runTest);
> > + function runTest(){
>
> nit: space between runTest() and {
>
> ::: dom/network/tests/test_tcpsocket_enabled_with_perm.html
> @@ +17,5 @@
> > the tcp-socket permission has been granted.
> > **/
> > +SimpleTest.waitForExplicitFinish();
> > +SpecialPowers.pushPrefEnv({"set": [['dom.mozTCPSocket.enabled', true]]}, runTest);
> > +function runTest(){
>
> nit: space between runTest() and {
>
> ::: editor/libeditor/tests/test_bug640321.html
> @@ +176,5 @@
> > testResizer( 0, 0, 10, 10, -10, -10);
> > + }
> > + SpecialPowers.pushPrefEnv({"set": [["editor.resizing.preserve_ratio", false]]}, function() {
> > + runTests(false);
> > + SpecialPowers.pushPrefEnv({"set": [["editor.resizing.preserve_ratio", true]]}, function() {
>
> do we need to set this twice? I assume this is needed to toggle to value
> and test stuff in both modes.
>
> ::: editor/libeditor/tests/test_bug674770-2.html
> @@ +50,2 @@
> > SimpleTest.waitForFocus(function() {
> > + SpecialPowers.pushPrefEnv({"set":[["middlemouse.contentLoadURL", false],
>
> nit: trailing whitespace
>
> ::: toolkit/content/tests/chrome/test_preferences_beforeaccept.xul
> @@ +17,4 @@
> >
> > // No instant-apply for this test
> > + var prefWindow = openDialog("window_preferences_beforeaccept.xul", "", "", windowOnload);
> > +
>
> nit: blank line with whitespace, make it a blank line.
regarding editor/libeditor/tests/test_bug640321.html
Yah! we have to call it twice for toggling the values
Comment 60•11 years ago
|
||
Attachment #8565967 -
Attachment is obsolete: true
Comment 61•11 years ago
|
||
Comment 62•11 years ago
|
||
Comment 63•11 years ago
|
||
the second try push is for osx 10.8
Comment 64•11 years ago
|
||
Comment on attachment 8566021 [details] [diff] [review]
setBool.patch
Review of attachment 8566021 [details] [diff] [review]:
-----------------------------------------------------------------
thanks!
Attachment #8566021 -
Flags: review+
Comment 65•11 years ago
|
||
Comment 66•11 years ago
|
||
sorry had to back this out for test failures like https://treeherder.mozilla.org/logviewer.html#?job_id=6771678&repo=mozilla-inbound
Flags: needinfo?(jmaher)
Comment 67•11 years ago
|
||
Attachment #8566021 -
Attachment is obsolete: true
| Reporter | ||
Comment 68•11 years ago
|
||
(In reply to Anish from comment #67)
> Created attachment 8566524 [details] [diff] [review]
> setBool.patch
Pushed to try for the crashtest:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=8d2e8ba0c916
Comment 69•11 years ago
|
||
Comment 71•11 years ago
|
||
| Reporter | ||
Comment 72•11 years ago
|
||
Looks like it stuck this time. Let's resolve this bug!
Thanks for you work, Kaustabh and Anish!
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
| Reporter | ||
Updated•11 years ago
|
Keywords: leave-open
| Assignee | ||
Comment 73•11 years ago
|
||
Thank you! :)
Comment 74•11 years ago
|
||
Thank you :)
| Reporter | ||
Comment 75•11 years ago
|
||
Follow-up work is now tracked in bug 1135091.
Comment 76•11 years ago
|
||
Conveniently, uplifting this to b2g37 made a ~50% B2G failure rate spike in test_after_paint_pref.html go away.
https://hg.mozilla.org/releases/mozilla-b2g37_v2_2/rev/99ccca7c1a09
https://hg.mozilla.org/releases/mozilla-b2g37_v2_2/rev/8d67a34ad0c1
status-b2g-v2.2:
--- → fixed
status-b2g-master:
--- → fixed
status-firefox37:
--- → wontfix
status-firefox38:
--- → fixed
Target Milestone: --- → mozilla38
| Reporter | ||
Comment 77•11 years ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #76)
> Conveniently, uplifting this to b2g37 made a ~50% B2G failure rate spike in
> test_after_paint_pref.html go away.
Great!
You need to log in
before you can comment on or make changes to this bug.
Description
•