Get rid of dom::bindings::global#13596
Conversation
|
Heads up! This PR modifies the following files:
|
|
For the record, when I glanced through a few of the first and last commits the other day, I was very much in favour of these changes. |
|
@jdm To be honest, I was expecting the opposite. Woooo! :D |
|
@bors-servo try |
Get rid of dom::bindings::global Globals in that PR are now represented by the fake IDL interface `GlobalScope`. <!-- 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/13596) <!-- 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 |
components/script/dom/file.rs
Outdated
| let replaced_filename = DOMString::from_string(filename.replace("/", ":")); | ||
| Ok(File::new(global, BlobImpl::new_from_bytes(bytes), replaced_filename, modified, typeString)) | ||
| Ok(File::new(global.as_global_scope(), | ||
| BlobImpl::new_from_bytes(bytes), |
| // Step 1 | ||
| match self.global() { | ||
| GlobalRoot::Window(ref window) => { | ||
| match Root::downcast::<Window>(self.global_scope()) { |
components/script/dom/globalscope.rs
Outdated
| match *self.type_id() { | ||
| // https://html.spec.whatwg.org/multipage/#script-settings-for-browsing-contexts:api-base-url | ||
| GlobalScopeTypeId::Window => { | ||
| self.downcast::<Window>().unwrap().Document().base_url() |
There was a problem hiding this comment.
I'd prefer two if lets on self.downcast::<T>().
components/script/dom/globalscope.rs
Outdated
| } | ||
| } | ||
|
|
||
| /// Extract a `Window`, causing thread failure if the global object is not |
components/script/dom/blob.rs
Outdated
| None => { | ||
| let global = self.global(); | ||
| let bytes = read_file(global.r(), f.id.clone())?; | ||
| let bytes = read_file(&self.global_scope(), f.id.clone())?; |
There was a problem hiding this comment.
Who's been putting ? in my code...
components/script/dom/globalscope.rs
Outdated
| pub fn script_chan(&self) -> Box<ScriptChan + Send> { | ||
| match *self.type_id() { | ||
| GlobalScopeTypeId::Window => { | ||
| let window = self.downcast::<Window>().unwrap(); |
components/script/dom/globalscope.rs
Outdated
| /// this of this global scope. | ||
| pub fn networking_task_source(&self) -> Box<ScriptChan + Send> { | ||
| match *self.type_id() { | ||
| GlobalScopeTypeId::Window => { |
| //! Methods that use certain WebIDL types like `any` or `object` will get a | ||
| //! `*mut JSContext` argument prepended to the argument list. Static methods | ||
| //! will be passed a [`GlobalRef`](global/enum.GlobalRef.html) for the relevant | ||
| //! will be passed a `&GlobalScope` for the relevant |
components/script/dom/window.rs
Outdated
| // https://fetch.spec.whatwg.org/#fetch-method | ||
| fn Fetch(&self, input: RequestOrUSVString, init: &RequestInit) -> Rc<Promise> { | ||
| fetch::Fetch(self.global().r(), input, init) | ||
| fetch::Fetch(&self.global_scope(), input, init) |
| // https://fetch.spec.whatwg.org/#fetch-method | ||
| fn Fetch(&self, input: RequestOrUSVString, init: &RequestInit) -> Rc<Promise> { | ||
| fetch::Fetch(self.global().r(), input, init) | ||
| fetch::Fetch(&self.global_scope(), input, init) |
|
☔ The latest upstream changes (presumably #13597) made this pull request unmergeable. Please resolve the merge conflicts. |
Inline interfaces just appear as a Rust type and in the TypeId hierarchy. They are completely invisible on the JS side.
|
@bors-servo delegate+ LGTM assuming only changes were rebasing and fixing my comments. |
|
✌️ @nox can now approve this pull request |
|
@bors-servo r=Ms2ger p=10 |
|
📌 Commit d8e92bb has been approved by |
Get rid of dom::bindings::global Globals in that PR are now represented by the fake IDL interface `GlobalScope`. <!-- 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/13596) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel-wpt |
|
|
@bors-servo retry #13360 |
|
⚡ Previous build results for arm32, arm64, linux-dev, linux-rel-css, mac-dev-unit, mac-rel-wpt1, mac-rel-wpt2, windows-dev are reusable. Rebuilding only linux-rel-wpt, mac-rel-css... |
|
☀️ 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 |
Globals in that PR are now represented by the fake IDL interface
GlobalScope.This change is