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

Checking the browsing_context before change title #10821

Merged
merged 1 commit into from May 6, 2016

Conversation

@askeing
Copy link
Contributor

askeing commented Apr 23, 2016

fix #10782


This change is Reviewable

@highfive
Copy link

highfive commented Apr 23, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/document.rs
@highfive
Copy link

highfive commented Apr 23, 2016

warning Warning warning

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

askeing commented Apr 23, 2016

Testing HTML:

<!DOCTYPE html>
<title>Foo</title>
<script>
setTimeout(() => {
  var text =
    '<html xmlns="http://www.w3.org/1999/xhtml">' +
    '  <head>' +
    '    <title>Virtual Library</title>' +
    '  </head>' +
    '</html>';

  var parser = new DOMParser();
  var doc = parser.parseFromString(text, "text/xml");
}, 100);
</script>

The title keep Foo - servo.

@shinglyu
Copy link
Member

shinglyu commented Apr 23, 2016

@jdm
Copy link
Member

jdm commented Apr 23, 2016

Unfortunately this change can't be verified by automated tests, since it's only the window frame title that changes, which isn't visible to JS.

@wafflespeanut wafflespeanut assigned jdm and unassigned wafflespeanut Apr 23, 2016
@Ms2ger
Copy link
Contributor

Ms2ger commented Apr 24, 2016

R? @jdm

@notriddle
Copy link
Contributor

notriddle commented Apr 24, 2016

Isn't the window title exposed through the <iframe mozbrowser> API? I think you could automatically test it by running this test code in a mozbrower and doing the verification with a fake on the outside.

@nox
Copy link
Member

nox commented Apr 26, 2016

What about just calling title_changed when the title actually changed instead of calling it so eagerly?

@jdm
Copy link
Member

jdm commented Apr 26, 2016

@nox I'm not sure what you're proposing. That's what the code tries to do?

@jdm
Copy link
Member

jdm commented Apr 29, 2016

@notriddle is absolutely right. We can use a test like tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html to load an HTML file that creates that DOMParser from the example in #10782. After it's finished parsing it can use alert("done") to signal that the test is complete. If the parent page has not observed a mozbrowsertitlechange event on the iframe, the test can pass.

@jdm jdm added S-needs-tests and removed S-awaiting-review labels Apr 29, 2016
@askeing
Copy link
Contributor Author

askeing commented Apr 30, 2016

@jdm, should I open another PR for the test? Or just add a commit here?

@jdm
Copy link
Member

jdm commented Apr 30, 2016

Adding the commit here would be appropriate.

@askeing
Copy link
Contributor Author

askeing commented Apr 30, 2016

I found the parent page will get mozbrowsertitlechange at beginning with e.detail = "", and then get real title e.detail = "Foo".
So I call assert_not_equals for checking e.detail cannot be Bar, which is the title in DOMParser.

Origin build:

$ ./mach test-wpt --debug-build tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html
Running 1 tests in web-platform-tests

Unsupported test type wdspec for product servo
  ▶ Unexpected subtest result in /_mozilla/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html:
  │ FAIL [expected PASS] Check if title_changed is too eager (issue #10782)
  │   → assert_not_equals: got disallowed value "Bar"
  │
  │ @http://web-platform.test:8000/_mozilla/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html:7:13
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1397:20
  └ Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1421:1

Ran 1 tests finished in 14.0 seconds.
  • 0 ran as expected. 0 tests skipped.
  • 1 tests had unexpected subtest results

After modified build:

 ./mach test-wpt --debug-build tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html
Running 1 tests in web-platform-tests

Unsupported test type wdspec for product servo
Ran 1 tests finished in 5.0 seconds.
  • 1 ran as expected. 0 tests skipped.
@jdm
Copy link
Member

jdm commented May 3, 2016

-S-needs-tests -S-awaiting-review +S-needs-code-changes


Reviewed 1 of 1 files at r1, 3 of 3 files at r2.
Review status: all files reviewed at latest revision, 5 unresolved discussions.


components/script/dom/document.rs, line 621 [r1] (raw file):
if self.browsing_context().is_some()


tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html, line 16 [r2] (raw file):
We should be able to use the regular iframe load event here instead, and use t.step_func_done().


tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event_iframe.html, line 5 [r2] (raw file):
Let's get rid of this timeout.


tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event_iframe.html, line 14 [r2] (raw file):
No need for this.


tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event_iframe.html, line 16 [r2] (raw file):
We don't need this if we use the load event.


Comments from Reviewable

@askeing
Copy link
Contributor Author

askeing commented May 4, 2016

tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html, line 16 [r2] (raw file):
Does the iframe load event mean listening on mozbrowserloadend event?


Comments from Reviewable

@jdm
Copy link
Member

jdm commented May 4, 2016

Review status: all files reviewed at latest revision, 5 unresolved discussions.


tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html, line 16 [r2] (raw file):
No, just the load event.


Comments from Reviewable

@highfive
Copy link

highfive commented May 4, 2016

New code was committed to pull request.

@jdm
Copy link
Member

jdm commented May 4, 2016

@bors-servo: delegate+
Looks good! Squash the commits together into one and go ahead and merge with r=jdm.
-S-awaiting-review +S-needs-squash


Reviewed 3 of 3 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2016

💔 Test failed - windows

@mbrubeck
Copy link
Contributor

mbrubeck commented May 6, 2016

@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2016

Testing commit 3c56d41 with merge 597a5f1...

bors-servo added a commit that referenced this pull request May 6, 2016
Checking the browsing_context before change title

fix #10782

<!-- 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/10821)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2016

