Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement browsing context discarding #14559
Conversation
highfive
commented
Dec 12, 2016
|
Heads up! This PR modifies the following files:
|
|
This should help with the crash we were seeing in #13996 (comment) (though that crash has mysteriously disappeared). cc @Ms2ger @jdm |
|
Also see #14434 |
|
|
9d314d3
to
7f5f9d6
|
|
7f5f9d6
to
8be8c54
|
|
8be8c54
to
c4d1813
|
Rebased. r? @ConnorGBrewster |
|
Looks good! Although it looks like removing the reference to the active document in the browsing context caused a couple of regressions. I think we should find a way to fix those before merging. Also since the BS doesn't store the active document, we will need to find a way to determine if the document is |
| @@ -3190,8 +3187,8 @@ impl DocumentMethods for Document { | |||
|
|
|||
| // Step 2. | |||
| // TODO: handle throw-on-dynamic-markup-insertion counter. | |||
|
|
|||
| if !self.is_active() { | |||
| // FIXME: this should check for being active rather than fully active | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Dec 23, 2016
Author
Member
The problem is that we're currently not sending enough information from the constellation to the script thread to determine if a document is active. We're sending freeze/thaw messages to determine if a document is fully active, but not any messages about being active. I think this is a spec issue, the spec should really say "fully active" here.
| @@ -2304,7 +2295,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> | |||
| } | |||
| } | |||
| for entry in evicted_pipelines { | |||
| self.close_pipeline(entry.pipeline_id, ExitPipelineMode::Normal); | |||
| self.close_pipeline(entry.pipeline_id, DiscardBrowsingContext::No, ExitPipelineMode::Normal); | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Dec 23, 2016
Author
Member
This code is used when a browsing context navigates, we don't want to close the BC in this case. Nested BCs will get closed, when the recursive call is made it's with DiscardBrowsingContext::Yes.
| } | ||
|
|
||
| pub fn active_document(&self) -> Root<Document> { |
This comment has been minimized.
This comment has been minimized.
cbrewster
Dec 23, 2016
Member
What are the reasons behind not storing a reference to the Document in the BC?
This comment has been minimized.
This comment has been minimized.
asajeffrey
Dec 23, 2016
Author
Member
We never needed it, so I removed it! SpiderMonkey does the dance to resolve WindowProxy to Window, which tracks the current document.
| } | ||
| // TODO Step 3. |
This comment has been minimized.
This comment has been minimized.
cbrewster
Dec 23, 2016
Member
I think we should find a way to do this, and other cases that may have regressed with this PR before merging.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Dec 23, 2016
Author
Member
I think it's broken in the same way as it was before. Did this cause a regression?
| @@ -1345,6 +1357,13 @@ impl Window { | |||
| unsafe { SetWindowProxy(cx, window, browsing_context.reflector().get_jsobject()); } | |||
| } | |||
|
|
|||
| #[allow(unsafe_code)] | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -183,6 +183,15 @@ pub struct NewLayoutInfo { | |||
| pub layout_threads: usize, | |||
| } | |||
|
|
|||
| /// When a pipeline is closed, should its browsing context be discarded too? | |||
This comment has been minimized.
This comment has been minimized.
cbrewster
Dec 23, 2016
Member
Maybe add a spec link here that discussing when to discard browsing contexts?
|
|
e3788d8
to
7c2de62
|
Rebased. |
|
@bors-servo try |
…ding, r=<try> Implement browsing context discarding <!-- Please describe your changes on the following line: --> Implement browsing context discarding (https://html.spec.whatwg.org/multipage/browsers.html#discard-a-document). * When a pipeline is closed, inform the script thread whether the browsing context is to be discarded. * In script threads, synchronously discard any similar-origin documents and browsing contexts. * When a browsing context is discarded, it loses the reference to the active document, but the window keeps it, so we need to move the `Document` pointer from `BrowsingContext` to `Window`. * Fix the webIDL for Window to make parent and top optional (the spec says they can return null when the browsing context is discarded). --- <!-- 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 #14411 - [X] There are tests for these changes <!-- 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/14559) <!-- Reviewable:end -->
|
|
|
@bors-servo: retry |
…ding, r=<try> Implement browsing context discarding <!-- Please describe your changes on the following line: --> Implement browsing context discarding (https://html.spec.whatwg.org/multipage/browsers.html#discard-a-document). * When a pipeline is closed, inform the script thread whether the browsing context is to be discarded. * In script threads, synchronously discard any similar-origin documents and browsing contexts. * When a browsing context is discarded, it loses the reference to the active document, but the window keeps it, so we need to move the `Document` pointer from `BrowsingContext` to `Window`. * Fix the webIDL for Window to make parent and top optional (the spec says they can return null when the browsing context is discarded). --- <!-- 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 #14411 - [X] There are tests for these changes <!-- 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/14559) <!-- Reviewable:end -->
|
|
|
@bors-servo r+ retry |
|
|
…ding, r=cbrewster Implement browsing context discarding <!-- Please describe your changes on the following line: --> Implement browsing context discarding (https://html.spec.whatwg.org/multipage/browsers.html#discard-a-document). * When a pipeline is closed, inform the script thread whether the browsing context is to be discarded. * In script threads, synchronously discard any similar-origin documents and browsing contexts. * When a browsing context is discarded, it loses the reference to the active document, but the window keeps it, so we need to move the `Document` pointer from `BrowsingContext` to `Window`. * Fix the webIDL for Window to make parent and top optional (the spec says they can return null when the browsing context is discarded). --- <!-- 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 #14411 - [X] There are tests for these changes <!-- 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/14559) <!-- Reviewable:end -->
|
|
asajeffrey commentedDec 12, 2016
•
edited by larsbergstrom
Implement browsing context discarding (https://html.spec.whatwg.org/multipage/browsers.html#discard-a-document).
Documentpointer fromBrowsingContexttoWindow../mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is