Skip to content

compositing: Fix a couple of bugs that prevented iframes from painting after navigation. - #9285

Closed
pcwalton wants to merge 1 commit into
servo:masterfrom
pcwalton:iframe-painting-after-navigation-redux
Closed

pcwalton wants to merge 1 commit into
servo:masterfrom
pcwalton:iframe-painting-after-navigation-redux

Conversation

@pcwalton

Copy link
Copy Markdown
Contributor

The first bug was that iframes were not reflowed in their parent DOM when the child page navigated. This is fixed by simply having the constellation notify the appropriate script thread when navigation occurs.

The second bug was that the compositor was unable to adjust the pipeline for existing iframe layers, only new ones. This patch adds logic to do that.

Closes #8081.

r? @jdm
cc @metajack

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 13, 2016
@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!

@jdm

jdm commented Jan 13, 2016

Copy link
Copy Markdown
Member

The script and constellation changes look fine to me (thanks!), but the compositor changes are outside the area of my expertise. r? @glennw for that.

@jdm

jdm commented Jan 13, 2016

Copy link
Copy Markdown
Member

@pcwalton Can we test this using a reftest with reftest-wait and an iframe onload handler?

@pcwalton

Copy link
Copy Markdown
Contributor Author

Is there documentation for that?

@glennw

glennw commented Jan 13, 2016

Copy link
Copy Markdown
Member

This is what I based the reftest-wait implementation on - http://testthewebforward.org/docs/reftests.html. There should be a few examples in our wpt/mozilla tests that make use of it.

@glennw

glennw commented Jan 13, 2016

Copy link
Copy Markdown
Member

Reviewed 1 of 6 files at r1.
Review status: 1 of 6 files reviewed at latest revision, 1 unresolved discussion.


components/compositing/compositor.rs, line 797 [r1] (raw file):
Can this create extra root layers for a subpage in the case of an update on a layer reisize (for example)?


Comments from the review on Reviewable.io

@glennw

glennw commented Jan 13, 2016

Copy link
Copy Markdown
Member

Reviewed 1 of 6 files at r1.
Review status: 2 of 6 files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@pcwalton

Copy link
Copy Markdown
Contributor Author

@jdm I don't know how to write the reftest in a way that works around Servo's bugs with the same origin policy. Here's my attempt:

<!DOCTYPE html>
<html class="reftest-wait">
<body>
<iframe src="../bogus"></iframe>
<script>
setTimeout(function() {
    var iframe = document.getElementsByTagName('iframe')[0];
    ...
    iframe.contentDocument.location.href = "data:text/html,Hello%20world";
    ...
}, 16);
</script>
</body>
</html>

contentDocument is sometimes null because if the 404 page successfully loads it's no longer same origin. If instead of ../bogus, a file:/about:/data: URL are used, the same origin policy always prevents me from accessing contentDocument. Likewise if no src attribute is specified at all. This works in other browsers.

@pcwalton
pcwalton force-pushed the iframe-painting-after-navigation-redux branch from 1856960 to c951157 Compare January 14, 2016 01:34
@pcwalton

Copy link
Copy Markdown
Contributor Author

Updated per review comments.

@jdm

jdm commented Jan 14, 2016

Copy link
Copy Markdown
Member

@pcwalton I was going to say that I don't understand the limitations here, but I realized that maybe you ran into #7826? Otherwise, did you try setting the src attribute instead of using iframe.contentDocument.location?

@glennw

glennw commented Jan 14, 2016

Copy link
Copy Markdown
Member

The compositor code looks good to me once the test issue from @jdm is resolved.

@paulrouget

Copy link
Copy Markdown
Contributor

Any update?

@pcwalton

Copy link
Copy Markdown
Contributor Author

I still have yet to write the test that was requested.

@pcwalton

Copy link
Copy Markdown
Contributor Author

@jdm I can navigate the iframe using iframe.src = ..., but the same origin policy prevents me from calling iframe.contentDocument.addEventListener('load', ...), without which I don't know when to remove the reftest-wait class. So I'm stuck.

@pcwalton
pcwalton force-pushed the iframe-painting-after-navigation-redux branch from c951157 to bf4b255 Compare January 23, 2016 02:35
@pcwalton

Copy link
Copy Markdown
Contributor Author

OK, the way I committed it seems to work.

r? @jdm

@highfive highfive assigned jdm and unassigned glennw Jan 23, 2016
@jdm

jdm commented Jan 23, 2016

Copy link
Copy Markdown
Member

@pcwalton I meant adding a load listener on the iframe element, not on the framed document. That would work much more reliably than the current setup.

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 23, 2016
@pcwalton

Copy link
Copy Markdown
Contributor Author

@jdm I tried that. The load event doesn't fire, even when it's placed on the iframe element. I think data URLs may be messing it up.

@pcwalton pcwalton added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Jan 23, 2016
@pcwalton

Copy link
Copy Markdown
Contributor Author

It also didn't fire with file URLs, BTW.

@pcwalton
pcwalton force-pushed the iframe-painting-after-navigation-redux branch from bf4b255 to 8d508df Compare January 25, 2016 19:12
after navigation.

The first bug was that iframes were not reflowed in their parent DOM
when the child page navigated. This is fixed by simply having the
constellation notify the appropriate script thread when navigation
occurs.

