Fix HasServiceWorker check
Revert cb2014f9e8ae0283e5f20d4e2167be1592228887.
This commit is contained in:
parent
e2fe95894f
commit
4d9f309888
2 changed files with 14 additions and 4 deletions
|
@ -1238,14 +1238,25 @@ void WebContents::InspectServiceWorker() {
|
|||
}
|
||||
|
||||
void WebContents::HasServiceWorker(
|
||||
const base::Callback<void(content::ServiceWorkerCapability)>& callback) {
|
||||
const base::Callback<void(bool)>& callback) {
|
||||
auto context = GetServiceWorkerContext(web_contents());
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
struct WrappedCallback {
|
||||
base::Callback<void(bool)> callback_;
|
||||
WrappedCallback(const base::Callback<void(bool)>& callback) : callback_(callback) {}
|
||||
void Run(content::ServiceWorkerCapability capability) {
|
||||
callback_.Run(capability != content::ServiceWorkerCapability::NO_SERVICE_WORKER);
|
||||
delete this;
|
||||
}
|
||||
};
|
||||
|
||||
auto wrapped_callback = new WrappedCallback(callback);
|
||||
|
||||
context->CheckHasServiceWorker(web_contents()->GetLastCommittedURL(),
|
||||
GURL::EmptyGURL(),
|
||||
callback);
|
||||
base::Bind(&WrappedCallback::Run, base::Unretained(wrapped_callback)));
|
||||
}
|
||||
|
||||
void WebContents::UnregisterServiceWorker(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue