zotero / zotero-connectors

Chrome, Firefox, Edge, and Safari extensions for Zotero
https://www.zotero.org/download/connectors
Other
530 stars 124 forks source link

Safari: ProQuest translator same-origin `processDocuments()` is treated as cross-origin, loses cookies(?) #515

Open AbeJellinek opened 1 month ago

AbeJellinek commented 1 month ago

Reported: https://forums.zotero.org/discussion/comment/477452/#Comment_477452

ProQuest.js makes a processDocuments() request to grab the abstract page. ProQuest returns a login page ("Gain access through your school, library, or company"). Clicking the abstract link manually works fine, so ProQuest only thinks I'm not logged in when the request comes from the Connector's cross-origin request system. Makes me think that it's either not sending cookies or not routing through my SOCKS proxy. Connector cross-origin requests don't show up in the page's inspector panel, so I'm not sure how to figure out which it is.

I don't know much about the Safari Connector, but there's no obvious reason for this particular request to be processed as cross-origin, either - it's the same domain.

I haven't tried updating the translator to use async request methods.

adomasven commented 4 weeks ago

The most straightforward way to troubleshoot this is to put a breakpoint at https://github.com/zotero/zotero-connectors/blob/7eeb5464c5089d1bb66f43605f3e5127348fcf92/src/common/http.js#L136.

You can open the background page for safari under Develop -> Macbook Air [computer name] -> Zotero Connector JSContext. To debug the swift part of the extension you need to build it in xcode. Either way, neither should be required for this, but putting it out there for posterity.