Skip to content

script: Make iframes know their pipeline IDs at all times, even after navigation. - #10159

Merged
bors-servo merged 1 commit into
servo:masterfrom
pcwalton:iframes-know-their-pipelines
Apr 28, 2016
Merged

bors-servo merged 1 commit into
servo:masterfrom
pcwalton:iframes-know-their-pipelines

Conversation

@pcwalton

Copy link
Copy Markdown
Contributor

Since WebRender uses the pipeline ID stored in the iframe element to
determine which pipeline to display, it had better be kept up to date!

Closes #9919.

r? @jdm


This change is Reviewable

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

Copy link
Copy Markdown

warning Warning warning

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

@pcwalton

Copy link
Copy Markdown
Contributor Author

cc @paulrouget

@pcwalton
pcwalton force-pushed the iframes-know-their-pipelines branch from dd97a10 to e5287b4 Compare March 24, 2016 01:11
@pcwalton

Copy link
Copy Markdown
Contributor Author

Added a reftest. r? @jdm

@Ms2ger

Ms2ger commented Mar 24, 2016

Copy link
Copy Markdown
Contributor

Can you split the reflow call into a separate commit, with an explanation in the commit message about why it's necessary?

@pcwalton
pcwalton force-pushed the iframes-know-their-pipelines branch from e5287b4 to eb6a9bd Compare March 24, 2016 23:05
@pcwalton

Copy link
Copy Markdown
Contributor Author

Removed the reflow call per @Ms2ger's suggestion; only dirtying is needed.

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #10242) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Mar 30, 2016
@paulrouget

Copy link
Copy Markdown
Contributor

This is bitrotting, and badly needed for browserhtml testing (back / forward buttons don't work without this patch).

@jdm

jdm commented Apr 1, 2016

Copy link
Copy Markdown
Member

Sorry, I've been on the hook for high priority Gecko stuff recently.

@pcwalton

pcwalton commented Apr 1, 2016

Copy link
Copy Markdown
Contributor Author

@jdm Would you be willing to hand the review off to someone else? I'm happy to if you suggest someone.

@jdm

jdm commented Apr 1, 2016

Copy link
Copy Markdown
Member

Sorry, I thought this was much more complicated than it is. r=me after rebasing!

@jdm jdm removed the S-awaiting-review There is new code that needs to be reviewed. label Apr 1, 2016
@pcwalton
pcwalton force-pushed the iframes-know-their-pipelines branch from eb6a9bd to 5308e8c Compare April 1, 2016 20:57
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Apr 1, 2016
@pcwalton

pcwalton commented Apr 1, 2016

Copy link
Copy Markdown
Contributor Author

@bors-servo: r=jdm

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 5308e8c has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Apr 1, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 5308e8c with merge c8e71cf...

bors-servo pushed a commit that referenced this pull request Apr 1, 2016
script: Make iframes know their pipeline IDs at all times, even after navigation.

Since WebRender uses the pipeline ID stored in the iframe element to
determine which pipeline to display, it had better be kept up to date!

Closes #9919.

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10159)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-rel-wpt

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Apr 1, 2016
@jdm

jdm commented Apr 1, 2016

Copy link
Copy Markdown
Member

Both tests that failed use iframe history navigation APIs, which is pretty suspicious :)

@samlh

samlh commented Apr 1, 2016

Copy link
Copy Markdown
Contributor

Mac:

Tests with unexpected results:
  ▶ TIMEOUT [expected OK] /_mozilla/mozilla/mozbrowser/iframe_goback.html

  ▶ TIMEOUT [expected OK] /_mozilla/mozilla/mozbrowser/mozbrowserlocationchange_event.html

Linux:


Ran 4642 tests finished in 329.0 seconds.
  • 4640 ran as expected. 1364 tests skipped.
  • 2 tests timed out unexpectedly

Tests with unexpected results:
  ▶ TIMEOUT [expected OK] /_mozilla/mozilla/mozbrowser/iframe_goback.html
  │ 
  └ Xlib:  extension "XFree86-VidModeExtension" missing on display ":0".

  ▶ TIMEOUT [expected OK] /_mozilla/mozilla/mozbrowser/mozbrowserlocationchange_event.html
  │ 
  └ Xlib:  extension "XFree86-VidModeExtension" missing on display ":0".

@pcwalton

pcwalton commented Apr 1, 2016

Copy link
Copy Markdown
Contributor Author

This is very strange, because in iframe_goback.html t.done() is being called (verified by adding a debugging statement before it) and the test is labeled PASS in the window, but the test times out. Any test expert able to help (@jdm)?

@jdm

jdm commented Apr 2, 2016

Copy link
Copy Markdown
Member

