Opened 8 years ago

Closed 8 years ago

#1138 closed defect (fixed)

dev xpi loads local files (and runs scripts in them) twice in the browser

Reported by: erazlogo Owned by: simon
Priority: major Milestone: 1.0.8
Component: ingester Version: 1.0
Keywords: Cc: dstillman

Description (last modified by erazlogo)

To test load test page in the browser, then download and load the same page from the file system. The page generates a message with an id--in the second case, the message will appear twice.

Debug output shows first:

zotero(3): Translate: searching for translators for file:///Users/erazlogo/Movies/test.html

then

zotero(3): Translate: searching for translators for /Users/erazlogo/Movies/test.html

View the resulting bizarre behavior in Vertov plugin. I imagine other strange things may happen as well so this probably should be fixed.

Change History (11)

comment:1 Changed 8 years ago by erazlogo

  • Description modified (diff)

comment:2 Changed 8 years ago by erazlogo

  • Summary changed from zotero loads local files (and runs scripts in them) twice in the browser to dev xpi loads local files (and runs scripts in them) twice in the browser

comment:3 Changed 8 years ago by dstillman

(In [3239]) - Disabled some features (images, JS, META redirects, plugins) in the hidden browser -- this may affect some processDocuments()-based translators, but I'd like to see if it's possible to keep this stuff off. Might address #750, "Creating a hidden browser causes a persistent wait cursor", but I haven't checked.

  • Hidden browser wasn't being deleted when getCharsetFromFile() was used outside of attachment code
  • Fixed a couple JS strict errors

This addresses #1138, "dev xpi loads local files (and runs scripts in them) twice in the browser", but it doesn't fix it. The alert no longer appears due to the disabling of scripts, but getCharsetFromFile() is still being called when running detectWeb on local files. I assume this is due to the support for the URL bar importing of local files, but Simon, can we avoid calling getCharsetFromFile() in these cases, since we already have the charset in the (real, non-hidden) browser?

comment:4 Changed 8 years ago by dstillman

  • Component changed from translators to ingester
  • Owner changed from dstillman to simon
  • Status changed from new to assigned

comment:5 Changed 8 years ago by simon

Are we sure we want to do this? I just wrote the code, but I now realize that we only have the charset in the real, non-hidden browser if the Universal Charset Detector is enabled. If we're willing to do two page loads, then we could enable the detector before getCharsetFromFile() loads the file in a hidden browser and revert the pref after the load is finished, but taking the charset from the browser object will make this impossible.

comment:6 Changed 8 years ago by simon

  • Cc dstillman added

comment:7 Changed 8 years ago by dstillman

Elena, are you still getting the problematic Vertov behavior after r3239?

comment:8 Changed 8 years ago by erazlogo

My problem was fixed when the scripts were turned off, thanks! So we can keep the two loads now as far as I am concerned.

comment:9 Changed 8 years ago by dstillman

OK, thanks.

But Simon, for performance reasons, is there a reason we can't do the charset detection at import time rather than at detect time?

comment:10 Changed 8 years ago by erazlogo

Actually, Z 1.5 still produces an echo in Vertov--can you port the fix to 1.5 when you have a chance? It's just that we're demoing Z for an oral history project and we need to show both sync features and Vertov features for the demo... Thx, E.

comment:11 Changed 8 years ago by simon

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [3262]) closes #1138, dev xpi loads local files (and runs scripts in them) twice in the browser

  • only look for a BOM before finding a translator (since this is fast and necessary to read UTF-16)
  • fix UTF-16-related bugs (appeared only with UTF-16 MODS files) but making Zotero.setCharacterSet seek back to the beginning of the file
  • rename Zotero.Utilities.Ingester to Zotero.Utilities.Translate
  • all Zotero.Translate modes get the same utilties in the sandbox (fixes bugs introduced by r3261)
  • use appropriate debug levels in translate.js and delete extraneous debug code in exportOptions.js
Note: See TracTickets for help on using tickets.