Commit graph

135 commits

Author SHA1 Message Date
Dan Stillman
90f4996d9d Remove some excessive error logging from Bluebird
And hide errors from DB transaction rollback tests
2015-04-25 03:17:41 -04:00
Dan Stillman
fec43f1f62 Merge branch '4.0' into api_syncing 2015-04-13 02:01:43 -04:00
Dan Stillman
b599aed8ed Fix pasting of non-HTTP URLs into notes from non-note sources
Copying zotero:// and other non-HTTP links from a note itself was fixed
in #452, but copying such links from other sources still stripped the
hrefs. This removes the patch in #452 and just gets the HTML directly
from the clipboard. I'm not sure why TinyMCE doesn't try to do this by
default (it only tries for plaintext), so maybe there's a problem with
this approach, but it seems to work for me (strips bad HTML, etc.).

Fixes #697
2015-04-10 13:08:25 -04:00
Dan Stillman
a9ca6e0857 Support unmodified Xpdf binaries
Use stdout redirection scripts for pdfinfo and, on Windows, a script to
run pdftotext hidden, which together allow for all unmodified binaries
(including, probably, symlinked system ones, though I didn't test that).

On Windows, using a .vbs does cause a brief wait cursor. The stock
pdfinfo needs the redirection script anyway, so that's unavoidable, but
on the async branch I think we'll be able to switch to pdf.js for the
page count, at which point maybe I'll try to remember how I modified the
Windows binaries to be hidden and use a modified version of pdftotext to
avoid VBScript. (We use the stock pdftotext elsewhere already.)
2015-04-01 04:36:21 -04:00
Dan Stillman
4b83b1a630 Bump version and maxVersion 2015-03-27 19:00:25 -04:00
Dan Stillman
b042973751 Merge branch '4.0' into api_syncing 2015-03-22 19:51:29 -04:00
Dan Stillman
d8f3be4bee updateBundledStyles() asyncification and related changes
- Use async DB and OS.File for bundled file updates
- Remove support for translator/style ZIP files -- the two options are
  now non-unpacked XPIs with subfolders or unpacked source installations
- Now that we have async file access, don't store translator code in
  database cache -- just store metadata so that it's available without
  reading each translator file
- Change the (previously partially asyncified) Zotero.Styles/Translators
  APIs a bit -- while the getAll/getVisible methods are asynchronous and
  will wait for loading, the get() methods are synchronous and require
  styles/translators to be initialized before they're called. Most
  places that end up calling get() probably call getAll/getVisible first
  and should therefore be async, but if there's any way to trigger a
  get() first, that will need to be adjusted.
- Asyncify various other style/translator-related code

XPI support is untested, as is style/translator usage, so there are
almost certainly bugs. The latter depends on updated export format
support (#659), since toArray() no longer exists on this branch.

Addresses #529 and #520
2015-03-22 04:27:25 -04:00
Dan Stillman
faed7cd7dd Replace some 'for each..in' instances
There are hundreds more, but these are all the ones that generate warnings in
the console at startup. XPCOM/XBL ones don't seem to do so, so we can ignore
those for now (and hopefully not bother with them on 4.0). Instances in
translators do generate warnings.

Addresses #656
2015-03-17 15:19:45 -04:00
Dan Stillman
bdd69d0a53 Merge branch '4.0' into api_syncing 2015-03-16 23:41:10 -04:00
Dan Stillman
a03772cae7 Merge branch 'master' into api_syncing
Note that this loses conflicting changes to translate_item.js from 849803473a,
so those will need to be reapplied if applicable. /cc @aurimasv, @mtd91429
2015-03-16 15:23:07 -04:00
Simon Kornblith
b4142342a5 Merge remote-tracking branch 'origin/connector' into 4.0 2015-03-14 18:32:54 -04:00
Simon Kornblith
6a05e5c04b We no longer support Fx <24 2015-03-11 12:05:22 -04:00
Dan Stillman
8371749bd1 Add Zotero.clientName, set to "Zotero" by default
We should eventually replace all hard-coded uses of "Zotero" with this
for use by unofficial versions (which legally can't be called "Zotero").
2015-02-23 03:31:52 -05:00
Dan Stillman
aeb7b83a39 Update versions 2015-02-21 21:52:06 -05:00
Dan Stillman
39ecb7d916 Update translators 2015-02-10 22:52:53 -05:00
Dan Stillman
1afa1ffea6 Update submodules, repotime, and versions 2015-02-10 00:13:42 -05:00
Dan Stillman
0b21c4c682 Still show proper line number when no message is thrown 2015-02-05 19:01:55 -05:00
Dan Stillman
c322eaa1bc Restore Error workaround in Bluebird to produce proper line numbers
I didn't really investigate this, but errors from the outside world seem
to not pass the "obj instanceof Error" test due to some weirdness that
Bluebird is doing. (When I took this out recently I thought we just were
throwing some custom errors that didn't properly extend Error, but that
isn't the issue.) This restores the earlier workaround.
2015-02-05 18:39:43 -05:00
Dan Stillman
91d14fc04c Use 'self' instead of 'global' as global object in Bluebird
This fixes an error when other errors occur in recent versions of Bluebird.
2015-02-03 15:36:01 -05:00
Dan Stillman
d660a84f47 Update Bluebird to 2.9.6 2015-02-03 15:36:01 -05:00
Dan Stillman
b5b85ee589 Update submodules and repotime 2015-01-31 16:06:21 -05:00
Dan Stillman
b0e37a38a2 Merge branch '4.0'
Conflicts:
	chrome/content/zotero/xpcom/schema.js
	chrome/content/zotero/xpcom/translation/translate.js
	chrome/content/zotero/xpcom/zotero.js
	install.rdf
	update.rdf
2015-01-29 19:59:47 -05:00
Dan Stillman
84d1be4c03 ConcurrentCaller tweaks 2015-01-28 17:28:38 -05:00
Dan Stillman
b785a3bfce Dynamically populate charsets table
Instead of limiting charsets to a fixed list, dynamically populate it
with any charset name of less than 50 ASCII characters. Previously,
unknown charsets were discarded.

Zotero.Item.prototype.attachmentCharset now always returns a charset
name. It can be set with either a name or a charsetID.

Also:

- Remove the unused 'originalPath' column in itemAttachments
2015-01-28 17:15:16 -05:00
Dan Stillman
b670084925 Use 'version' for groups instead of 'etag'
APIv3 uses 'version'
2015-01-28 17:05:25 -05:00
Dan Stillman
58c062dd06 Add per-library lastsync times and synced flags for sync delete logs 2015-01-28 15:56:46 -05:00
Dan Stillman
30b5c4686e Update Bluebird to 2.9.3
...with fewer modifications, since one (better debug info on an invalid
yield value) was implemented in Bluebird and the other (detecting a
thrown error that doesn't properly extend Error) we should just fix in
our code.
2015-01-28 15:19:29 -05:00
Dan Stillman
6de3fa4d47 Update translators and repotime 2015-01-14 00:09:40 -07:00
Dan Stillman
0c3332b5e4 Update versions 2015-01-14 00:08:31 -07:00
Dan Stillman
b9fb7fa3c6 Update versions 2015-01-12 23:59:26 -07:00
Dan Stillman
f1a3cb3577 Update versions, submodules, and repotime 2015-01-12 21:54:56 -07:00
Dan Stillman
2d0df16509 Switch WWW_BASE_URL to HTTPS 2014-12-09 20:48:15 -05:00
Dan Stillman
3a058c68ed Use config URL for all repo requests, and move config to separate file 2014-12-09 18:53:53 -05:00
Dan Stillman
d7d542a79c Update version, submodules, and repotime 2014-12-01 02:17:09 -05:00
Dan Stillman
12619273b5 Update submodules and repotime 2014-10-14 03:26:15 -04:00
Dan Stillman
7541106641 Update Bluebird to 2.3.5
Our modifications no longer include a custom yield handler to
automatically call all() on yielded arrays (which maintained Bluebird
1.x behavior). It's now necessary to call all() or similar explicitly.

Also fixed a few incorrect yields hidden by that behavior.
2014-10-09 14:21:10 -04:00
Dan Stillman
755ead2119 Update zotero:// extensions (report, timeline, etc.) for async DB, and more
- Protocol handler extensions can now handle promises and can also make
  data available as it's ready instead of all at once (e.g., reports now
  output one entry at a time)
- zotero:// URL syntaxes are now more consistent and closer to the web
  API (old URLs should work, but some may currently be broken)

Also:

- Code to generate server API, currently available for testing via
  zotero://data URLs but eventually moving to HTTP -- zotero://data URLs match
  web API URLs, with a different prefix for the personal library (/library vs.
  /users/12345)
- Miscellaneous fixes to data objects

Under the hood:

- Extensions now return an AsyncChannel, which is an nsIChannel implementation
  that takes a promise-yielding generator that returns a string,
  nsIAsyncInputStream, or file that will be used for the channel's data
- New function Zotero.Utilities.Internal.getAsyncInputStream() takes a
  generator that yields either promises or strings and returns an async input
  stream filled with the yielded strings
- Zotero.Router parsers URLs and extract parameters
- Zotero.Item.toResponseJSON()
2014-09-09 00:36:29 -04:00
Dan Stillman
490d24f43b Merge branch 'master' into async_db 2014-09-09 00:34:18 -04:00
Dan Stillman
3d7a35addc Merge branch '4.0'
Conflicts:
	chrome/content/zotero/xpcom/zotero.js
	install.rdf
	update.rdf
2014-09-08 20:24:44 -04:00
Dan Stillman
14a5643f38 Update submodules, repotime, versions 2014-09-01 14:56:01 -04:00
Dan Stillman
f5896dbb8d Remove synchronous database methods
This required doing additional caching at startup (e.g., item types and fields)
so that various methods can remain synchronous.

This lets us switch back to using the current Sqlite.jsm. Previously we were
bundling the Fx24 version, which avoided freezes with locking_mode=EXCLUSIVE
with both sync and async queries.

Known broken things:

  - Autocomplete
  - Database backup
  - UDFs (e.g., REGEXP function used in Zotero.DB.getNextName())
2014-08-09 18:10:32 -04:00
Dan Stillman
db0fa3c33e Async DB megacommit
Promise-based rewrite of most of the codebase, with asynchronous database and file access -- see https://github.com/zotero/zotero/issues/518 for details.

WARNING: This includes backwards-incompatible schema changes.

An incomplete list of other changes:

- Schema overhaul
  - Replace main tables with new versions with updated schema
  - Enable real foreign key support and remove previous triggers
  - Don't use NULLs for local libraryID, which broke the UNIQUE index
    preventing object key duplication. All code (Zotero and third-party)
    using NULL for the local library will need to be updated to use 0
    instead (already done for Zotero code)
  - Add 'compatibility' DB version that can be incremented manually to break DB
    compatibility with previous versions. 'userdata' upgrades will no longer
    automatically break compatibility.
  - Demote creators and tags from first-class objects to item properties
- New API syncing properties
  - 'synced'/'version' properties to data objects
  - 'etag' to groups
  - 'version' to libraries
- Create Zotero.DataObject that other objects inherit from
- Consolidate data object loading into Zotero.DataObjects
- Change object reloading so that only the loaded and changed parts of objects are reloaded, instead of reloading all data from the database (with some exceptions, including item primary data)
- Items and collections now have .parentItem and .parentKey properties, replacing item.getSource() and item.getSourceKey()
- New function Zotero.serial(fn), to wrap an async function such that all calls are run serially
- New function Zotero.Utilities.Internal.forEachChunkAsync(arr, chunkSize, func)
- Add tag selector loading message
- Various API and name changes, since everything was breaking anyway

Known broken things:

- Syncing (will be completely rewritten for API syncing)
- Translation architecture (needs promise-based rewrite)
- Duplicates view
- DB integrity check (from schema changes)
- Dragging (may be difficult to fix)

Lots of other big and little things are certainly broken, particularly with the UI, which can be affected by async code in all sorts of subtle ways.
2014-08-06 22:59:37 -04:00
Dan Stillman
b7cba469f0 Add pause() method to ConcurrentCaller
Delay running any new functions for the specified time
2014-08-06 22:14:58 -04:00
Dan Stillman
51713c8030 ConcurrentCaller updates 2014-08-06 22:14:58 -04:00
Dan Stillman
36c5dceff4 Merge branch '4.0'
Conflicts:
	chrome/content/zotero/browser.js
	chrome/content/zotero/longTagFixer.js
	chrome/content/zotero/xpcom/schema.js
	chrome/content/zotero/xpcom/utilities.js
	chrome/content/zotero/xpcom/zotero.js
	install.rdf
	update.rdf
2014-07-15 22:17:27 -04:00
Dan Stillman
9f379c99e0 Update submodules and repotime 2014-06-24 17:48:37 -04:00
Dan Stillman
09e53d85d5 Revert "Revert "Use Q instead of Task.spawn to run processUpdatedXML()""
This reverts commit 4334260865.
2014-06-20 03:47:01 -04:00
Dan Stillman
4334260865 Revert "Use Q instead of Task.spawn to run processUpdatedXML()"
Fixes "Q.async(...)(...) is undefined" sync error

This reverts commit ad8b81f4c7 (which
tried to fix Fx32+ compatibility).
2014-06-20 03:17:03 -04:00
Dan Stillman
b441e2cf9e Update submodules and repotime 2014-06-18 21:12:25 -04:00
Dan Stillman
ad8b81f4c7 Use Q instead of Task.spawn to run processUpdatedXML()
With Task.spawn, regular expressions in Zotero.DB were causing "too much
recursion" errors on Windows with JIT enabled.

This requires a change to Q to allow async() to take a generator instead
of a generator-maker (which is the reason it was using Task.spawn to
begin with).
2014-06-18 05:03:06 -04:00