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

Implement location.reload() #7064

Merged
merged 2 commits into from Sep 21, 2015
Merged

Implement location.reload() #7064

merged 2 commits into from Sep 21, 2015

Conversation

@paulrouget
Copy link
Contributor

paulrouget commented Aug 7, 2015

This is a naive implementation of window.location.reload().
I'd appreciate any feedback.

I was wondering if it'd be better to implement ConstellationMsg::Reload instead of using load_url.

Also, what kind of test should I write?

Review on Reviewable

@highfive
Copy link

highfive commented Aug 7, 2015

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @larsbergstrom (or someone else) soon.

@paulrouget paulrouget force-pushed the paulrouget:reload branch 2 times, most recently from 227c3a6 to 2379d19 Aug 7, 2015
@Ms2ger
Copy link
Contributor

Ms2ger commented Aug 7, 2015

I'm not sure I want to add more naive navigation code, we already have way to much of that.

@paulrouget
Copy link
Contributor Author

paulrouget commented Aug 7, 2015

@Ms2ger said we should wait until he has rewritten all the navigation code

@Ms2ger
Copy link
Contributor

Ms2ger commented Sep 2, 2015

-S-blocked-on-external +S-needs-tests +S-needs-rebase

Add some kind of wpt test?


Reviewed 2 of 2 files at r1.
Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from the review on Reviewable.io

@Ms2ger Ms2ger added the S-needs-tests label Sep 2, 2015
@paulrouget paulrouget force-pushed the paulrouget:reload branch from 2379d19 to 436ae7b Sep 3, 2015
@paulrouget
Copy link
Contributor Author

paulrouget commented Sep 3, 2015

This is the only way I found to test location.reload(). Apparently, unload events and iframe.contentWindow don't work. So I used this hacky mechanism. Hope that's ok.

Also, ./mach test-wpt --manifest-update made some unrelated changes to tests/wpt/metadata/MANIFEST.json. Is that normal?

@Ms2ger r?

@Ms2ger
Copy link
Contributor

Ms2ger commented Sep 3, 2015

LGTM, but avoid new JS features like const and () => {}.


test(function() {
assert_equals(url, innerURL, "iframe url");
}, "iframe url should not change");

This comment has been minimized.

@Ms2ger

Ms2ger Sep 4, 2015

Contributor

Sorry I missed this last time. You're creating multiple tests with the same name, which would be painful if we failed one of them. Please just put everything in one async_test, like:

async_test(function() {
  var url = new URL("./location_reload-iframe.html", window.location).href;
  ...
  window._ping = this.step_func(function() {
    ...
    assert_equals(url, innerURL, "iframe url");
    ...
    this.done();
  });

  iframe.src = url;
});
@paulrouget paulrouget force-pushed the paulrouget:reload branch from 2d40aec to 2f6d2bd Sep 7, 2015
@paulrouget
Copy link
Contributor Author

paulrouget commented Sep 7, 2015

I don't know why, but this.step_func doesn't appear to work.

I use function(){this.step(…)} instead.

@paulrouget paulrouget force-pushed the paulrouget:reload branch 2 times, most recently from e45456c to 56e45e0 Sep 7, 2015
@paulrouget
Copy link
Contributor Author

paulrouget commented Sep 7, 2015

nvm, step_func works.

@paulrouget
Copy link
Contributor Author

paulrouget commented Sep 16, 2015

@Ms2ger review ping

@bors-servo
Copy link
Contributor

bors-servo commented Sep 17, 2015

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

@paulrouget paulrouget force-pushed the paulrouget:reload branch from 56e45e0 to e742e7e Sep 21, 2015
@Ms2ger
Copy link
Contributor

Ms2ger commented Sep 21, 2015

Sorry for the delay here.

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Sep 21, 2015

📌 Commit e742e7e has been approved by Ms2ger

@bors-servo
Copy link
Contributor

bors-servo commented Sep 21, 2015

Testing commit e742e7e with merge 4dc986b...

bors-servo pushed a commit that referenced this pull request Sep 21, 2015
Implement location.reload()

This is a naive implementation of `window.location.reload()`.
I'd appreciate any feedback.

I was wondering if it'd be better to implement `ConstellationMsg::Reload` instead of using  `load_url`.

Also, what kind of test should I write?

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7064)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 21, 2015

@bors-servo bors-servo merged commit e742e7e into servo:master Sep 21, 2015
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
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.

None yet

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