Closed Bug 1319938 Opened 8 years ago Closed 8 years ago

Remove String generics uses in toolkit/components/extensions

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

(firefox53 fixed)

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

(Whiteboard: triaged)

Attachments

(1 file, 1 obsolete file)

The various String generic methods are non-standard APIs and we plan to warn when they're used (bug 1319926) and eventually want to remove them completely (bug 1222552). As a first step we need to replace all String generic uses in Firefox with the counterpart from String.prototype. In toolkit/components/extensions/Extension.jsm, String.replace needs to be replaced with a call to String.prototype.replace.
Attached patch bug1319938.patch (obsolete) (deleted) — Splinter Review
Attachment #8814232 - Flags: review?(aswan)
Comment on attachment 8814232 [details] [diff] [review] bug1319938.patch Review of attachment 8814232 [details] [diff] [review]: ----------------------------------------------------------------- I think in both of those cases we expect the first argument to already be a string. I'm not sure why the code was originally written in that way but looking forward, getting to either of those cases with something other than a string indicates a programming error somewhere else and should raise an exception. Or in other words, can you remove the explicit call to the string constructor and just invoke the methods directly?
Priority: -- → P3
Whiteboard: triaged
(In reply to Andrew Swan [:aswan] from comment #2) > Comment on attachment 8814232 [details] [diff] [review] > bug1319938.patch > > Review of attachment 8814232 [details] [diff] [review]: > ----------------------------------------------------------------- > > I think in both of those cases we expect the first argument to already be a > string. I'm not sure why the code was originally written in that way but > looking forward, getting to either of those cases with something other than > a string indicates a programming error somewhere else and should raise an > exception. Or in other words, can you remove the explicit call to the > string constructor and just invoke the methods directly? We can, yes.
Attached patch bug1319938.patch (deleted) — Splinter Review
Updated patch to remove the explicit call to `String`.
Attachment #8814232 - Attachment is obsolete: true
Attachment #8814232 - Flags: review?(aswan)
Attachment #8815480 - Flags: review?(aswan)
Attachment #8815480 - Flags: review?(aswan) → review+
Thanks for the review!
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/a42ceecb2260 Remove String generics uses in toolkit/components/extensions. r=aswan
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: