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

Side by Side Diff: chrome/common/extensions/docs/examples/api/debugger/live-headers/headers.js

Issue 9289057: Changing manifest to v2 extension samples (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding zip files after rebasing with master Created 8 years, 10 months 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
OLDNEW
1 <!-- 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be
3 Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file.
4 found in the LICENSE file.
5 -->
6
7 <html>
8 <head>
9 <style>
10 body {
11 font-family: monospace;
12 word-wrap: break-word;
13 }
14
15 #container {
16 white-space: pre;
17 }
18
19 .request {
20 border-top: 1px solid black;
21 margin-bottom: 10px;
22 }
23
24 </style>
25
26 <script>
27 4
28 var tabId = parseInt(window.location.search.substring(1)); 5 var tabId = parseInt(window.location.search.substring(1));
29 6
30 window.addEventListener("load", function() { 7 window.addEventListener("load", function() {
31 chrome.debugger.sendCommand({tabId:tabId}, "Network.enable"); 8 chrome.debugger.sendCommand({tabId:tabId}, "Network.enable");
32 chrome.debugger.onEvent.addListener(onEvent); 9 chrome.debugger.onEvent.addListener(onEvent);
33 }); 10 });
34 11
35 window.addEventListener("unload", function() { 12 window.addEventListener("unload", function() {
36 chrome.debugger.detach({tabId:tabId}); 13 chrome.debugger.detach({tabId:tabId});
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 var text = ""; 58 var text = "";
82 for (name in headers) 59 for (name in headers)
83 text += name + ": " + headers[name] + "\n"; 60 text += name + ": " + headers[name] + "\n";
84 var div = document.createElement("div"); 61 var div = document.createElement("div");
85 div.textContent = text; 62 div.textContent = text;
86 return div; 63 return div;
87 } 64 }
88 65
89 function parseURL(url) { 66 function parseURL(url) {
90 var result = {}; 67 var result = {};
91 var match = url.match(/^([^:]+):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*) )?)?$/i); 68 var match = url.match(
69 /^([^:]+):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i);
92 if (!match) 70 if (!match)
93 return result; 71 return result;
94 result.scheme = match[1].toLowerCase(); 72 result.scheme = match[1].toLowerCase();
95 result.host = match[2]; 73 result.host = match[2];
96 result.port = match[3]; 74 result.port = match[3];
97 result.path = match[4] || "/"; 75 result.path = match[4] || "/";
98 result.fragment = match[5]; 76 result.fragment = match[5];
99 return result; 77 return result;
100 } 78 }
101
102 </script>
103 </head>
104
105 <body>
106 <div id="container"></div>
107 </body>
108 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698