Closed Bug 1605191 Opened 2 years ago Closed 1 year ago

nsIPrincipal's IDL attributes should be camel case

Categories

(Core :: DOM: Security, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox74 --- fixed
firefox75 --- fixed

People

(Reporter: MattN, Assigned: jkt)

References

(Blocks 1 open bug)

Details

(Whiteboard: [domsecurity-active])

Attachments

(3 files)

The following IDL attributes were recently added as TitleCase and don't follow the tree convention which also means that the attributes are TitleCase in JS which is very unusual. We should rename them to camelCase ASAP before it becomes too hard to change them:

  • AsciiOrigin
  • AsciiSpec
  • IsOriginPotentiallyTrustworthy
  • etc.

This doesn't require changing the C++ code as the generated headers already convert it to TitleCase but this does affect JS consumers.

When choosing method names in your interface, it's best to use the interCaps style - leading lower case, subsequent units within the identifier capitalized. This matches existing JavaScript convention and will look natural to scripters.

from https://www-archive.mozilla.org/scriptable/xpidl/idl-authors-guide/best-practices

The method name used in XPIDL will appear with the same capitalization to JavaScript, so the best practice is to match JavaScript convention by declaring attributes and method names in interCaps.

from https://www-archive.mozilla.org/scriptable/xpidl/idl-authors-guide/rules

Flags: needinfo?(sstreich)
Assignee: nobody → jkt
Status: NEW → ASSIGNED
Whiteboard: [domsecurity-active]
Priority: -- → P2

I think we should also consider preventing all of these interfaces as scriptable also as I can see the abuse in scripting happening and be harder to prevent.

Pushed by jkingston@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0ddcc1e78317
Make nsIPrincipal attributes camelcase. r=ckerschb
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74

Reopened as i mistakenly added new ones that are the wrong case 🙈 sorry about that.

Status: RESOLVED → REOPENED
Flags: needinfo?(sstreich)
Resolution: FIXED → ---

Don't we need to fix EqualsURI too?

Flags: needinfo?(sstreich)

yes. did update the patch, thanks for pointing out :)

Flags: needinfo?(sstreich)
Pushed by btara@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/198b3e4d5e99
Make new nsIPrincipal attributes camelcase. r=ckerschb
Status: REOPENED → RESOLVED
Closed: 2 years ago1 year ago
Resolution: --- → FIXED
Target Milestone: mozilla74 → mozilla75
You need to log in before you can comment on or make changes to this bug.