summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/experimental.devtools.inspectedWindow.html
diff options
context:
space:
mode:
authorcaseq@google.com <caseq@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-01 18:23:36 +0000
committercaseq@google.com <caseq@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-01 18:23:36 +0000
commit80d4717057c16dba9ff2e629b85022603252b031 (patch)
tree2fd141ed2db47fb0ea6503da0d98b215e02f583a /chrome/common/extensions/docs/experimental.devtools.inspectedWindow.html
parentced4b5462001a474781e626c53d0aa436e644025 (diff)
downloadchromium_src-80d4717057c16dba9ff2e629b85022603252b031.zip
chromium_src-80d4717057c16dba9ff2e629b85022603252b031.tar.gz
chromium_src-80d4717057c16dba9ff2e629b85022603252b031.tar.bz2
Added docs for chrome.experimental.devtools.inspectedWindow
BUG=none TEST=none Review URL: http://codereview.chromium.org/7468001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94939 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs/experimental.devtools.inspectedWindow.html')
-rw-r--r--chrome/common/extensions/docs/experimental.devtools.inspectedWindow.html390
1 files changed, 319 insertions, 71 deletions
diff --git a/chrome/common/extensions/docs/experimental.devtools.inspectedWindow.html b/chrome/common/extensions/docs/experimental.devtools.inspectedWindow.html
index b1d645c..e662d7e 100644
--- a/chrome/common/extensions/docs/experimental.devtools.inspectedWindow.html
+++ b/chrome/common/extensions/docs/experimental.devtools.inspectedWindow.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="js/api_page_generator.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/sidebar.js"></script>
- <title>experimental.webInspector.inspectedWindow - Google Chrome Extensions - Google Code</title></head>
+ <title>chrome.experimental.devtools.inspectedWindow.* APIs - Google Chrome Extensions - Google Code</title></head>
<body> <div id="gc-container" class="labs">
<div id="devModeWarning">
You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
@@ -251,28 +251,35 @@
<div class="g-unit" id="gc-pagecontent">
<div id="pageTitle">
- <h1 class="page_title">experimental.webInspector.inspectedWindow</h1>
+ <h1 class="page_title">chrome.experimental.devtools.inspectedWindow.* APIs</h1>
</div>
<!-- TABLE OF CONTENTS -->
<div id="toc">
<h2>Contents</h2>
<ol>
- <li style="display: none; ">
- <a>h2Name</a>
+ <li>
+ <a href="#H2-0">Notes</a>
<ol>
- <li>
+ <li style="display: none; ">
+ <a>h3Name</a>
+ </li>
+ </ol>
+ </li><li>
+ <a href="#overview-examples">Examples</a>
+ <ol>
+ <li style="display: none; ">
<a>h3Name</a>
</li>
</ol>
</li>
<li>
- <a href="#apiReference">API reference: experimental.webInspector.inspectedWindow</a>
+ <a href="#apiReference">API reference: chrome.experimental.devtools.inspectedWindow</a>
<ol>
- <li style="display: none; ">
+ <li>
<a href="#properties">Properties</a>
<ol>
<li>
- <a href="#property-anchor">propertyName</a>
+ <a href="#property-tabId">tabId</a>
</li>
</ol>
</li>
@@ -281,18 +288,16 @@
<ol>
<li>
<a href="#method-eval">eval</a>
+ </li><li>
+ <a href="#method-reload">reload</a>
</li>
</ol>
</li>
- <li>
- <a href="#global-events">Events</a>
+ <li style="display: none; ">
+ <a>Events</a>
<ol>
<li>
- <a href="#event-onDOMContentLoaded">onDOMContentLoaded</a>
- </li><li>
- <a href="#event-onLoaded">onLoaded</a>
- </li><li>
- <a href="#event-onNavigated">onNavigated</a>
+ <a href="#event-anchor">eventName</a>
</li>
</ol>
</li>
@@ -311,32 +316,174 @@
<!-- /TABLE OF CONTENTS -->
<!-- Standard content lead-in for experimental API pages -->
- <p id="classSummary" style="display: none; ">
+ <p id="classSummary">
For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page.
</p>
<!-- STATIC CONTENT PLACEHOLDER -->
- <div id="static"></div>
+ <div id="static"><div id="pageData-name" class="pageData">chrome.experimental.devtools.inspectedWindow.* APIs</div>
+
+<p>
+Use <code>chrome.experimental.devtools.inspectedWindow</code> to interact with
+the inspected window: obtain tab ID for the inspected page, evaluate the code
+in the context of inspected window, reload the page.
+</p><p>
+See <a href="experimental.devtools.html">DevTools APIs summary</a> for
+general introduction to using Developer Tools APIs.
+</p>
+
+<a name="H2-0"></a><h2>Notes</h2>
+<p>
+The <a href="#property-tabId"><code>tabId</code></a> property
+provides tab identifier that may be used with the <a href="tabs.html">
+<code>chrome.tabs.*</code></a> API calls.
+However, please note that <code>chrome.tabs.*</code> API is not
+exposed to the Developer Tools extension pages due to security considerations
+— you will need to pass the tab ID to the background page and invoke
+the <code>chrome.tabs.*</code> API functions from there.
+</p><p></p>
+The <code>eval()</code> provides the ability for extensions to execute
+JavaScript code in the context of the main frame of the inspected page.
+This function is different from
+<code>chrome.tabs.executeScript()</code> in the following aspects:
+<p></p><ul>
+<li>The <code>eval()</code> does not
+use an isolated world for the code being evaluated, so the JavaScript state
+of the inspected window is accessible to the code.
+</li><li>
+The evaluated code may return a value that is passed to the extension callback.
+The returned value has to be a valid JSON object (i.e. may contain only
+primitive JavaScript types and acyclic references to other JSON
+objects).
+
+<em>Please observe extra care while processing the data received from the
+inspected page — the execution context is essentially controlled by the
+inspected page; a malicious page may affect the data being returned to the
+extension.</em>
+</li><li>
+The execution context of the code being evaluated includes the
+<a href="http://code.google.com/chrome/devtools/docs/console.html">Developer
+Tools console API</a> (e.g. <code>inspect()</code>, <code>$0</code> etc).
+</li>
+</ul>
+<p class="caution">
+<strong>Important:</strong>
+Due to the security considerations explained above,
+<a href="tabs.html#method-executeScript"><code>chrome.tabs.executeScript()</code></a> is the preferred way for an extension
+to access DOM data of the inspected page in cases where the access to
+JavaScript state of the inspected page is not required.
+</p><p>
+The <code>reload()</code> may be used to reload the inspected page.
+Additionally, a user agent string may be specifcied, which will cause Chrome
+to use the given string in the User-Agent HTTP header while fetching the page
+and its resources, and return it to the scripts running in that page.
+</p>
+
+<h2 id="overview-examples">Examples</h2>
+<p>The following code checks for the version of jQuery used by the inspected
+page:
+
+</p><pre>chrome.experimental.devtools.inspectedWindow.eval(
+ "jQuery.fn.jquery",
+ function(result, isException) {
+ if (isException)
+ console.log("the page is not using jQuery");
+ else
+ console.log("The page is using jQuery v" + result);
+ }
+);
+</pre>
+
+<p>
+You can find more examples that use Developer Tools APIs in
+<a href="samples.html#devtools">Samples</a>.
+</p>
+</div>
<!-- API PAGE -->
<div class="apiPage">
<a name="apiReference"></a>
- <h2>API reference: experimental.webInspector.inspectedWindow</h2>
+ <h2>API reference: chrome.experimental.devtools.inspectedWindow</h2>
<!-- PROPERTIES -->
- <div class="apiGroup" style="display: none; ">
+ <div class="apiGroup">
<a name="properties"></a>
<h3 id="properties">Properties</h3>
<div>
- <a></a>
- <h4>getLastError</h4>
+ <a name="property-tabId"></a>
+ <h4>tabId</h4>
<div class="summary">
<!-- Note: intentionally longer 80 columns -->
- <span>chrome.extension</span><span>lastError</span>
+ <span>chrome.experimental.devtools.inspectedWindow.</span><span>tabId</span>
</div>
<div>
+ <dt>
+ <var>tabId</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span class="enum" style="display: none; ">enumerated</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>integer</span>
+ <span style="display: none; "></span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The ID of the tab being inspected. This ID may be used with chrome.tabs.* API.</dd>
+ <dd style="display: none; ">
+ This parameter was added in version
+ <b><span></span></b>.
+ You must omit this parameter in earlier versions,
+ and you may omit it in any version. If you require this
+ parameter, the manifest key
+ <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
+ can ensure that your extension won't be run in an earlier browser version.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
</div>
+ </dl>
+ </dd>
+
+ <!-- OBJECT METHODS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- OBJECT EVENT FIELDS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- FUNCTION PARAMETERS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ </div>
</div>
</div> <!-- /apiGroup -->
@@ -353,13 +500,13 @@
<div class="summary"><span style="display: none; ">void</span>
<!-- Note: intentionally longer 80 columns -->
- <span>experimental.webInspector.inspectedWindow.eval</span>(<span class="null"><span style="display: none; ">, </span><span>string</span>
+ <span>chrome.experimental.devtools.inspectedWindow.eval</span>(<span class="null"><span style="display: none; ">, </span><span>string</span>
<var><span>expression</span></var></span><span class="null"><span>, </span><span>function</span>
<var><span>callback</span></var></span>)</div>
<div class="description">
<p class="todo" style="display: none; ">Undocumented.</p>
- <p>Evaluates a JavaScript expression in the context of inspected page (NOTE: the expression must evaluate to a JSON-compliant object, otherwise the exception is thrown)</p>
+ <p>Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown.</p>
<!-- PARAMETERS -->
<h4>Parameters</h4>
@@ -559,7 +706,7 @@
<dd class="todo" style="display: none; ">
Undocumented.
</dd>
- <dd>The result of evaluation</dd>
+ <dd>The result of evaluation.</dd>
<dd style="display: none; ">
This parameter was added in version
<b><span></span></b>.
@@ -678,56 +825,162 @@
</p>
</div> <!-- /description -->
- </div> <!-- /apiItem -->
-
- </div> <!-- /apiGroup -->
-
- <!-- EVENTS -->
- <div id="eventsTemplate" class="apiGroup">
- <a name="global-events"></a>
- <h3>Events</h3>
- <!-- iterates over all events -->
- <div class="apiItem">
- <a name="event-onDOMContentLoaded"></a>
- <h4>onDOMContentLoaded</h4>
+ </div><div class="apiItem">
+ <a name="method-reload"></a> <!-- method-anchor -->
+ <h4>reload</h4>
- <div class="summary">
- <!-- Note: intentionally longer 80 columns -->
- <span class="subdued">experimental.webInspector.inspectedWindow.</span><span>onDOMContentLoaded</span><span class="subdued">.addListener</span>(function(<span></span>) <span class="subdued">{...}</span>);
- </div>
+ <div class="summary"><span style="display: none; ">void</span>
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.experimental.devtools.inspectedWindow.reload</span>(<span class="optional"><span style="display: none; ">, </span><span>string</span>
+ <var><span>userAgent</span></var></span>)</div>
<div class="description">
<p class="todo" style="display: none; ">Undocumented.</p>
- <p>Fired after DOMContentLoaded event on inspected page is fired.</p>
+ <p>Reloads the inspected page, optionally setting override for the user agent string.</p>
<!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>userAgent</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span class="enum" style="display: none; ">enumerated</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ <span style="display: none; "></span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>A user agent override string.</dd>
+ <dd style="display: none; ">
+ This parameter was added in version
+ <b><span></span></b>.
+ You must omit this parameter in earlier versions,
+ and you may omit it in any version. If you require this
+ parameter, the manifest key
+ <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
+ can ensure that your extension won't be run in an earlier browser version.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+
+ <!-- OBJECT METHODS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- OBJECT EVENT FIELDS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- FUNCTION PARAMETERS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ </div>
+ </div>
+ </dl>
+
+ <!-- RETURNS -->
+ <h4 style="display: none; ">Returns</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ <!-- CALLBACK -->
<div style="display: none; ">
- <h4>Parameters</h4>
+ <div>
+ <h4>Callback function</h4>
+ <p>
+ The callback <em>parameter</em> should specify a function
+ that looks like this:
+ </p>
+ <p>
+ If you specify the <em>callback</em> parameter, it should
+ specify a function that looks like this:
+ </p>
+
+ <!-- Note: intentionally longer 80 columns -->
+ <pre>function(<span>Type param1, Type param2</span>) <span class="subdued">{...}</span>;</pre>
<dl>
<div>
<div>
</div>
</div>
</dl>
+ </div>
</div>
- </div> <!-- /decription -->
- </div><div class="apiItem">
- <a name="event-onLoaded"></a>
- <h4>onLoaded</h4>
+ <!-- MIN_VERSION -->
+ <p style="display: none; ">
+ This function was added in version <b><span></span></b>.
+ If you require this function, the manifest key
+ <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
+ can ensure that your extension won't be run in an earlier browser version.
+ </p>
+ </div> <!-- /description -->
+
+ </div> <!-- /apiItem -->
+
+ </div> <!-- /apiGroup -->
+
+ <!-- EVENTS -->
+ <div id="eventsTemplate" class="apiGroup" style="display: none; ">
+ <a></a>
+ <h3>Events</h3>
+ <!-- iterates over all events -->
+ <div class="apiItem">
+ <a></a>
+ <h4>event name</h4>
<div class="summary">
<!-- Note: intentionally longer 80 columns -->
- <span class="subdued">experimental.webInspector.inspectedWindow.</span><span>onLoaded</span><span class="subdued">.addListener</span>(function(<span></span>) <span class="subdued">{...}</span>);
+ <span class="subdued">chrome.bookmarks</span><span>onEvent</span><span class="subdued">.addListener</span>(function(<span>Type param1, Type param2</span>) <span class="subdued">{...}</span><span>, Type opt_param1, Type opt_param2</span>));
</div>
<div class="description">
- <p class="todo" style="display: none; ">Undocumented.</p>
- <p>Fired after load event on inspected page is fired.</p>
+ <p class="todo">Undocumented.</p>
+ <p>
+ A description from the json schema def of the event goes here.
+ </p>
- <!-- PARAMETERS -->
- <div style="display: none; ">
- <h4>Parameters</h4>
+ <!-- LISTENER PARAMETERS -->
+ <div>
+ <h4>Listener parameters</h4>
<dl>
<div>
<div>
@@ -735,24 +988,10 @@
</div>
</dl>
</div>
- </div> <!-- /decription -->
-
- </div><div class="apiItem">
- <a name="event-onNavigated"></a>
- <h4>onNavigated</h4>
-
- <div class="summary">
- <!-- Note: intentionally longer 80 columns -->
- <span class="subdued">experimental.webInspector.inspectedWindow.</span><span>onNavigated</span><span class="subdued">.addListener</span>(function(<span></span>) <span class="subdued">{...}</span>);
- </div>
- <div class="description">
- <p class="todo" style="display: none; ">Undocumented.</p>
- <p>Fired when navigation occurs in the window being inspected.</p>
-
- <!-- PARAMETERS -->
- <div style="display: none; ">
- <h4>Parameters</h4>
+ <!-- EXTRA PARAMETERS -->
+ <div>
+ <h4>Extra parameters to addListener</h4>
<dl>
<div>
<div>
@@ -760,8 +999,17 @@
</div>
</dl>
</div>
- </div> <!-- /decription -->
+ <!-- LISTENER RETURN VALUE -->
+ <h4>Listener returns</h4>
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ </div> <!-- /description -->
</div> <!-- /apiItem -->
</div> <!-- /apiGroup -->