Change nsIXPCScriptable::className and nsIClassInfo::{contractID,classDescription} from string to AUTF8String

RESOLVED FIXED in Firefox 58

Status

()

enhancement
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: njn, Assigned: njn)

Tracking

unspecified
mozilla58
Points:
---

Firefox Tracking Flags

(firefox58 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

This lets us replace moz_xstrdup() of string literals with AssignLiteral(),
among other improvements.

The use of nullptr is replaced with empty strings. This should be fine on the
JavaScript side because `null` and "" are both falsy.
This lets us replace moz_xstrdup() of string literals with AssignLiteral(),
among other improvements.
Attachment #8919554 - Flags: review?(nfroyd)
Attachment #8919552 - Attachment is obsolete: true
Comment on attachment 8919554 [details] [diff] [review]
Change nsIXPCScriptable::className and nsIClassInfo::{contractID,classDescription} from string to AUTF8String

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

Yay.

::: caps/nsScriptSecurityManager.cpp
@@ +160,5 @@
>  }
>  
>  // Helper class to get stuff from the ClassInfo and not waste extra time with
>  // virtual method calls for things it has already gotten
>  class ClassInfoData

This class seems like a vestige of some bygone era, where it used to do a lot more, but now it seems to just be adding unnecessary complexity.  We instantiate it in one place, AFAICT, in CanCreateWrapper, and we never use the caching the class provides, since we only call the relevant methods once.

Maybe we should remove it in a followup?
Attachment #8919554 - Flags: review?(nfroyd) → review+
Pushed by nnethercote@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c2d3e50e7a8e
Change nsIXPCScriptable::className and nsIClassInfo::{contractID,classDescription} from string to AUTF8String. r=froydnj.
https://hg.mozilla.org/integration/mozilla-inbound/rev/c2d3e50e7a8ecc231b8d9c0b9ef1c436a1bb6e2e
Bug 1409598 - Change nsIXPCScriptable::className and nsIClassInfo::{contractID,classDescription} from string to AUTF8String. r=froydnj.
https://hg.mozilla.org/mozilla-central/rev/c2d3e50e7a8e
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
> This class seems like a vestige of some bygone era, where it used to do a
> lot more, but now it seems to just be adding unnecessary complexity.  We
> instantiate it in one place, AFAICT, in CanCreateWrapper, and we never use
> the caching the class provides, since we only call the relevant methods once.
> 
> Maybe we should remove it in a followup?

I did this in bug 1409960.
You need to log in before you can comment on or make changes to this bug.