The second bug was that the compositor was unable to adjust the pipeline
for existing iframe layers, only new ones. This patch adds logic to do
that.

Closes servo#8081.
@pcwalton

Copy link
Copy Markdown
Contributor Author

@jdm So the test case in the updated patch times out as written. If you uncomment the console.log lines, the test does not time out (!) and they successfully write to the output. I'm at a loss here.

@jdm

jdm commented Jan 25, 2016

Copy link
Copy Markdown
Member

#9421.

@jdm jdm closed this Jan 25, 2016
bors-servo pushed a commit that referenced this pull request Jan 25, 2016
…cwalton

compositing: Fix a couple of bugs that prevented iframes from painting after navigation.

The first bug was that iframes were not reflowed in their parent DOM when the child page navigated. This is fixed by simply having the constellation notify the appropriate script thread when navigation occurs.

The second bug was that the compositor was unable to adjust the pipeline for existing iframe layers, only new ones. This patch adds logic to do that.

The third bug was that we have ad-hoc reflow calls throughout script/, and we didn't trigger any reflow from the code that dispatches the `load` event for the iframe so the test for the first two issues would always time out. The second commit adds another reflow call to do that, and also bites the bullet and adds a catch-all reflow (which does nothing if there's no dirty nodes in the document) at the return to the event loop.

Closes #8081.

Extension of #9285.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9421)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Jan 25, 2016
compositing: Fix a couple of bugs that prevented iframes from painting after navigation.

The first bug was that iframes were not reflowed in their parent DOM when the child page navigated. This is fixed by simply having the constellation notify the appropriate script thread when navigation occurs.

The second bug was that the compositor was unable to adjust the pipeline for existing iframe layers, only new ones. This patch adds logic to do that.

The third bug was that we have ad-hoc reflow calls throughout script/, and we didn't trigger any reflow from the code that dispatches the `load` event for the iframe so the test for the first two issues would always time out. The second commit adds another reflow call to do that, and also bites the bullet and adds a catch-all reflow (which does nothing if there's no dirty nodes in the document) at the return to the event loop.

Closes #8081.

Extension of #9285.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9421)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Jan 25, 2016
compositing: Fix a couple of bugs that prevented iframes from painting after navigation.

The first bug was that iframes were not reflowed in their parent DOM when the child page navigated. This is fixed by simply having the constellation notify the appropriate script thread when navigation occurs.

The second bug was that the compositor was unable to adjust the pipeline for existing iframe layers, only new ones. This patch adds logic to do that.

The third bug was that we have ad-hoc reflow calls throughout script/, and we didn't trigger any reflow from the code that dispatches the `load` event for the iframe so the test for the first two issues would always time out. The second commit adds another reflow call to do that, and also bites the bullet and adds a catch-all reflow (which does nothing if there's no dirty nodes in the document) at the return to the event loop.

Closes #8081.

Extension of #9285.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9421)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Jan 26, 2016
compositing: Fix a couple of bugs that prevented iframes from painting after navigation.

The first bug was that iframes were not reflowed in their parent DOM when the child page navigated. This is fixed by simply having the constellation notify the appropriate script thread when navigation occurs.

The second bug was that the compositor was unable to adjust the pipeline for existing iframe layers, only new ones. This patch adds logic to do that.

The third bug was that we have ad-hoc reflow calls throughout script/, and we didn't trigger any reflow from the code that dispatches the `load` event for the iframe so the test for the first two issues would always time out. The second commit adds another reflow call to do that, and also bites the bullet and adds a catch-all reflow (which does nothing if there's no dirty nodes in the document) at the return to the event loop.

Closes #8081.

Extension of #9285.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9421)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Jan 26, 2016
compositing: Fix a couple of bugs that prevented iframes from painting after navigation.

The first bug was that iframes were not reflowed in their parent DOM when the child page navigated. This is fixed by simply having the constellation notify the appropriate script thread when navigation occurs.

The second bug was that the compositor was unable to adjust the pipeline for existing iframe layers, only new ones. This patch adds logic to do that.

The third bug was that we have ad-hoc reflow calls throughout script/, and we didn't trigger any reflow from the code that dispatches the `load` event for the iframe so the test for the first two issues would always time out. The second commit adds another reflow call to do that, and also bites the bullet and adds a catch-all reflow (which does nothing if there's no dirty nodes in the document) at the return to the event loop.

Closes #8081.

Extension of #9285.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9421)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Jan 27, 2016
compositing: Fix a couple of bugs that prevented iframes from painting after navigation.

The first bug was that iframes were not reflowed in their parent DOM when the child page navigated. This is fixed by simply having the constellation notify the appropriate script thread when navigation occurs.

The second bug was that the compositor was unable to adjust the pipeline for existing iframe layers, only new ones. This patch adds logic to do that.

The third bug was that we have ad-hoc reflow calls throughout script/, and we didn't trigger any reflow from the code that dispatches the `load` event for the iframe so the test for the first two issues would always time out. The second commit adds another reflow call to do that, and also bites the bullet and adds a catch-all reflow (which does nothing if there's no dirty nodes in the document) at the return to the event loop.

Closes #8081.

Extension of #9285.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9421)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iframe not painted anymore after navigation (regression c72d0c2)

5 participants