aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/indexeddb_api
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 21:46:22 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 21:46:22 -0500
commita065e04d529da1d847b5062a12c46d916408bf32 (patch)
treefe0f8bcec1ff39a3c499a2708222dcf15224ff70 /files/zh-cn/web/api/indexeddb_api
parent218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (diff)
downloadtranslated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.gz
translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.bz2
translated-content-a065e04d529da1d847b5062a12c46d916408bf32.zip
update based on https://github.com/mdn/yari/issues/2028
Diffstat (limited to 'files/zh-cn/web/api/indexeddb_api')
-rw-r--r--files/zh-cn/web/api/indexeddb_api/using_indexeddb_in_chrome/index.html27
1 files changed, 0 insertions, 27 deletions
diff --git a/files/zh-cn/web/api/indexeddb_api/using_indexeddb_in_chrome/index.html b/files/zh-cn/web/api/indexeddb_api/using_indexeddb_in_chrome/index.html
deleted file mode 100644
index d9d9aa2cbf..0000000000
--- a/files/zh-cn/web/api/indexeddb_api/using_indexeddb_in_chrome/index.html
+++ /dev/null
@@ -1,27 +0,0 @@
----
-title: Using IndexedDB in chrome
-slug: Web/API/IndexedDB_API/Using_IndexedDB_in_chrome
-translation_of: Mozilla/Tech/XPCOM/Using_IndexedDB_in_chrome
----
-<p>indexedDB API 通常被用来在用户的浏览器端存储来自JavaScript的数据。(点击 <a href="/en-US/docs/IndexedDB/Using_IndexedDB" title="/en-US/docs/IndexedDB/Using_IndexedDB">Using IndexedDB</a> 复习)。然而,使用system-privileged JavaScript的 <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.importGlobalProperties">Components.utils.importGlobalProperties()</a> </code>函数也能获取这些API:</p>
-
-<pre class="brush: js">Components.utils.importGlobalProperties(["indexedDB"]);
-
-// From here on, it's like using IndexedDB from content
-var req = indexedDB.open("my-database");
-// ...</pre>
-
-<p>如果你要创建一个 sandbox ,并且打算<code>在sandbox中使用indexedDB,那么在</code> <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.Sandbox">Sandbox</a></code> 的构造函数中使用 <code>wantGlobalProperties配置项:</code></p>
-
-<pre class="brush: js">var options = {
- "wantGlobalProperties": ["indexedDB"]
-}
-var principal = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal);
-var sandbox = Components.utils.Sandbox(principal, options);
-
-// The sandbox will have access to indexedDB
-var sandboxScript = 'var req = indexedDB.open("my-database");';
-Components.utils.evalInSandbox(sandboxScript, sandbox);
-</pre>
-
-<p>在Firefox 33之前,你可能要使用<code>nsIIndexedDatabaseManager的initWindowless</code>方法,从chrome的代码中方法获取indexedDB。这种方法在Firefox 33时,已经被移除。</p>