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

WPF WebView Source property reflects current document location #2538

Merged

Conversation

@rjmurillo
Copy link
Contributor

@rjmurillo rjmurillo commented Oct 8, 2018

Issue: #2537

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

When navigating via means other than the Source property (e.g. Navigate method), or when the document is redirected with a 301/302 response, the Source property is not properly updated. The only reliable means of getting the document was to call InvokeScriptAsync("eval", "window.location.href").

What is the new behavior?

The following changes address the issue:

  • Navigation of the underlying control is no longer controlled by updating the dependency property. This permits the value of the property to be updated when a change is detected.
  • The SourceProperty dependency property has its new value set from the arguments provided in the NavigationCompleted event.
  • Calling void Navigate(Uri) calls the underlying Navigate method instead of relying on the depenency property update to navigate the control.
  • Setting the value of Source now calls void Navigate(Uri) if the control is initialized; otherwise, it only sets the SourceProperty dependency value. Navigation to the stored value will occur when the control is ready to navigate after asynchronous initialization.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template. (for bug fixes / features)
  • Sample in sample app has been added / updated (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

Other information

Fixes #2537

rjmurillo added 2 commits Oct 8, 2018
When navigating via means other than the `Source` property (e.g. `Navigate` method), or when the document is redirected with a 301/302 response, the `Source` property is not properly updated. The only reliable means of getting the document was to call `InvokeScriptAsync("eval", "window.location.href")`.

The following changes address the issue:
 - Navigation of the underlying control is no longer controlled by updating the dependency property. This permits the value of the property to be updated when a change is detected.
 - The SourceProperty dependency property has its new value set from the arguments provided in the `NavigationCompleted` event.
 - Calling `void Navigate(Uri)` calls the underlying Navigate method instead of relying on the depenency property update to navigate the control.
 - Setting the value of `Source` now calls `void Navigate(Uri)` if the control is initialized; otherwise, it only sets the `SourceProperty` dependency value. Navigation to the stored value will occur when the control is ready to navigate after asynchronous initialization.
nmetulev and others added 4 commits Oct 10, 2018
@nmetulev nmetulev merged commit 29370b1 into windows-toolkit:master Oct 16, 2018
3 checks passed
3 checks passed
Toolkit-CI Build #20181015.19 succeeded
Details
WIP ready for review
Details
license/cla All CLA requirements met.
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.

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