Storage notifications routed via the constellation.#14023
Storage notifications routed via the constellation.#14023bors-servo merged 1 commit intoservo:masterfrom
Conversation
|
Heads up! This PR modifies the following files:
|
|
☔ The latest upstream changes (presumably #13646) made this pull request unmergeable. Please resolve the merge conflicts. |
a8b66da to
75867ef
Compare
| let msg = ConstellationControlMsg::DispatchStorageEvent( | ||
| pipeline.id, storage, url.clone(), key.clone(), old_value.clone(), new_value.clone() | ||
| ); | ||
| let _ = pipeline.script_chan.send(msg); |
| }; | ||
|
|
||
| for pipeline in self.pipelines.values() { | ||
| if (pipeline.id != pipeline_id) && (pipeline.url.origin() == origin) { |
There was a problem hiding this comment.
Hmm, I prefer explicit parens rather than relying on operator pecedence to resolve ambiguity.
| let origin = match Url::parse(&*url) { | ||
| Ok(url) => url.origin(), | ||
| Err(err) => return warn!("Failed to parse url {}: {:?}.", url, err), | ||
| }; |
There was a problem hiding this comment.
Why ignore failure here? Why isn't that method taking an Url directly? I see below that the String comes directly from an Url, so please just unwrap the result of Url::parse or pass an actual Url around.
Oh I see you did that in second commit. Could you squash them?
There was a problem hiding this comment.
I'll squash them before merging.
components/script/dom/storage.rs
Outdated
| DOMString::from(ev_url.to_string()), | ||
| Some(&storage) | ||
| DOMString::from(this.url), | ||
| Some(&*storage) |
There was a problem hiding this comment.
Apparently no good reason, not sure how this snuck in. Fixed.
| pub enum ScriptMsg { | ||
| /// Broadcast a storage event to every same-origin pipeline. | ||
| /// The strings are url, key, old value and new value. | ||
| BroadcastStorageEvent(PipelineId, StorageType, String, Option<String>, Option<String>, Option<String>), |
There was a problem hiding this comment.
Maybe use a struct variant instead of documenting each field in prose?
There was a problem hiding this comment.
I agree with you, but we should be consistent about it, not just adopt struct variants piecemeal.
|
GitHub somehow decided that some of my comments are outdated when they are not, please expand them when you read this @asajeffrey. |
|
We should probably hold off on merging this until #14013 has landed, c.f. https://github.com/servo/servo/pull/14013/files#diff-ab86862fdf6e275f1f412558ce78bc2aR195. |
0ee6c6d to
2711a0e
Compare
|
☔ The latest upstream changes (presumably #14013) made this pull request unmergeable. Please resolve the merge conflicts. |
2711a0e to
4c09ef4
Compare
4c09ef4 to
d8a9112
Compare
|
Squash and r=me. |
d8a9112 to
c91ef86
Compare
|
Squashed. @bors-servo r=nox |
|
📌 Commit c91ef86 has been approved by |
…=nox Storage notifications routed via the constellation. <!-- Please describe your changes on the following line: --> At the moment, storage notifications are only sent within a script thread, not to same-origin pipelines in different script threads. This PR fixes that. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #5196 - [X] These changes do not require tests because existing tests now pass <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14023) <!-- Reviewable:end -->
|
☀️ Test successful - arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-dev |
At the moment, storage notifications are only sent within a script thread, not to same-origin pipelines in different script threads. This PR fixes that.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is