New issue
Advanced search Search tips

Issue 781607 link

Starred by 3 users

Issue metadata

Status: Archived
Owner: ----
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Webview clearData method not clearing cache

Reported by jason.so...@gmail.com, Nov 5 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36

Steps to reproduce the problem:
1. Create a packaged app that uses a webview
2. Call the clearData method on the webview, indicating the cache should be cleared in the clearDataOptions

What is the expected behavior?
The webview cache would be cleared and all content loaded into the webview would be requested fresh from the network

What went wrong?
The cache is not cleared and the clearData method returns false. 

Did this work before? Yes 61

Does this work in other browsers? N/A

Chrome version: 62.0.3202.75  Channel: stable
OS Version: 62.0.3202.75
Flash Version: 

We have continuous deployment of the portion of our app that is loaded in the webview.  All the files on this portion of the app have a 4 hour cache setting.  To avoid having to wait 4 hours to test each change, we clear the webview cache each time the Chrome App starts up.  Up to Chrome 61, our code to do so worked fine.  Now with Chrome 62, it no longer works.  Here is a link to our app :

https://chrome.google.com/webstore/detail/testnav/mdmkkicfmmkgmpkmkdikhlbggogpicma?hl=en

We have had issues with this API (https://developer.chrome.com/apps/tags/webview#method-clearData) in the past :

https://bugs.chromium.org/p/chromium/issues/detail?id=615429

Initially we called clearData before src was set on the webview.  Due to API changes mentioned in 615429, we changed src to 'about:blank' and then cleared webview cache.  This worked fine until Chrome 62.  Now the webview cache isn't cleared (easily seen as old code is loaded in the webview) and the clearData method returns false.
 
Components: Platform>Apps>BrowserTag
Any updates on this?

Comment 3 by lfg@chromium.org, Nov 13 2017

Labels: Needs-Feedback
I've looked through your extension, and the issue seems to be the same as the  issue 615429  you mentioned, that is, the webview doesn't have a src.

If I set the webview.src to 'about:blank' in your app, the clearData function works as intended (I was using shift+ctrl+c to test).

Can you make sure that src is set to 'about:blank'?

My code update after  issue 615429  was to always set the webview src to 'about:blank'.  Before doing that I registered a 'loadstart' event handler that would call the webview cache clear.  Once that was complete I removed the 'loadstart' handler and sent the app on it's normal flow of loading the application URL.  This process worked fine from Chrome 53 to 61, but now does not seem to work any more.  My code is triggered because I see log statements I added when the call to clearData returns false.  Is it possible something changed with the loading flow and I need to bind to a different even than 'loadstart'?  It's not very clear when clearData can be called successfully beyond having the src attribute set.
Project Member

Comment 5 by sheriffbot@chromium.org, Nov 16 2017

Cc: lfg@chromium.org
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "lfg@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 6 by lfg@chromium.org, Nov 20 2017

Labels: Needs-Feedback
Can you provide an example that fails? I've tried again with your app in comment #1, and I can't see anything that calls showAppStartPage(), if I just call that manually from the console things just work and the cache is cleared.

The showAppStartPage() method is called by a background script (as is showTN8Page).  Clearing the cache always seems to work once a page has been loaded.  The same code was working in Chrome 61 when we set the webview src to 'about:blank'.  
Project Member

Comment 8 by sheriffbot@chromium.org, Nov 21 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "lfg@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 9 by lfg@chromium.org, Nov 21 2017

Ah, I see now -- I had nacl disabled, which is why the start page doesn't trigger. After building with NaCl enabled, the clearCache is triggered for me, here's the log output:

Running version 1.6.91 of the Chrome App
tn8nacl.js:318 Not running on a Chromebook, user agent is Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3272.0 Safari/537.36
tn8nacl.js:907 No previously saved config found.
tn8nacl.js:952 No previously saved client selection found, directing to customer selection page
tn8nacl.js:599 Launching HTTP server
tn8nacl.js:599 Message found to process. Method: openFileSystem Callback ID:  Start time : 2017-11-21.19:17:44 Thread id : 4273772152
tn8nacl.js:599 Opened file system
tn8nacl.js:599 Verifying application files have not been changed since build time
tn8nacl.js:599 HTTP server launched on port 9004  HTTPS server launched on port 9444
_platform_specific/arm/testnav_middle_arm.nexe Failed to load resource: net::ERR_FILE_NOT_FOUND
_platform_specific/x86-32/testnav_middle_x86_32.nexe Failed to load resource: net::ERR_FILE_NOT_FOUND
tn8nacl.js:790 (JavaScript) : Calling -headToServer
tn8nacl.js:599 Application files have been changed on the local file system.  Application should be re-installed
tn8nacl.js:599 Message found to process. Method: setKioskMode Callback ID: -1 Start time : 2017-11-21.19:17:44 Thread id : 4273772152
tn8nacl.js:599 (Native) : Calling - SetKioskMode
tn8nacl.js:599 Kiosk mode set to false
tn8nacl.js:599 Finished processing message. Method: setKioskMode Callback ID: -1 End time : 2017-11-21.19:17:44 Thread id : 4273772152
tn8nacl.js:599 Message found to process. Method: headToServer Callback ID: 1 Start time : 2017-11-21.19:17:44 Thread id : 4273772152
tn8nacl.js:599 (Native) : Calling - TestConnection
tn8nacl.js:599 Test url tested
tn8nacl.js:599 Finished processing message. Method: headToServer Callback ID: 1 End time : 2017-11-21.19:17:45 Thread id : 4273772152
tn8nacl.js:142 showAppStartPage
tn8nacl.js:170 disableAppStartPageWebviewListeners
tn8nacl.js:145 loadstart
tn8nacl.js:465 Cleared webview (tn8-startpage) cache
tn8nacl.js:158 postAppStartPageWebviewCacheClear
tn8nacl.js:175 enableAppStartPageWebviewListeners
tn8nacl.js:163 setAppStartPageSrc

I still don't understand what's the issue. If you could provide a simpler example with just your problem, that would be helpful.

I noticed the user agent shown in your log fragment indicates you are running this on Linux?  I am only able to recreate this issue on ChromeOS.  I always assumed the clearData method didn't really do anything outside of ChromeOS and just returned a true value.  I started the app again on ChromeOS both in kiosk mode and outside and I got the same failure to clear the cache messages.  It seems this issue may be specific to ChromeOS.

Comment 11 by lfg@chromium.org, Dec 6 2017

I just tried on a CrOS build, and still unable to repro. Here are the logs:

Running version 1.6.91 of the Chrome App
tn8nacl.js:316 Running on a Chromebook, user agent is Mozilla/5.0 (X11; CrOS x86_64 0.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3281.0 Safari/537.36
tn8nacl.js:907 No previously saved config found.
tn8nacl.js:952 No previously saved client selection found, directing to customer selection page
tn8nacl.js:599 Launching HTTP server
tn8nacl.js:599 Message found to process. Method: openFileSystem Callback ID:  Start time : 2017-12-06.19:19:58 Thread id : 4273772152
tn8nacl.js:599 Opened file system
tn8nacl.js:599 Verifying application files have not been changed since build time
tn8nacl.js:599 HTTP server launched on port 9004  HTTPS server launched on port 9444
_platform_specific/arm/testnav_middle_arm.nexe:1 HEAD chrome-extension://enmnpbhbllkamajpkdhhdlkgdkbfbcek/_platform_specific/arm/testnav_middle_arm.nexe net::ERR_FILE_NOT_FOUND
_platform_specific/x86-32/testnav_middle_x86_32.nexe:1 HEAD chrome-extension://enmnpbhbllkamajpkdhhdlkgdkbfbcek/_platform_specific/x86-32/testnav_middle_x86_32.nexe net::ERR_FILE_NOT_FOUND
tn8nacl.js:599 Application files have been changed on the local file system.  Application should be re-installed
tn8nacl.js:790 (JavaScript) : Calling -headToServer
tn8nacl.js:599 Message found to process. Method: setKioskMode Callback ID: -1 Start time : 2017-12-06.19:19:58 Thread id : 4273772152
tn8nacl.js:599 (Native) : Calling - SetKioskMode
tn8nacl.js:599 Kiosk mode set to false
tn8nacl.js:599 Finished processing message. Method: setKioskMode Callback ID: -1 End time : 2017-12-06.19:19:58 Thread id : 4273772152
tn8nacl.js:599 Message found to process. Method: headToServer Callback ID: 1 Start time : 2017-12-06.19:19:58 Thread id : 4273772152
tn8nacl.js:599 (Native) : Calling - TestConnection
tn8nacl.js:599 Test url tested
tn8nacl.js:599 Finished processing message. Method: headToServer Callback ID: 1 End time : 2017-12-06.19:19:58 Thread id : 4273772152
tn8nacl.js:142 showAppStartPage
tn8nacl.js:170 disableAppStartPageWebviewListeners
tn8nacl.js:145 loadstart
tn8nacl.js:465 Cleared webview (tn8-startpage) cache
tn8nacl.js:158 postAppStartPageWebviewCacheClear
tn8nacl.js:175 enableAppStartPageWebviewListeners
tn8nacl.js:163 setAppStartPageSrc
tn8nacl.js:163 setAppStartPageSrc

I noticed the latest comment/logs were given using Chrome 64.  This was reported against Chrome 62, so I'll have some testers internally try this against newer versions of Chrome and see if the issue goes away.  I'm still able to reproduce this 100% of the time on Chrome 62.
We could recreate this on Chrome 62, but it seems to be gone now on Chrome 63 and above.  I think this can be closed.  If it comes up again, we can report a new crbug.  Thanks!

Comment 14 by lfg@chromium.org, Jan 17 2018

Status: Archived (was: Unconfirmed)
Thanks for verifying it, please file a new bug if the issue comes back.

Sign in to add a comment