Closed Bug 1475503 Opened 6 years ago Closed 3 years ago

Stop using preprocessor in reftest.jsm

Categories

(Testing :: Reftest, enhancement)

enhancement
Not set
normal

Tracking

(firefox95 fixed)

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: marco, Assigned: ssummar, Mentored)

References

Details

(Keywords: good-first-bug)

Attachments

(4 files, 1 obsolete file)

Rebuilding just to pick up changes in reftest.jsm is painful. The preprocessor is only used in two places, perhaps we can stop using it.

> #ifdef MOZ_ENABLE_SKIA_PDF

We can move this to AppConstants.

> #ifdef XP_MACOSX
>     try {
>         var dock = Cc["@mozilla.org/widget/macdocksupport;1"].getService(Ci.nsIMacDockSupport);
>         dock.activateApplication(true);
>     } catch(ex) {
>     }
> #endif

We don't need this, since we're eating the exception anyways.
+1

Though fyi you can run |./mach build layout/tools/reftest| (which takes ~2 seconds) in case you weren't already.
Mentor: mcastelluccio
Keywords: good-first-bug
willing to take this on if you can give me a little more context
Flags: needinfo?(mcastelluccio)
(In reply to nikshepsvn from comment #2)
> willing to take this on if you can give me a little more context

Sure, thanks!

In layout/tools/reftest/reftest.jsm, you have to remove the preprocessor usages (the ones I outlined in comment 0).
To remove the first, you'll need to create a new MOZ_ENABLE_SKIA_PDF key in toolkit/modules/AppConstants.jsm (look at the file for other similar examples).
The second preprocessor usage can simply be completely removed, as we have a try catch anyway, it means we won't do anything on Mac anyway.

Once you're done with these two changes, you can remove the "*" before reftest.jsm in layout/tools/reftest/jar.mn, which means the preprocessor won't be used anymore for this file.

Then, you can do the same treatment for layout/tools/reftest/manifest.jsm.

Before and after every step, make sure you can still run a reftest. E.g. `./mach test accessible/tests/crashtests/471493.xul`.

I'm going to be on PTO from tomorrow, so you can ask :ahal for review.
Flags: needinfo?(mcastelluccio)
I would like to work on this issue but can i do this on Ubuntu? 

As I have searched for #ifdef XP_MACOSX preprocessor in AppConstants.jsm file but didn't find that is this because I am on Ubuntu?
Oh, I got that method in reftest.jsm file. Can I start working on it now?
Hey I'm currently working on this and almost done. I
But my patch is ready and i am about to submit
Attached patch tip.patchSplinter Review
Changes made and submitted the patch file
Attachment #8999326 - Flags: review?(ahal)
Comment on attachment 8999326 [details] [diff] [review]
tip.patch

Apologies for the confusion here. Nikshepsvn asked first and was in the middle of working on this, so they have priority. Nikshepsvn, can you confirm that you are still planning to submit a patch?

Sahil, if I don't hear back from nikshepsvn by the start of next week I'll assign the bug to you. Though fyi this patch doesn't apply cleanly and we don't want to completely remove the call to `doc.activateApplication`.
Flags: needinfo?(nikshepsvn)
Attachment #8999326 - Flags: review?(ahal) → review-
Apologies for the confusion here, we should have set an assignee quicker. Nikshepsvn asked first and was in the middle of working on this, so he gets priority. Nikshepsvn, can you confirm that you are still planning to submit a patch?

Sahil, if I don't hear back from nikshepsvn by the end of the week I'll assign the bug to you and review your patch.
Assignee: nobody → nikshepsvn
Status: NEW → ASSIGNED
Hey Andrew,

How's it going! Thank you for reacognizing that I started working on this, I really appreciate it. I've mostly finished the patch but I'm outside right now so I'll test and upload it as soon as I get back home. Thanks again!
Flags: needinfo?(nikshepsvn)
(In reply to Andrew Halberstadt [:ahal] from comment #10)
> Apologies for the confusion here, we should have set an assignee quicker.
> Nikshepsvn asked first and was in the middle of working on this, so he gets
> priority. Nikshepsvn, can you confirm that you are still planning to submit
> a patch?
> 
> Sahil, if I don't hear back from nikshepsvn by the end of the week I'll
> assign the bug to you and review your patch.

Ok Andrew and sorry nikshepsvn for submitting the patch before you.
I started working on patch without getting the confirmation from the mentor and submitted the patch.

I apologise for that.
(In reply to nikshepsvn from comment #11)
> Hey Andrew,
> 
> How's it going! Thank you for reacognizing that I started working on this, I
> really appreciate it. I've mostly finished the patch but I'm outside right
> now so I'll test and upload it as soon as I get back home. Thanks again!

nikshepsvn are you still working on this or should Sahil take over?
forgive me for the delay, will upload it today by 11:00PM EST. thanks for the patience btw
Attached patch fix.patchSplinter Review
Attachment #9002992 - Flags: review?(mcastelluccio)
just submitted the patch @marco, testing is buggy for my locally, but is this what you're expecting? 
when i try testing locally I get this message ` know you are trying to run a crashtest test. Unfortunately, I can't run those`
Flags: needinfo?(mcastelluccio)
You can use `./mach crashtest XXX` instead of `./mach test XXX`.
Flags: needinfo?(mcastelluccio)
Comment on attachment 9002992 [details] [diff] [review]
fix.patch

Review of attachment 9002992 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/tools/reftest/manifest.jsm
@@ -464,1 @@
>          sandbox.AndroidVersion = sysInfo.getPropertyAsInt32("version");

The same applies to this file.

::: layout/tools/reftest/reftest.jsm
@@ -267,4 @@
>          g.compareRetainedDisplayLists = prefs.getBoolPref("reftest.compareRetainedDisplayLists");
>      } catch (e) {}
>  
> -#ifdef MOZ_ENABLE_SKIA_PDF

We don't want to remove the code altogether, we want to just stop using the preprocessor (#ifdef).
Since we create a MOZ_ENABLE_SKIA_PDF variable in AppConstants.jsm, you can use that one here with a normal if.

@@ -580,4 @@
>  {
>      var fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
>      fm.focusedWindow = g.containingWindow;
> -#ifdef XP_MACOSX

Here we won't need to use AppConstants, we can just always run the code since the catch is not doing anything and the try block doesn't have any effect on non macOS platforms.

::: toolkit/modules/AppConstants.jsm
@@ +340,5 @@
>  #else
>      false,
>  #endif
> +
> +  MOZ_ENABLE_SKIA_PDF:

In this file (AppConstants.jsm), which is still preprocessed, we only want to define these variables, so we can use them in reftest.jsm and manifest.jsm.
Moving the entire code from reftest.jsm and manifest.jsm here won't work.
Attachment #9002992 - Flags: review?(mcastelluccio) → review-

Can I work on this??

Sure, looks like the other contributor hasn't responded to the review feedback. Feel free to ask for help if you get stuck. Thanks!

Assignee: nikshepsvn → sahilbhosale63
Attachment #9117230 - Attachment is obsolete: true

This good-first-bug hasn't had any activity for 6 months, it is automatically unassigned.
For more information, please visit auto_nag documentation.

Assignee: sahilbhosale63 → nobody
Status: ASSIGNED → NEW

Hi @marco, is this bug still open and if so, can I submit a patch?

Hello Sanket, sure, feel free to work on it!

Hello, I am an outreachy applicant and want to work on this. Can you please assign this to me? Thanks.

Flags: needinfo?(mcastelluccio)

Hello Shazib, feel free to work on this bug. Bugs are assigned when there is a patch to fix them.

Flags: needinfo?(mcastelluccio)
Assignee: nobody → ssummar.bee16seecs
Status: NEW → ASSIGNED

Hi again, I submitted a patch. Hopefully I didnt miss anything. Please feel free to comment on it.

Attachment #9245746 - Attachment description: Bug 1475503 - Removed preprocesser use in reftest.jsm. r=marco → Bug 1475503 - Removed preprocessor use in reftest.jsm. r=marco
See Also: → 1735814
Pushed by mcastelluccio@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/50ba34a0c174
Removed preprocessor use in reftest.jsm. r=marco DONTBUILD
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: