Bug 1777661 - Always expose "proxable" IDB interfaces r=twisniewski,asuth

This fixes websites using jakearchibald/idb@v3 which has been downloaded 1 million times in NPM (https://www.npmjs.com/package/idb).

The library creates proxies for those interfaces while assuming those are always globally available, and we get an `undefined identifier` error if those don't exist.

Only the version 3 is affected and v4+ is okay per my testing, but v3 is downloaded too many times to ignore.

Differential Revision: https://phabricator.services.mozilla.com/D151086
This commit is contained in:
Kagami Sascha Rosylight 2022-07-07 19:45:29 +00:00
Родитель dc7ac912b3
Коммит da08d29db4
6 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -20,16 +20,19 @@ function checkCaches(content, expected) {
function checkIDB(content, expected) {
check(content, expected, "indexedDB");
check(content, expected, "IDBCursor");
check(content, expected, "IDBDatabase");
check(content, expected, "IDBFactory");
check(content, expected, "IDBIndex");
check(content, expected, "IDBKeyRange");
check(content, expected, "IDBObjectStore");
check(content, expected, "IDBOpenDBRequest");
check(content, expected, "IDBRequest");
check(content, expected, "IDBTransaction");
check(content, expected, "IDBVersionChangeEvent");
// These are always accessed by jakearchibald/idb@v3 without existence checks.
// https://github.com/jakearchibald/idb/blob/e1c7c44dbba38415745afc782b8e247da8c833f2/lib/idb.mjs#L152
check(content, true, "IDBCursor");
check(content, true, "IDBDatabase");
check(content, true, "IDBIndex");
check(content, true, "IDBObjectStore");
check(content, true, "IDBTransaction");
}
function checkSW(content, expected) {

Просмотреть файл

@ -14,7 +14,7 @@ enum IDBCursorDirection {
"prevunique"
};
[Exposed=(Window,Worker), Func="IDBFactory::IsEnabled"]
[Exposed=(Window,Worker)]
interface IDBCursor {
readonly attribute (IDBObjectStore or IDBIndex) source;

Просмотреть файл

@ -10,7 +10,7 @@
* liability, trademark and document use rules apply.
*/
[Exposed=(Window,Worker), Func="IDBFactory::IsEnabled"]
[Exposed=(Window,Worker)]
interface IDBDatabase : EventTarget {
readonly attribute DOMString name;
readonly attribute unsigned long long version;

Просмотреть файл

@ -18,7 +18,7 @@ dictionary IDBIndexParameters {
DOMString? locale = null;
};
[Exposed=(Window,Worker), Func="IDBFactory::IsEnabled"]
[Exposed=(Window,Worker)]
interface IDBIndex {
[SetterThrows]
attribute DOMString name;

Просмотреть файл

@ -12,7 +12,7 @@ dictionary IDBObjectStoreParameters {
boolean autoIncrement = false;
};
[Exposed=(Window,Worker), Func="IDBFactory::IsEnabled"]
[Exposed=(Window,Worker)]
interface IDBObjectStore {
[SetterThrows]
attribute DOMString name;

Просмотреть файл

@ -19,7 +19,7 @@ enum IDBTransactionMode {
"versionchange"
};
[Exposed=(Window,Worker), Func="IDBFactory::IsEnabled"]
[Exposed=(Window,Worker)]
interface IDBTransaction : EventTarget {
[Throws]
readonly attribute IDBTransactionMode mode;