Implement the entry global. #14840

Merged
merged 1 commit into from Jan 6, 2017

Projects

None yet

5 participants

@Ms2ger
Contributor
Ms2ger commented Jan 4, 2017 edited

Partial fix for #10963.


This change is Reviewable

@mbrubeck mbrubeck was assigned by highfive Jan 4, 2017
@highfive
highfive commented Jan 4, 2017

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/testbinding.rs, components/script/dom/bindings/mod.rs, components/script/dom/globalscope.rs, components/script/dom/bindings/callback.rs, components/script/dom/bindings/settings_stack.rs, components/script/dom/dedicatedworkerglobalscope.rs, components/script/dom/webidls/TestBinding.webidl, components/script/script_runtime.rs, components/script/dom/serviceworkerglobalscope.rs, components/script/timers.rs
  • @kichjang: components/script/dom/testbinding.rs, components/script/dom/bindings/mod.rs, components/script/dom/globalscope.rs, components/script/dom/bindings/callback.rs, components/script/dom/bindings/settings_stack.rs, components/script/dom/dedicatedworkerglobalscope.rs, components/script/dom/webidls/TestBinding.webidl, components/script/script_runtime.rs, components/script/dom/serviceworkerglobalscope.rs, components/script/timers.rs
@highfive
highfive commented Jan 4, 2017

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@Ms2ger
Contributor
Ms2ger commented Jan 5, 2017

r? @nox

@highfive highfive assigned nox and unassigned mbrubeck Jan 5, 2017
@nox

The code looks ok but I have many questions.

components/script/dom/globalscope.rs
+ /// Returns the global scope from a JS global object.
+ #[allow(unsafe_code)]
+ pub unsafe fn from_global(global: *mut JSObject) -> Root<Self> {
+ global_scope_from_global(global)
@nox
nox Jan 5, 2017 Member

Could you inline global_scope_from_global here and remove it?

+ fn drop(&mut self) {
+ let entry = STACK.with(|stack| {
+ let mut stack = stack.borrow_mut();
+ stack.pop().unwrap()
@nox
nox Jan 5, 2017 Member

AutoEntryScript can move so these can be dropped out of order, I'm pretty sure that's not intended. Seems like we want something similar to rooted!, which would make the whole TLS stack useless AFAICT?

+/// Returns the ["entry"] global object.
+///
+/// ["entry"]: https://html.spec.whatwg.org/multipage/#entry
+pub fn entry_global() -> Root<GlobalScope> {
@nox
nox Jan 5, 2017 Member

Nit: could you make that a static method on AutoEntryScript? Less things to import that way.

@@ -231,6 +232,7 @@ impl DedicatedWorkerGlobalScope {
{
let _ar = AutoWorkerReset::new(&global, worker);
+ let _aes = AutoEntryScript::new(global.upcast());
@nox
nox Jan 5, 2017 Member

Instead of manual RAII, can't we just call that in execute_script? Seems like just before it is the only call site you changed, no?

@Ms2ger
Contributor
Ms2ger commented Jan 5, 2017

This is good to go as far as I'm concerned.

CC @jdm

@Ms2ger
Contributor
Ms2ger commented Jan 6, 2017

@bors-servo r=nox

@bors-servo
Contributor

📌 Commit 0890a6e has been approved by nox

@bors-servo
Contributor

⌛️ Testing commit 0890a6e with merge 553735a...

@bors-servo bors-servo added a commit that referenced this pull request Jan 6, 2017
@bors-servo bors-servo Auto merge of #14840 - servo:entry-global, r=nox
Implement the entry global.

Partial fix for #10963.

<!-- 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/14840)
<!-- Reviewable:end -->
553735a
@bors-servo
Contributor

💔 Test failed - linux-dev

@Ms2ger Ms2ger Implement the entry global.
Partial fix for #10963.
cb47a7e
@Ms2ger
Contributor
Ms2ger commented Jan 6, 2017

@bors-servo r=nox

@bors-servo
Contributor

📌 Commit cb47a7e has been approved by nox

@bors-servo
Contributor

⌛️ Testing commit cb47a7e with merge 85d3bbd...

@bors-servo bors-servo added a commit that referenced this pull request Jan 6, 2017
@bors-servo bors-servo Auto merge of #14840 - servo:entry-global, r=nox
Implement the entry global.

Partial fix for #10963.

<!-- 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/14840)
<!-- Reviewable:end -->
85d3bbd
@bors-servo bors-servo merged commit cb47a7e into master Jan 6, 2017

3 of 4 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
dependency-ci Dependencies checked
Details
homu Test successful
Details
@bors-servo bors-servo referenced this pull request Jan 6, 2017
Closed

Added current_line variable to track current line #14661

1 of 5 tasks complete
@Ms2ger Ms2ger deleted the entry-global branch Jan 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment