webview.request access to requests initiated by th

2019-08-25 11:03发布

问题:

In a Chrome App I am able to access requests made by the <webview> and I am able to redirect if needed.

The problem is the web app rendered inside the <webview> tag registers a service worker and lots of requests are handled by the service worker.

Based on my tests the onBeforeRequest won't be notified. It works if I unregister the service worker, though.

webview.request.onBeforeRequest.addListener(
      this.handleRequest,
      {urls: [pattern], types: ["image"]},
      ["blocking"]
    );

So, is this a bug? or intentional?

ref: https://developers.chrome.com/apps/tags/webview#property-request