Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: chrome/common/extensions/docs/experimental.devtools.inspectedWindow.html

Issue 8497027: This includes small updates to the inspectedWindow.html documentation. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/docs/static/experimental.devtools.inspectedWindow.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc. Note: 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc. Note:
2 1) The <head> information in this page is significant, should be uniform 2 1) The <head> information in this page is significant, should be uniform
3 across api docs and should be edited only with knowledge of the 3 across api docs and should be edited only with knowledge of the
4 templating mechanism. 4 templating mechanism.
5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a
6 browser, it will be re-generated from the template, json schema and 6 browser, it will be re-generated from the template, json schema and
7 authored overview content. 7 authored overview content.
8 4) The <body>.innerHTML is also generated by an offline step so that this 8 4) The <body>.innerHTML is also generated by an offline step so that this
9 page may easily be indexed by search engines. 9 page may easily be indexed by search engines.
10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head>
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 <div class="g-unit" id="gc-pagecontent"> 292 <div class="g-unit" id="gc-pagecontent">
293 <div id="pageTitle"> 293 <div id="pageTitle">
294 <h1 class="page_title">chrome.experimental.devtools.inspectedWindow.* AP Is</h1> 294 <h1 class="page_title">chrome.experimental.devtools.inspectedWindow.* AP Is</h1>
295 </div> 295 </div>
296 <!-- TABLE OF CONTENTS --> 296 <!-- TABLE OF CONTENTS -->
297 <div id="toc"> 297 <div id="toc">
298 <h2>Contents</h2> 298 <h2>Contents</h2>
299 <ol> 299 <ol>
300 <li> 300 <li>
301 <a href="#H2-0">Notes</a> 301 <a href="#H2-0">Overview</a>
302 <ol> 302 <ol>
303 <li style="display: none; "> 303 <li style="display: none; ">
304 <a>h3Name</a> 304 <a>h3Name</a>
305 </li> 305 </li>
306 </ol> 306 </ol>
307 </li><li> 307 </li><li>
308 <a href="#overview-examples">Examples</a> 308 <a href="#overview-examples">Examples</a>
309 <ol> 309 <ol>
310 <li style="display: none; "> 310 <li style="display: none; ">
311 <a>h3Name</a> 311 <a>h3Name</a>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 <!-- Standard content lead-in for experimental API pages --> 382 <!-- Standard content lead-in for experimental API pages -->
383 <p id="classSummary"> 383 <p id="classSummary">
384 For information on how to use experimental APIs, see the <a href="expe rimental.html">chrome.experimental.* APIs</a> page. 384 For information on how to use experimental APIs, see the <a href="expe rimental.html">chrome.experimental.* APIs</a> page.
385 </p> 385 </p>
386 386
387 <!-- STATIC CONTENT PLACEHOLDER --> 387 <!-- STATIC CONTENT PLACEHOLDER -->
388 <div id="static"><div id="pageData-name" class="pageData">chrome.experim ental.devtools.inspectedWindow.* APIs</div> 388 <div id="static"><div id="pageData-name" class="pageData">chrome.experim ental.devtools.inspectedWindow.* APIs</div>
389 389
390 <p> 390 <p>
391 Use <code>chrome.experimental.devtools.inspectedWindow</code> to interact with 391 Use <code>chrome.experimental.devtools.inspectedWindow</code>
392 the inspected window: obtain tab ID for the inspected page, evaluate the code 392 to interact with the inspected window:
393 in the context of inspected window, reload the page. 393 obtain the tab ID for the inspected page,
394 evaluate the code in the context of inspected window,
395 reload the page,
396 or obtain the list of resources within the page.
394 </p><p> 397 </p><p>
395 See <a href="experimental.devtools.html">DevTools APIs summary</a> for 398 See <a href="experimental.devtools.html">DevTools APIs summary</a> for
396 general introduction to using Developer Tools APIs. 399 general introduction to using Developer Tools APIs.
397 </p> 400 </p>
398 401
399 <a name="H2-0"></a><h2>Notes</h2> 402 <a name="H2-0"></a><h2>Overview</h2>
400 <p> 403 <p>
401 The <a href="#property-tabId"><code>tabId</code></a> property 404 The <a href="#property-tabId"><code>tabId</code></a> property
402 provides tab identifier that may be used with the <a href="tabs.html"> 405 provides the tab identifier that you can use with the
403 <code>chrome.tabs.*</code></a> API calls. 406 <a href="tabs.html"><code>chrome.tabs.*</code></a> API calls.
404 However, please note that <code>chrome.tabs.*</code> API is not 407 However, please note that <code>chrome.tabs.*</code> API is not
405 exposed to the Developer Tools extension pages due to security considerations 408 exposed to the Developer Tools extension pages due to security considerations
406 — you will need to pass the tab ID to the background page and invoke 409 — you will need to pass the tab ID to the background page and invoke
407 the <code>chrome.tabs.*</code> API functions from there. 410 the <code>chrome.tabs.*</code> API functions from there.
408 </p><p></p> 411 </p>
412 <p>
409 The <code>eval()</code> method provides the ability for extensions to execute 413 The <code>eval()</code> method provides the ability for extensions to execute
410 JavaScript code in the context of the main frame of the inspected page. 414 JavaScript code in the context of the main frame of the inspected page.
411 This method is different from 415 This method is powerful when used in the right context
412 <code>chrome.tabs.executeScript()</code> in the following aspects: 416 and dangerous when used inappropriately.
413 <p></p><ul> 417 Use the <code>chrome.tabs.executeScript()</code> method
418 unless you need the specific functionality
419 that the <code>eval()</code> method provides.
420 </p>
421 <p>Here are the main differences between the
422 <code>eval()</code> and <code>chrome.tabs.executeScript()</code> methods:
423 </p><ul>
414 <li>The <code>eval()</code> method does not 424 <li>The <code>eval()</code> method does not
415 use an isolated world for the code being evaluated, so the JavaScript state 425 use an isolated world for the code being evaluated, so the JavaScript state
416 of the inspected window is accessible to the code. 426 of the inspected window is accessible to the code.
427 Use this method when access to the JavaScript state of the inspected page
428 is required.
429 </li><li>
430 The execution context of the code being evaluated includes the
431 <a href="http://code.google.com/chrome/devtools/docs/console.html">Developer
432 Tools console API</a>.
433 For example,
434 the code can use <code>inspect()</code> and <code>$0</code>.
417 </li><li> 435 </li><li>
418 The evaluated code may return a value that is passed to the extension callback. 436 The evaluated code may return a value that is passed to the extension callback.
419 The returned value has to be a valid JSON object (i.e. may contain only 437 The returned value has to be a valid JSON object (it may contain only
420 primitive JavaScript types and acyclic references to other JSON 438 primitive JavaScript types and acyclic references to other JSON
421 objects). 439 objects).
422 440
423 <em>Please observe extra care while processing the data received from the 441 <em>Please observe extra care while processing the data received from the
424 inspected page — the execution context is essentially controlled by the 442 inspected page — the execution context is essentially controlled by the
425 inspected page; a malicious page may affect the data being returned to the 443 inspected page; a malicious page may affect the data being returned to the
426 extension.</em> 444 extension.</em>
427 </li><li> 445 </li></ul>
428 The execution context of the code being evaluated includes the
429 <a href="http://code.google.com/chrome/devtools/docs/console.html">Developer
430 Tools console API</a> (e.g. <code>inspect()</code>, <code>$0</code> etc).
431 </li>
432 </ul>
433 <p class="caution"> 446 <p class="caution">
434 <strong>Important:</strong> 447 <strong>Important:</strong>
435 Due to the security considerations explained above, the 448 Due to the security considerations explained above, the
436 <a href="tabs.html#method-executeScript"><code>chrome.tabs.executeScript()</code ></a> method is the preferred way for an 449 <a href="tabs.html#method-executeScript"><code>chrome.tabs.executeScript()</code ></a> method is the preferred way for an
437 extension to access DOM data of the inspected page in cases where the access to 450 extension to access DOM data of the inspected page in cases where the access to
438 JavaScript state of the inspected page is not required. 451 JavaScript state of the inspected page is not required.
439 </p><p> 452 </p><p>
440 The <code>reload()</code> method may be used to reload the inspected page. 453 The <code>reload()</code> method may be used to reload the inspected page.
441 Additionally, the caller can specify an override for the user agent string, 454 Additionally, the caller can specify an override for the user agent string,
442 a script that will be injected early upon page load, and an option to force 455 a script that will be injected early upon page load, and an option to force
443 reload of cached resources. 456 reload of cached resources.
444 </p><p> 457 </p><p>
445 Use the <code>getResources()</code> call and the <code>onResourceContent</code> 458 Use the <code>getResources()</code> call and the <code>onResourceContent</code>
446 event to obtain the list of resources (documents, stylesheets, scripts, images 459 event to obtain the list of resources (documents, stylesheets, scripts, images
447 etc) within the inspected page. The <code>getContent()</code> and <code>setConte nt()</code> methods of the <code>Resource</code> class along with the 460 etc) within the inspected page. The <code>getContent()</code> and <code>setConte nt()</code> methods of the <code>Resource</code> class along with the
448 <code>onResourceContentCommitted</code> event may be used to support 461 <code>onResourceContentCommitted</code> event may be used to support
449 modification of the resource content, e.g. by an external editor. 462 modification of the resource content, for example, by an external editor.
450 </p> 463 </p>
451 464
452 <h2 id="overview-examples">Examples</h2> 465 <h2 id="overview-examples">Examples</h2>
453 <p>The following code checks for the version of jQuery used by the inspected 466 <p>The following code checks for the version of jQuery used by the inspected
454 page: 467 page:
455 468
456 </p><pre>chrome.experimental.devtools.inspectedWindow.eval( 469 </p><pre>chrome.experimental.devtools.inspectedWindow.eval(
457 "jQuery.fn.jquery", 470 "jQuery.fn.jquery",
458 function(result, isException) { 471 function(result, isException) {
459 if (isException) 472 if (isException)
(...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after
2462 _uff=0; 2475 _uff=0;
2463 urchinTracker(); 2476 urchinTracker();
2464 } 2477 }
2465 catch(e) {/* urchinTracker not available. */} 2478 catch(e) {/* urchinTracker not available. */}
2466 </script> 2479 </script>
2467 <!-- end analytics --> 2480 <!-- end analytics -->
2468 </div> 2481 </div>
2469 </div> <!-- /gc-footer --> 2482 </div> <!-- /gc-footer -->
2470 </div> <!-- /gc-container --> 2483 </div> <!-- /gc-container -->
2471 </body></html> 2484 </body></html>
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/static/experimental.devtools.inspectedWindow.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698