8000 fix: reject with error when url not loaded by codebytere · Pull Request #16571 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: reject with error when url not loaded #16571

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

Merged
merged 2 commits into from
Jan 28, 2019
Merged

fix: reject with error when url not loaded #16571

merged 2 commits into from
Jan 28, 2019

Conversation

codebytere
Copy link
Member
@codebytere codebytere commented Jan 28, 2019

Description of Change

When a user tried to call webContents.hasServiceWorker()on a webContents that hadn't yet loaded a valid URL, a DCHECK would get triggered. This prevents unexplained behavior for the end user by clearly rejecting with an error when webContents.hasServiceWorker() is called and there is no valid file or url in which to check for the presence of a ServiceWorker.

cc @ckerr

Checklist

Release Notes

Notes: Ensured that webContents.hasServiceWorker() rejects with an error for invalid URLs.

@codebytere codebytere requested a review from a team January 28, 2019 20:29
Copy link
Member
@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@codebytere codebytere merged commit a25f82c into master Jan 28, 2019
@release-clerk
Copy link
release-clerk bot commented Jan 28, 2019

Release Notes Persisted

Ensured that webContents.hasServiceWorker() rejects with an error for invalid URLs.

@codebytere codebytere 8000 deleted the throw-sw branch January 28, 2019 22:42
}

GURL url = web_contents()->GetLastCommittedURL();
if (!url.is_valid()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would a committed url be invalid ? Its a virtual url generated by the navigation controller. The DCHECK you hit is probably the other url that should be encompassed isn't recognized, in which case try using visible URL. Also using the result of committed URL to test page loading state is not a good idea.

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.

3 participants
0