I have been using the
WebRequest API and I have discovered what appears to be inconsistent behavior.
I am unable to trigger the API while using certain google pages. In this instance, I'm unable to catch certain PUT requests that are made on Google Drive. However, the request properly shows up in the network developer tools of the page (please see the end of this post for the actual request details).
This request does not trigger the correct callbacks in the webrequest API. I have checked the following callbacks, and none of them are called:
onBeforeRequest
onBeforeSendHeaders
onBeforeRedirect
onCompleted
onErrorOccurred
I'm aware of some of the standard caveats relating to the webrequest api. At first I assumed that the pre-installed Google Docs extension might be manipulating the page in a way that prevented my extension from being able to see the request. I disabled the extension and I'm still unable to see this request.
I also considered that maybe flash or another plugin was handling this request (although I'm not sure if it would show up in the devtools if that were the case) but after disabling all installed plugins (flash, silverlight, java, Google Talk, etc) with the exception of the NaCl plugin, which my extensions relies on, I'm still unable to see this request in the webrequest API.
Finally, I explicitly set the contentSettings for google drive to disallow any plugins from running on that page, and I still do not see the PUT request in the webrequest API.
I then created a sample page that used PUT requests to test if the webrequest API was catching them anywhere (they're fairly rare despite being the proper REST way to update resources with a known location) and I am able to catch PUT requests on my test page.
So given the above, is there anything I am missing that might be the cause of the webrequest API missing this request? Any help with greatly appreciated, and if I'm missing something simple, please feel free to call me an idiot and point me in the direction of the documentation!
Request Overview:
This request can be generated in the following manner.
1. Login to Google Drive.
2. Select an image file present in google drive (upload one if required)
3. Click the "Preview" button on the top right of the nav bar (image of an eye)
4. While in preview mode, select the Details button on the top right of the nav bar (Image of a lowercase i with a circle around it)
5. Click the "Edit Description" button on the right side of the page (pencil shape)
6. Enter a new description and press enter
Sample output on the network tab of the developer tools for the given page (I have removed a few request headers with Auth details).
-------------------------------------------------------------------------------------------
Remote Address:
Request URL:
Request Method:
PUT
Status Code:
200 OK
- Response Headers
access-control-allow-credentials:
true
access-control-allow-origin:
access-control-expose-headers:
Cache-Control,Content-Encoding,Content-Length,Content-Type,Date,Expires,Pragma,Server,Vary
alternate-protocol:
443:quic,p=0.5
cache-control:
no-cache, no-store, max-age=0, must-revalidate
content-encoding:
gzip
content-length:
99
content-type:
application/json; charset=UTF-8
date:
Tue, 31 Mar 2015 18:17:21 GMT
expires:
Fri, 01 Jan 1990 00:00:00 GMT
pragma:
no-cache
server:
GSE
status:
200
vary:
X-Origin
vary:
Origin
x-content-type-options:
nosniff
x-frame-options:
SAMEORIGIN
x-xss-protection:
1; mode=block
- Request Headers
:authority:
:method:
PUT
:path:
/drive/v2internal/files/0B9fS7R4TE5gmREh4YXZWOTk0YzA?fields=id%2Ckind,description&key=AIzaSyAy9VVXHSpS2IJpptzYtGbLP3-3_l0aBk4&alt=json
:scheme:
https
accept:
*/*
accept-encoding:
gzip, deflate, sdch
accept-language:
en-US,en;q=0.8
cache-control:
no-cache
content-length:
22
content-type:
application/json
origin:
pragma:
no-cache
referer:
user-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36
x-client-data:
CJO2yQEIpLbJAQiptskBCMG2yQEI7YjKAQ==
x-clientdetails:
appVersion=5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_9_5)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F41.0.2272.104%20Safari%2F537.36&platform=MacIntel&userAgent=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_9_5)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F41.0.2272.104%20Safari%2F537.36
x-goog-authuser:
0
x-javascript-user-agent:
google-api-javascript-client/0.1
- Query String Parametersview sourceview URL encoded
fields:
id,kind,description
key:
AIzaSyAy9VVXHSpS2IJpptzYtGbLP3-3_l0aBk4
alt:
json
- Request Payloadview source