Skip to content

Implemented webdriver SetWindowSize. - #11179

Merged
bors-servo merged 4 commits into
servo:masterfrom
asajeffrey:webdriver-resize-window
May 23, 2016
Merged

bors-servo merged 4 commits into
servo:masterfrom
asajeffrey:webdriver-resize-window

Conversation

@asajeffrey

@asajeffrey asajeffrey commented May 13, 2016 •

Copy link
Copy Markdown
Contributor

Thank you for contributing to Servo! Please replace each [ ] by [X] when the step is complete, and replace __ with appropriate data:

Either:

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.


This change is Reviewable

@asajeffrey

Copy link
Copy Markdown
Contributor Author

r? @jgraham

@asajeffrey

Copy link
Copy Markdown
Contributor Author

Must remember to update #8623 if/when this merges.

@jgraham

jgraham commented May 16, 2016

Copy link
Copy Markdown
Contributor

Reviewed 7 of 7 files at r1.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


components/script/webdriver_handlers.rs, line 302 [r1] (raw file):

    let untyped = size.to_untyped();
    // TODO: when window puts in security checks for resize, we will need to rewrite this
    window.ResizeTo(untyped.width as i32, untyped.height as i32);

This is async; I think the webdriver spec currently expects the resize to be synchronous.


components/webdriver_server/lib.rs, line 375 [r1] (raw file):

    fn handle_set_window_size(&self, params: &WindowSizeParameters) -> WebDriverResult<WebDriverResponse> {
        let (sender, receiver) = ipc::channel().unwrap();
        let size = Size2D::from_untyped(&Size2D::new(params.width as f32, params.height as f32));

What happens if the size is greater than the size of the screen?


Comments from Reviewable

@asajeffrey

Copy link
Copy Markdown
Contributor Author

Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/script/webdriver_handlers.rs, line 302 [r1] (raw file):

Previously, jgraham wrote…

This is async; I think the webdriver spec currently expects the resize to be synchronous.


Hmm, true. This is going to be a bit painful to implement, as resizing in the compositor is async. How wedded is the spec to synchronous resize?


Comments from Reviewable

@jgraham

jgraham commented May 16, 2016

Copy link
Copy Markdown
Contributor

Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/script/webdriver_handlers.rs, line 302 [r1] (raw file):

Previously, asajeffrey (Alan Jeffrey) wrote…

Hmm, true. This is going to be a bit painful to implement, as resizing in the compositor is async. How wedded is the spec to synchronous resize?


Well, it wold be nice, but I guess I can argue that on some platforms it might not be possible to implement in a sync way.


Comments from Reviewable

@asajeffrey

Copy link
Copy Markdown
Contributor Author

Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/script/webdriver_handlers.rs, line 302 [r1] (raw file):

Previously, jgraham wrote…

Well, it wold be nice, but I guess I can argue that on some platforms it might not be possible to implement in a sync way.


So how to proceed? I can reimplement this as sync, but it's going to be quite a bit of rewiring, which I'd rather not do if we think we're going to rewrite the spec.


Comments from Reviewable

@highfive

Copy link
Copy Markdown

New code was committed to pull request.

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

Copy link
Copy Markdown
Contributor Author

I made SetWindowSize wait for a resize event before responding.

@highfive

Copy link
Copy Markdown

New code was committed to pull request.

@asajeffrey

Copy link
Copy Markdown
Contributor Author

Added a timeout to SetWindowSize.

@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label May 18, 2016
@asajeffrey
asajeffrey force-pushed the webdriver-resize-window branch from 91fa863 to 0737990 Compare May 18, 2016 16:17
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Rebased.

@asajeffrey asajeffrey removed the S-needs-rebase There are merge conflict errors. label May 19, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label May 19, 2016
@jgraham

jgraham commented May 20, 2016

Copy link
Copy Markdown
Contributor

Reviewed 3 of 8 files at r4, 2 of 6 files at r5, 3 of 4 files at r6.
Review status: 8 of 9 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


components/webdriver_server/lib.rs, line 226 [r6] (raw file):

            script_timeout: 30_000,
            load_timeout: 300_000,
            resize_timeout: 30_000,

I think this should be much smaller like a few hundred ms?


components/webdriver_server/lib.rs, line 368 [r6] (raw file):

        let window_size = receiver.recv().unwrap();
        let vp = window_size.visible_viewport;

I think this is wrong per spec, as it is supposed to include the window border &c. I am not particularly worried about that at this time (I am also not sure that the spec is really right here).


components/webdriver_server/lib.rs, line 393 [r6] (raw file):

                Ok(WebDriverResponse::WindowSize(window_size_response))
            },
            None => Err(WebDriverError::new(ErrorStatus::Timeout, "Resize timed out")),

I think in this case we should return the current window size.


Comments from Reviewable

@asajeffrey
asajeffrey force-pushed the webdriver-resize-window branch from 0737990 to 8797f6f Compare May 20, 2016 14:45
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Rebased and fixed.

Previously, bors-servo wrote…

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


Review status: 8 of 9 files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


components/webdriver_server/lib.rs, line 226 [r6] (raw file):

Previously, jgraham wrote…

I think this should be much smaller like a few hundred ms?

Changed it to 500.

components/webdriver_server/lib.rs, line 393 [r6] (raw file):

Previously, jgraham wrote…

I think in this case we should return the current window size.

Done.

Comments from Reviewable

@asajeffrey asajeffrey removed the S-needs-rebase There are merge conflict errors. label May 21, 2016
@jgraham

jgraham commented May 23, 2016

Copy link
Copy Markdown
Contributor

Reviewed 1 of 6 files at r8, 1 of 4 files at r9, 5 of 5 files at r10.
Review status: 8 of 9 files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@jgraham

jgraham commented May 23, 2016

Copy link
Copy Markdown
Contributor

Reviewed 1 of 6 files at r8.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@jgraham

jgraham commented May 23, 2016

Copy link
Copy Markdown
Contributor

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 8797f6f has been approved by jgraham

@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. labels May 23, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 8797f6f with merge 2063bde...

bors-servo pushed a commit that referenced this pull request May 23, 2016
Implemented webdriver SetWindowSize.

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #10467 (github issue number if applicable).

Either:
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because the new tests are in web-platform-tests/wpt#3024

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

<!-- 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/11179)
<!-- 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, windows

@bors-servo
bors-servo merged commit 8797f6f into servo:master May 23, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label May 23, 2016
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Oops, this should have been squashed before merging.

@jgraham

jgraham commented May 23, 2016

Copy link
Copy Markdown
Contributor

Ah, sorry :(

@asajeffrey

Copy link
Copy Markdown
Contributor Author

No biggie.

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.

Add a web driver test for resizing a web page

4 participants