Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage notifications routed via the constellation. #14023

Merged

Conversation

@asajeffrey
Copy link
Member

asajeffrey commented Nov 2, 2016

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 -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #5196
  • These changes do not require tests because existing tests now pass

This change is Reviewable

@highfive
Copy link

highfive commented Nov 2, 2016

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/storage.rs, components/script_traits/script_msg.rs, components/script_traits/script_msg.rs, components/script/script_thread.rs, components/script_traits/lib.rs, components/script_traits/lib.rs
  • @KiChjang: components/script/dom/storage.rs, components/script_traits/script_msg.rs, components/script_traits/script_msg.rs, components/script/script_thread.rs, components/script_traits/lib.rs, components/script_traits/lib.rs
@bors-servo
Copy link
Contributor

bors-servo commented Nov 4, 2016

The latest upstream changes (presumably #13646) made this pull request unmergeable. Please resolve the merge conflicts.

@asajeffrey asajeffrey force-pushed the asajeffrey:storage-notify-via-constellation branch from a8b66da to 75867ef Nov 4, 2016
let msg = ConstellationControlMsg::DispatchStorageEvent(
pipeline.id, storage, url.clone(), key.clone(), old_value.clone(), new_value.clone()
);
let _ = pipeline.script_chan.send(msg);

This comment has been minimized.

@nox

nox Nov 7, 2016

Member

Why ignore failure here?

This comment has been minimized.

@asajeffrey

asajeffrey Nov 8, 2016

Author Member

Fixed.

};

for pipeline in self.pipelines.values() {
if (pipeline.id != pipeline_id) && (pipeline.url.origin() == origin) {

This comment has been minimized.

@nox

nox Nov 7, 2016

Member

Nit: remove parens.

This comment has been minimized.

@asajeffrey

asajeffrey Nov 8, 2016

Author Member

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),
};

This comment has been minimized.

@nox

nox Nov 7, 2016

Member

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?

This comment has been minimized.

@asajeffrey

asajeffrey Nov 8, 2016

Author Member

I'll squash them before merging.

DOMString::from(ev_url.to_string()),
Some(&storage)
DOMString::from(this.url),
Some(&*storage)

This comment has been minimized.

@nox

nox Nov 7, 2016

Member

Why the sudden *?

This comment has been minimized.

@asajeffrey

asajeffrey Nov 15, 2016

Author Member

Apparently no good reason, not sure how this snuck in. Fixed.

@@ -59,6 +60,9 @@ pub enum LogEntry {
/// Messages from the script to the constellation.
#[derive(Deserialize, Serialize)]
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>),

This comment has been minimized.

@nox

nox Nov 7, 2016

Member

Maybe use a struct variant instead of documenting each field in prose?

This comment has been minimized.

@asajeffrey

asajeffrey Nov 15, 2016

Author Member

I agree with you, but we should be consistent about it, not just adopt struct variants piecemeal.

@nox
Copy link
Member

nox commented Nov 7, 2016

GitHub somehow decided that some of my comments are outdated when they are not, please expand them when you read this @asajeffrey.

@asajeffrey
Copy link
Member Author

asajeffrey commented Nov 8, 2016

We should probably hold off on merging this until #14013 has landed, c.f. https://github.com/servo/servo/pull/14013/files#diff-ab86862fdf6e275f1f412558ce78bc2aR195.

@asajeffrey asajeffrey force-pushed the asajeffrey:storage-notify-via-constellation branch from 0ee6c6d to 2711a0e Nov 8, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Nov 8, 2016

The latest upstream changes (presumably #14013) made this pull request unmergeable. Please resolve the merge conflicts.

@asajeffrey asajeffrey force-pushed the asajeffrey:storage-notify-via-constellation branch from 2711a0e to 4c09ef4 Nov 8, 2016
@jdm jdm removed the S-needs-rebase label Nov 15, 2016
@asajeffrey asajeffrey force-pushed the asajeffrey:storage-notify-via-constellation branch from 4c09ef4 to d8a9112 Nov 15, 2016
@nox
Copy link
Member

nox commented Nov 15, 2016

Squash and r=me.

@asajeffrey asajeffrey force-pushed the asajeffrey:storage-notify-via-constellation branch from d8a9112 to c91ef86 Nov 15, 2016
@asajeffrey
Copy link
Member Author

asajeffrey commented Nov 15, 2016

Squashed. @bors-servo r=nox

@bors-servo
Copy link
Contributor

bors-servo commented Nov 15, 2016

📌 Commit c91ef86 has been approved by nox

@bors-servo
Copy link
Contributor

bors-servo commented Nov 15, 2016

Testing commit c91ef86 with merge 07b9dbe...

bors-servo added a commit that referenced this pull request Nov 15, 2016
…=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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 15, 2016

@bors-servo bors-servo merged commit c91ef86 into servo:master Nov 15, 2016
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.