Closed Bug 1415205 Opened 7 years ago Closed 7 years ago

Add add mutate() to nsIURI

Categories

(Core :: Networking, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: valentin, Assigned: valentin)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(2 files)

Part of making nsIURI implementations immutable, we need to remove the setters. To achieve this, we will first add nsIURI.mutate() that returns a mutator. The mutator will have all the appropriate setters (while not implementing nsIURI, to prevent it from being passed to others). Calling finalize() on the mutator will return a new (immutable) nsIURI. After this pattern is adopted we can remove the setters from nsIURI (separate bug)
Comment on attachment 8929418 [details] Bug 1415205 - Add nsIURIMutator impls for all objects implementing nsIURI https://reviewboard.mozilla.org/r/200746/#review205960 C/C++ static analysis found 1 defect in this patch. You can run this analysis locally with: `./mach static-analysis check path/to/file.cpp` ::: ipc/glue/URIUtils.cpp:128 (Diff revision 1) > MOZ_ASSERT(false, "Deserialize failed!"); > return nullptr; > } > > - nsCOMPtr<nsIURI> uri = do_QueryInterface(serializable); > + nsCOMPtr<nsIURI> uri; > + rv = mutator->Finalize(getter_AddRefs(uri)); Warning: Value stored to 'rv' is never read [clang-tidy: clang-analyzer-deadcode.DeadStores]
Comment on attachment 8929417 [details] Bug 1415205 - Add nsIURIMutator interface and nsIURI.mutate() https://reviewboard.mozilla.org/r/200744/#review206016
Attachment #8929417 - Flags: review?(daniel) → review+
Comment on attachment 8929418 [details] Bug 1415205 - Add nsIURIMutator impls for all objects implementing nsIURI https://reviewboard.mozilla.org/r/200746/#review206332 LGTM! ::: ipc/glue/URIUtils.cpp:128 (Diff revision 1) > MOZ_ASSERT(false, "Deserialize failed!"); > return nullptr; > } > > - nsCOMPtr<nsIURI> uri = do_QueryInterface(serializable); > + nsCOMPtr<nsIURI> uri; > + rv = mutator->Finalize(getter_AddRefs(uri)); clang warns about this 'rv' is not used!
Attachment #8929418 - Flags: review?(daniel) → review+
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/a6339ec0511b Add nsIURIMutator interface and nsIURI.mutate() r=bagder https://hg.mozilla.org/integration/autoland/rev/306f999b79a5 Add nsIURIMutator impls for all objects implementing nsIURI r=bagder
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: