Closed Bug 1748874 Opened 4 months ago Closed 4 months ago

Require MOZ_CAN_RUN_SCRIPT to go to declarations

Categories

(Firefox Build System :: Source Code Analysis, defect)

defect

Tracking

(firefox97 wontfix, firefox98 fixed)

RESOLVED FIXED
98 Branch
Tracking Status
firefox97 --- wontfix
firefox98 --- fixed

People

(Reporter: saschanaz, Assigned: saschanaz)

References

Details

Attachments

(5 files)

For example, https://phabricator.services.mozilla.com/D135160?id=525055 put it all to .cpp and it seems nothing warns about it.

to be clear, you would like a linter doing some kind of

if grep -q MOZ_CAN_RUN_SCRIPT *.cpp; then
   echo "please move MOZ_CAN_RUN_SCRIPT into the header files" 
   exit 1
fi

?

It's a little bit complex than that, the thumb rule is that the declaration should get it, not the definition. That means there's no problem if the definition itself is a declaration.

// No problem, everything is good
MOZ_CAN_RUN_SCRIPT static void foo();

static void bar() { // MOZ_CAN_RUN_SCRIPT error as expected
  foo();
}
static void foo();

static void bar() {
  foo(); // !! bar() doesn't know foo is MOZ_CAN_RUN_SCRIPT
}

MOZ_CAN_RUN_SCRIPT foo() {};
Summary: Require MOZ_CAN_RUN_SCRIPT to go to headers whenever possible → Require MOZ_CAN_RUN_SCRIPT to go to declarations
Assignee: nobody → krosylight
Pushed by krosylight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/12073baa49f0
Part 4: Move MOZ_CAN_RUN_SCRIPT to declarations in dom/streams r=mgaudet
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch

(There are other patches)

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Pushed by krosylight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/018d59d42d1d
Part 1: Mark the decl of HTMLCanvasElement::CallPrintCallback as CAN_RUN_SCRIPT r=masayuki
https://hg.mozilla.org/integration/autoland/rev/eb8e0e968c3b
Part 2: Mark SessionStoreUtils method decls as CAN_RUN_SCRIPT r=masayuki
https://hg.mozilla.org/integration/autoland/rev/69cf4aea9436
Part 3: Mark the decl of SessionStoreRestoreData::RestoreInto as CAN_RUN_SCRIPT r=masayuki
https://hg.mozilla.org/integration/autoland/rev/418b53fbd23d
Part 5: Require CAN_RUN_SCRIPT to be at the first declaration r=andi
Target Milestone: 97 Branch → 98 Branch
You need to log in before you can comment on or make changes to this bug.