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

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

Closed

Conversation

@pcwalton
Copy link
Contributor

pcwalton commented Jan 13, 2016

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
Copy link

highfive commented Jan 13, 2016

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@jdm
Copy link
Member

jdm commented Jan 13, 2016

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
Copy link
Member

jdm commented Jan 13, 2016

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

@pcwalton
Copy link
Contributor Author

pcwalton commented Jan 13, 2016

Is there documentation for that?

@glennw
Copy link
Member

glennw commented Jan 13, 2016

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
Copy link
Member

glennw commented Jan 13, 2016

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
Copy link
Member

glennw commented Jan 13, 2016

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
Contributor Author

pcwalton commented Jan 14, 2016

@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 pcwalton:iframe-painting-after-navigation-redux branch from 1856960 to c951157 Jan 14, 2016
@pcwalton
Copy link
Contributor Author

pcwalton commented Jan 14, 2016

Updated per review comments.

@jdm
Copy link
Member

jdm commented Jan 14, 2016

@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
Copy link
Member

glennw commented Jan 14, 2016

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

@paulrouget
Copy link
Contributor

paulrouget commented Jan 19, 2016

Any update?

@pcwalton
Copy link
Contributor Author

pcwalton commented Jan 22, 2016

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

@pcwalton
Copy link
Contributor Author

pcwalton commented Jan 23, 2016

@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 pcwalton:iframe-painting-after-navigation-redux branch from c951157 to bf4b255 Jan 23, 2016
@pcwalton
Copy link
Contributor Author

pcwalton commented Jan 23, 2016

OK, the way I committed it seems to work.

r? @jdm

@highfive highfive assigned jdm and unassigned glennw Jan 23, 2016
@jdm
Copy link
Member

jdm commented Jan 23, 2016

@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.

@pcwalton
Copy link
Contributor Author

pcwalton commented Jan 23, 2016

@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
Copy link
Contributor Author

pcwalton commented Jan 25, 2016

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

@pcwalton pcwalton force-pushed the pcwalton:iframe-painting-after-navigation-redux branch from bf4b255 to 8d508df Jan 25, 2016
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 #8081.
@pcwalton
Copy link
Contributor Author

pcwalton commented Jan 25, 2016

@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
Copy link
Member

jdm commented Jan 25, 2016

@jdm jdm closed this Jan 25, 2016
bors-servo added 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 added 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 added 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 added 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 added 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 added 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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

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