Commit graph

145 commits

Author SHA1 Message Date
Dan Stillman
cd2898ece3 Update Bluebird to v2.9.27 2015-06-08 04:05:46 -04:00
Dan Stillman
a22c4969e6 Move editable and filesEditable props to libraries table [DB reupgrade]
And add group.fromJSON(json, userID), which sets editable and
filesEditable properties based on the group JSON (libraryReading, role
lists, etc.) and the given user
2015-06-07 15:50:07 -04:00
Dan Stillman
a740658452 Relations overhaul (requires new DB upgrade from 4.0)
Relations are now properties of collections and items rather than
first-class objects, stored in separate collectionRelations and
itemRelations tables with ids for subjects, with foreign keys to the
associated data objects.

Related items now use dc:relation relations rather than a separate table
(among other reasons, because API syncing won't necessarily sync both
items at the same time, so they can't be stored by id).

The UI assigns related-item relations bidirectionally, and checks for
related-item and linked-object relations are done unidirectionally by
default.

dc:isReplacedBy is now dc:replaces, so that the subject is an existing
object, and the predicate is now named
Zotero.Attachments.replacedItemPredicate.

Some additional work is still needed, notably around following
replaced-item relations, and migration needs to be tested more fully,
but this seems to mostly work.
2015-06-01 20:28:30 -04:00
Dan Stillman
5ba344516e Update PDF tool handling in tests
The test runner now downloads and caches the PDF tools for the current
platform within the test data directory and only redownloads them when
out of date, and it updates the download URL so that the full-text code
pulls from the cache directory via a file:// URL.

The installPDFTools() support function now installs the files directly
instead of going through the prefs, and a new uninstallPDFTools()
function removes the tools. Since the presence of the PDF tools can
affect other tests, tests that need the tools should install them in a
before() and uninstall them in an after(), leaving most tests to run
without PDF indexing.

This also adds a callback to the waitForWindow() support function. If a
modal dialog is opened, it blocks the next promise handler from running,
so a callback has to be used to interact with and close the dialog
immediately.
2015-05-31 23:50:26 -04:00
Dan Stillman
6b87c641d9 Experimental approach to cancelling unnecessary promises
If a view or other resources are destroyed while a promise is being
resolved, subsequent code can fail. This is generally harmless, but it
results in unnecessary errors being logged to the console.

To address this, promises can use a new function,
Zotero.Promise.check(), to test whether a value is truthy or 0 and
automatically throw a specific error that's ignored by the unhandled
rejection handler if not.

Example usage:

getAsync().tap(() => Zotero.Promise.check(this.win));

If this.win is cleaned up while getAsync() is being resolved, subsequent
lines won't be run, and nothing will be logged to the console.
2015-05-23 04:43:37 -04:00
Dan Stillman
eee0e22bf6 Add 'version' to sync cache primary key
The sync cache will have pristine copies of the existing versions of
local objects for better conflict resolution, but downloads will get
saved to the sync cache first before processing, so the cache needs to
be able to hold more than one version.
2015-05-19 01:25:31 -04:00
Dan Stillman
daad18c1b5 Include running function in current count in ConcurrentCaller log line 2015-05-15 01:47:20 -04:00
Dan Stillman
aa70e60fc6 Add clearTimeout() implementation to Bluebird
Necessary for cancellable promises
2015-05-10 18:30:06 -04:00
Dan Stillman
574f636683 Call next function in finally block in ConcurrentCaller 2015-05-05 02:58:22 -04:00
Dan Stillman
43a2045aec Change computerProgram 'version' to 'versionNumber'
And use 'version' instead of 'itemVersion' for object version for items

Also add deferred foreign key checking to system.sql so that DROP TABLE
commands don't fail mid-transaction
2015-05-04 02:45:53 -04:00
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