This is a wrapper around the `sqlite3_limit` interface that returns the
binding parameter limit. Adding this getter lets us clean up the inline
`SQLITE_MAX_VARIABLE_NUMBER` constants scattered around Places.
Differential Revision: https://phabricator.services.mozilla.com/D49071
--HG--
extra : moz-landing-system : lando
We want to remove flat strings (JSFlatString). With this patch we only expose
linear strings (JSLinearString) to API consumers.
This is very mechanical for the most part, because code typically only cares
about linear strings and not the null-termination aspect.
CTypes's Library.cpp has some Windows-specific code where we relied on null-terminated
strings. This patch adds JS_CopyStringCharsZ for that use case.
Differential Revision: https://phabricator.services.mozilla.com/D48314
--HG--
extra : moz-landing-system : lando
A low-frequency error that showed up in telemetry for new bookmark
sync is "Storage operation failed with NS_ERROR_CANNOT_CONVERT_DATA",
which occurs when we try to convert a variant to the wrong type. It
would be helpful to include the type and column names for this case;
for example, "Can't get i32 for column lastModified". Neither the type
nor column name are PII; we want them to show up in telemetry.
Differential Revision: https://phabricator.services.mozilla.com/D46433
--HG--
extra : moz-landing-system : lando
This patch adds a fixed-size array of client usages to OriginInfo and modifies
quota tracking APIs to require the client type to be passed in.
A new method ResetUsageForClient is implemented. The method is used during
client-specific origin clearing. ResetUsageForClient is much faster than calling
GetUsageForOrigin and calling DecreaseUsageForOrigin after that.
LockedUsage now has an assertion that verifies that the total sum of client
usages matches total origin usage. This method should be called instead of
touching mUsage directly.
A new assertion is added to GetQuotaObject which verifies that passed file
belongs to the given persistence type, origin, and client.
Differential Revision: https://phabricator.services.mozilla.com/D38028
--HG--
extra : moz-landing-system : lando
This commit updates mozStorage to always:
* Pass the length, using sqlite3_{column, value}_bytes16, when
creating an nsDependentString from a pointer.
* Call sqlite3_{column, value}_bytes{16} after
sqlite3_{column, value}_{text, blob, text16}, per the
recommendation in https://www.sqlite.org/c3ref/column_blob.html.
Some callers did this before, or in unclear order, since C++ doesn't
specify one for evaluating function arguments.
* Pass the byte length to sqlite3_result_text16.
Differential Revision: https://phabricator.services.mozilla.com/D26848
--HG--
extra : moz-landing-system : lando
The `nsresult` codes that mozStorage returns are often too generic. For
example, `NS_ERROR_FAILURE` might be anything from a SQL syntax error
to an invalid column name in a trigger.
This commit adds a `Conn::call_and_wrap_error` helper that checks the
last SQLite error, and returns that instead of `nsresult`. Not all
errors are SQLite errors, however, so we only use this for mozStorage
methods that return `convertResultCode`.
Differential Revision: https://phabricator.services.mozilla.com/D25179
--HG--
extra : moz-landing-system : lando
In retrospect, overloading `Connection::connectionReady` to mean
"is ready _and_ supports this operation" wasn't a good idea. This
commit reverts that change (cfd44c936a9b), and adds two new methods:
* `Connection::operationSupported`, to check if a connection supports
sync or async operations. This method is public.
* `Connection::ensureOperationSupported`, that asserts or returns an
error if the connection doesn't support an operation. This is
private.
`operationSupported` is used by callers like `Service::minimizeMemory`
to detect if the connection supports sync operations, since both sync
and async connections implement `mozIStorageConnection` now.
Finally, some callers used `!mDBConn` to check if the connection was
ready, while others used `connectionReady()`. This commit changes them
to use the latter.
Differential Revision: https://phabricator.services.mozilla.com/D24974
--HG--
extra : moz-landing-system : lando
This commit wraps just enough of the mozStorage API to support the
bookmarks mirror. It's not complete: for example, there's no way
to open, clone, or close a connection, because the mirror handles
that from JS. The wrapper also omits shutdown blocking and retrying on
`SQLITE_BUSY`.
This commit also changes the behavior of sync and async mozStorage
connections. Async (`mozIStorageAsyncConnection`) methods may be called
from any thread on any connection. Sync (`mozIStorageConnection`)
methods may be called from any thread on a sync connection, and from
background threads on an async connection. All connections now QI
to `mozIStorageConnection`, but attempting to call a sync method on
an async connection from the main thread throws.
Finally, this commit exposes an `OpenedConnection::unsafeRawConnection`
getter in Sqlite.jsm, for JS code to access the underlying connection.
Differential Revision: https://phabricator.services.mozilla.com/D20073
--HG--
extra : moz-landing-system : lando
This commit adds a `storage_variant::HashPropertyBag` type that
exposes an idiomatic Rust interface for `nsIWritablePropertyBag`.
Differential Revision: https://phabricator.services.mozilla.com/D21062
--HG--
extra : moz-landing-system : lando
This is a follow-up to the previous part, which actually changes one of
these callers to use Array<nsIIDRef> instead of [array] nsIIDPtr.
From doing this patch, it seems like we should consider changing
the type `nsIIDRef` to instead simply be `nsIID`, and treat it more like
the `AString` types from the POV of XPIDL. `nsIIDPtr` would then
continue to exist for backwards compatibility, but we can probably
remove almost all current consumers over time.
Depends on D19175
Differential Revision: https://phabricator.services.mozilla.com/D19176
--HG--
extra : moz-landing-system : lando
Those tests rely on the build not being a cross-compile, which is fine
most of the time, but more importantly, rely on the fact that the
version of sqlite that Firefox is being built against is the same as the
one it will be running against, which is not likely to be true.
So, all in all, it's better to do the checks at runtime.
And while they could be restricted to when building against system
sqlite, we still run them for in-tree sqlite, to ensure that we actually
built it with the expected options.
Differential Revision: https://phabricator.services.mozilla.com/D18057
--HG--
extra : moz-landing-system : lando
Bug 730495 broke them by moving the code to another directory without
moving the corresponding #define, but it also fixed why this was
disabled in some configurations so we can now just enable when
MOZ_MEMORY is defined (jemalloc used).
Differential Revision: https://phabricator.services.mozilla.com/D18049
--HG--
extra : moz-landing-system : lando
***
Bug 1514594: Part 3a - Change ChromeUtils.import to return an exports object; not pollute global. r=mccr8
This changes the behavior of ChromeUtils.import() to return an exports object,
rather than a module global, in all cases except when `null` is passed as a
second argument, and changes the default behavior not to pollute the global
scope with the module's exports. Thus, the following code written for the old
model:
ChromeUtils.import("resource://gre/modules/Services.jsm");
is approximately the same as the following, in the new model:
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Since the two behaviors are mutually incompatible, this patch will land with a
scripted rewrite to update all existing callers to use the new model rather
than the old.
***
Bug 1514594: Part 3b - Mass rewrite all JS code to use the new ChromeUtils.import API. rs=Gijs
This was done using the followng script:
https://bitbucket.org/kmaglione/m-c-rewrites/src/tip/processors/cu-import-exports.jsm
***
Bug 1514594: Part 3c - Update ESLint plugin for ChromeUtils.import API changes. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D16747
***
Bug 1514594: Part 3d - Remove/fix hundreds of duplicate imports from sync tests. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D16748
***
Bug 1514594: Part 3e - Remove no-op ChromeUtils.import() calls. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D16749
***
Bug 1514594: Part 3f.1 - Cleanup various test corner cases after mass rewrite. r=Gijs
***
Bug 1514594: Part 3f.2 - Cleanup various non-test corner cases after mass rewrite. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D16750
--HG--
extra : rebase_source : 359574ee3064c90f33bf36c2ebe3159a24cc8895
extra : histedit_source : b93c8f42808b1599f9122d7842d2c0b3e656a594%2C64a3a4e3359dc889e2ab2b49461bab9e27fc10a7
Do not require that SQLite has been built with support for custom FTS3
tokenizers enabled by default. This allows to use system SQLite in
distributions which provide SQLite configured in this way (which is SQLite
upstream's default configuration due to security concerns).
Requires exposing the sqlite3_db_config symbol in bundled SQLite.
Disable no longer needed setting of SQLITE_ENABLE_FTS3_TOKENIZER macro in
bundled SQLite build.
This patch slightly speedups origin initialization by having a special column in
the database table for current data usage.
This patch also fixes a problem with length computation of some unicode strings.
- modify line wrap up to 80 chars; (tw=80)
- modify size of tab to 2 chars everywhere; (sts=2, sw=2)
--HG--
extra : rebase_source : 7eedce0311b340c9a5a1265dc42d3121cc0f32a0
extra : amend_source : 9cb4ffdd5005f5c4c14172390dd00b04b2066cd7