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

Side by Side Diff: Source/devtools/front_end/extensions/ExtensionServer.js

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 allHeaders[name] = headers[name]; 221 allHeaders[name] = headers[name];
222 } 222 }
223 } 223 }
224 NetworkAgent.setExtraHTTPHeaders(allHeaders); 224 NetworkAgent.setExtraHTTPHeaders(allHeaders);
225 }, 225 },
226 226
227 _onApplyStyleSheet: function(message) 227 _onApplyStyleSheet: function(message)
228 { 228 {
229 if (!Runtime.experiments.isEnabled("applyCustomStylesheet")) 229 if (!Runtime.experiments.isEnabled("applyCustomStylesheet"))
230 return; 230 return;
231 var styleSheet = document.createElement("style"); 231 var styleSheet = createElement("style");
232 styleSheet.textContent = message.styleSheet; 232 styleSheet.textContent = message.styleSheet;
233 document.head.appendChild(styleSheet); 233 document.head.appendChild(styleSheet);
234 }, 234 },
235 235
236 _onCreatePanel: function(message, port) 236 _onCreatePanel: function(message, port)
237 { 237 {
238 var id = message.id; 238 var id = message.id;
239 // The ids are generated on the client API side and must be unique, so t he check below 239 // The ids are generated on the client API side and must be unique, so t he check below
240 // shouldn't be hit unless someone is bypassing the API. 240 // shouldn't be hit unless someone is bypassing the API.
241 if (id in this._clientObjects || WebInspector.inspectorView.hasPanel(id) ) 241 if (id in this._clientObjects || WebInspector.inspectorView.hasPanel(id) )
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 if (!originMatch) { 798 if (!originMatch) {
799 console.error("Skipping extension with invalid URL: " + startPag e); 799 console.error("Skipping extension with invalid URL: " + startPag e);
800 return false; 800 return false;
801 } 801 }
802 var extensionOrigin = originMatch[1]; 802 var extensionOrigin = originMatch[1];
803 if (!this._registeredExtensions[extensionOrigin]) { 803 if (!this._registeredExtensions[extensionOrigin]) {
804 // See ExtensionAPI.js for details. 804 // See ExtensionAPI.js for details.
805 InspectorFrontendHost.setInjectedScriptForOrigin(extensionOrigin , buildExtensionAPIInjectedScript(extensionInfo)); 805 InspectorFrontendHost.setInjectedScriptForOrigin(extensionOrigin , buildExtensionAPIInjectedScript(extensionInfo));
806 this._registeredExtensions[extensionOrigin] = { name: name }; 806 this._registeredExtensions[extensionOrigin] = { name: name };
807 } 807 }
808 var iframe = document.createElement("iframe"); 808 var iframe = createElement("iframe");
809 iframe.src = startPage; 809 iframe.src = startPage;
810 iframe.style.display = "none"; 810 iframe.style.display = "none";
811 document.body.appendChild(iframe); 811 document.body.appendChild(iframe);
812 } catch (e) { 812 } catch (e) {
813 console.error("Failed to initialize extension " + startPage + ":" + e); 813 console.error("Failed to initialize extension " + startPage + ":" + e);
814 return false; 814 return false;
815 } 815 }
816 return true; 816 return true;
817 }, 817 },
818 818
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 this.E_FAILED = makeStatus.bind(null, "E_FAILED", "Operation failed: %s"); 1083 this.E_FAILED = makeStatus.bind(null, "E_FAILED", "Operation failed: %s");
1084 } 1084 }
1085 1085
1086 /** 1086 /**
1087 * @typedef {{code: string, description: string, details: !Array.<*>}} 1087 * @typedef {{code: string, description: string, details: !Array.<*>}}
1088 */ 1088 */
1089 WebInspector.ExtensionStatus.Record; 1089 WebInspector.ExtensionStatus.Record;
1090 1090
1091 WebInspector.extensionAPI = {}; 1091 WebInspector.extensionAPI = {};
1092 defineCommonExtensionSymbols(WebInspector.extensionAPI); 1092 defineCommonExtensionSymbols(WebInspector.extensionAPI);
OLDNEW
« no previous file with comments | « Source/devtools/front_end/extensions/ExtensionPanel.js ('k') | Source/devtools/front_end/extensions/ExtensionView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698