Add add mutate() to nsIURI

RESOLVED FIXED in Firefox 59

Status

()

enhancement
P2
normal
RESOLVED FIXED
2 years ago
a year ago

People

(Reporter: valentin, Assigned: valentin)

Tracking

(Blocks 1 bug)

Trunk
mozilla59
Points:
---

Firefox Tracking Flags

(firefox59 fixed)

Details

(Whiteboard: [necko-triaged])

Attachments

(2 attachments)

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 hidden (mozreview-request)
Comment hidden (mozreview-request)

Comment 3

a year ago
mozreview-review
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 4

a year ago
mozreview-review
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 5

a year ago
mozreview-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+
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)

Comment 8

a year ago
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

Comment 9

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/a6339ec0511b
https://hg.mozilla.org/mozilla-central/rev/306f999b79a5
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.