💔 Test failed - windows

@larsbergstrom
Copy link
Contributor

larsbergstrom commented May 6, 2016

@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2016

Testing commit 3c56d41 with merge 17ba9fb...

bors-servo added a commit that referenced this pull request May 6, 2016
Checking the browsing_context before change title

fix #10782

<!-- 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/10821)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2016

💔 Test failed - mac-rel-css

@highfive
Copy link

highfive commented May 6, 2016

  ▶ CRASH [expected PASS] /css-text-3_dev/html/css3-text-line-break-opclns-063.htm
  │ 
  │ Shutting down the Constellation after generating an output file or exit flag specified
  │ Shutting down the Constellation after generating an output file or exit flag specified
  │ thread &#39;ScriptThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(0) }&#39; panicked at &#39;called `Option::unwrap()` on a `None` value&#39;, ../src/libcore/option.rs:325
  │ stack backtrace:
  │    1:        0x110034d18 - std::sys::backtrace::tracing::imp::write::h9fb600083204ae7f
  │    2:        0x11003aff5 - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac
  │    3:        0x11003ac0e - std::panicking::default_hook::hc2c969e7453d080c
  │    4:        0x10f790242 - util::panicking::initiate_panic_hook::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::heda6930908f06acc
  │    5:        0x1100224e8 - std::sys_common::unwind::begin_unwind_inner::h30e12d15ce2b2e25
  │    6:        0x110023e1e - std::sys_common::unwind::begin_unwind_fmt::hb2de8a9968d38523
  │    7:        0x110033fe7 - rust_begin_unwind
  │    8:        0x110062db0 - core::panicking::panic_fmt::h257ceb0aa351d801
  │    9:        0x1100630ac - core::panicking::panic::h4bb1497076d04ab9
  │   10:        0x10f160b70 - script::page::Page::window::h010a05681584eec2
  │   11:        0x10f003fcc - std::sys_common::unwind::try::try_fn::hd12b2d76c81a0e30
  │   12:        0x110033f7b - __rust_try
  │   13:        0x110033f03 - std::sys_common::unwind::inner_try::h47a4d9cd4a369dcd
  │   14:        0x10f0042ca - _&lt;F as std..boxed..FnBox&lt;A&gt;&gt;::call_box::he24f36d07ed1c7fd
  │   15:        0x11003a078 - std::sys::thread::Thread::new::thread_start::h6f266e069bf4ec2b
  │   16:     0x7fff8c3c2059 - _pthread_body
  │   17:     0x7fff8c3c1fd6 - _pthread_start
  └ thread panicked while panicking. aborting.

  ▶ CRASH [expected FAIL] /css-text-3_dev/html/text-align-justify-001.htm
  │ 
  │ Shutting down the Constellation after generating an output file or exit flag specified
  │ thread &#39;ScriptThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(0) }&#39; panicked at &#39;called `Option::unwrap()` on a `None` value&#39;, ../src/libcore/option.rs:325
  │ stack backtrace:
  │    1:        0x106359d18 - std::sys::backtrace::tracing::imp::write::h9fb600083204ae7f
  │    2:        0x10635fff5 - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac
  │    3:        0x10635fc0e - std::panicking::default_hook::hc2c969e7453d080c
  │    4:        0x105ab5242 - util::panicking::initiate_panic_hook::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::heda6930908f06acc
  │    5:        0x1063474e8 - std::sys_common::unwind::begin_unwind_inner::h30e12d15ce2b2e25
  │    6:        0x106348e1e - std::sys_common::unwind::begin_unwind_fmt::hb2de8a9968d38523
  │    7:        0x106358fe7 - rust_begin_unwind
  │    8:        0x106387db0 - core::panicking::panic_fmt::h257ceb0aa351d801
  │    9:        0x1063880ac - core::panicking::panic::h4bb1497076d04ab9
  │   10:        0x105485b70 - script::page::Page::window::h010a05681584eec2
  │   11:        0x105328fcc - std::sys_common::unwind::try::try_fn::hd12b2d76c81a0e30
  │   12:        0x106358f7b - __rust_try
  │   13:        0x106358f03 - std::sys_common::unwind::inner_try::h47a4d9cd4a369dcd
  │   14:        0x1053292ca - _&lt;F as std..boxed..FnBox&lt;A&gt;&gt;::call_box::he24f36d07ed1c7fd
  │   15:        0x10635f078 - std::sys::thread::Thread::new::thread_start::h6f266e069bf4ec2b
  │   16:     0x7fff8c3c2059 - _pthread_body
  │   17:     0x7fff8c3c1fd6 - _pthread_start
  └ thread panicked while panicking. aborting.
@cbrewster
Copy link
Member

cbrewster commented May 6, 2016

@bors-servo retry

  • Checking for intermittent
@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2016

Previous build results for android, arm32, arm64, linux-dev, mac-dev-unit, mac-rel-wpt, windows are reusable. Rebuilding only linux-rel, mac-rel-css...

@mbrubeck
Copy link
Contributor

mbrubeck commented May 6, 2016

Checking for intermittent

Filed #11059

@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2016

@bors-servo bors-servo merged commit 3c56d41 into servo:master May 6, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@askeing askeing deleted the askeing:fix_10782 branch May 7, 2016
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.

You can’t perform that action at this time.