Yeah, I'll take a look.

@pcwalton

pcwalton commented Apr 2, 2016

Copy link
Copy Markdown
Contributor Author

@jdm After some reverse engineering of testharness.js I found that the problem is that the load event doesn't always fire on the outer window. This causes the Tests object to never return true from all_done().

This is intermittent, BTW.

@pcwalton

pcwalton commented Apr 2, 2016

Copy link
Copy Markdown
Contributor Author

@jdm I've figured out what the problem is, I'm pretty sure: occasionally the data URL in the iframe gets navigated away from before it loads, and that URL is never removed from DocumentLoader::blocking_loads. So the onload event doesn't fire.

Do you have a preferred way to address this?

@jdm

jdm commented Apr 3, 2016

Copy link
Copy Markdown
Member

That explanation doesn't make sense to me, since the iframe element's load event handler isn't invoked until the load is complete, and the code removes the load blocker directly following the invocation. Reading the code did cause me to file #10384, but that wouldn't cause the problem we're seeing. iframe.goBack() doesn't synchronously cause the pipeline id to change, so we should be removing the appropriate load blocker after returning from the relevant JS handler, and then the pipeline should be updated as a result of the asynchronous UpdateSubpageId that is sent as a result of the constellation receiving the Navigate message sent by iframe.goBack().

@pcwalton

pcwalton commented Apr 6, 2016

Copy link
Copy Markdown
Contributor Author

@jdm So it seems that's what's going on is something like this. In the good case, handle_loads_complete() for the outer document happens before the navigation of the iframe to data:,a, so the DocumentProgressHandler gets installed and will successfully fire the load event on the outer document. In the bad case, handle_loads_complete() for the outer document happens after the navigation of the iframe to data:,a, which does not install the DocumentProgressHandler, since doc.loader().is_blocked() inside handle_loads_complete() returns true.

Does this make sense? How would you prefer to deal with this?

@jdm

jdm commented Apr 7, 2016

Copy link
Copy Markdown
Member

So for iframe_goback.html, the problem is clearly that there's no guarantee that the iframe's load event is dispatched before mozbrowserlocationchange is dispatched, which could leave to the situation where a loadblocker is present that is never removed. The solution there appears to be that goBack and goForward should terminate any existing loadblocker.

I haven't been able to figure out why the new test would timeout, however. I need to keep thinking about that.

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #10345) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Apr 15, 2016
@pcwalton

Copy link
Copy Markdown
Contributor Author

@jdm Ping, when you get a chance. Any thoughts as to the failing test?

@jdm

jdm commented Apr 15, 2016

Copy link
Copy Markdown
Member

Sorry, I've been meaning to get back to this. I'll think more about it on Monday.

@jdm

jdm commented Apr 26, 2016

Copy link
Copy Markdown
Member

@pcwalton I'll approve a PR with the following diff:

diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 9fc3239..999df0b 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -183,6 +183,9 @@ impl HTMLIFrameElement {
         self.subpage_id.set(Some(new_subpage_id));
         self.pipeline_id.set(Some(new_pipeline_id));

+        let mut blocker = self.load_blocker.borrow_mut();
+        LoadBlocker::terminate(&mut blocker);
+
         self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
     }

The problem is that the mozbrowserlocation event fires before the load event for the event, and if the test performs a navigation as a result of mozbrowserlocation this can result in the iframe's pipeline being updated and the script thread not being able to find an iframe for the load event for the previous document, so the load blocker is never removed. By removing any outstanding load blocker when we update the pipeline, we achieve the same effect and ensure that the window load event can't fire too early either.

@pcwalton
pcwalton force-pushed the iframes-know-their-pipelines branch from 5308e8c to 7bd2570 Compare April 28, 2016 17:51
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Apr 28, 2016
@pcwalton

pcwalton commented Apr 28, 2016 •

Copy link
Copy Markdown
Contributor Author

Thanks a bunch! Updated the patch and verified locally that your fix works.

r? @jdm

navigation.

Since WebRender uses the pipeline ID stored in the iframe element to
determine which pipeline to display, it had better be kept up to date!

Closes servo#9919.
@jdm

jdm commented Apr 28, 2016

Copy link
Copy Markdown
Member

@bors-servo: r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 7bd2570 has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Apr 28, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 7bd2570 with merge 3836c2c...

bors-servo pushed a commit that referenced this pull request Apr 28, 2016
script: Make iframes know their pipeline IDs at all times, even after navigation.

Since WebRender uses the pipeline ID stored in the iframe element to
determine which pipeline to display, it had better be kept up to date!

Closes #9919.

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10159)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt

@bors-servo
bors-servo merged commit 7bd2570 into servo:master Apr 28, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Apr 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants