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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionAPI.js

Issue 2247253004: Fix window.postMessage deprecation usage Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 this._lastRequestId = 0; 847 this._lastRequestId = 0;
848 this._lastObjectId = 0; 848 this._lastObjectId = 0;
849 849
850 this.registerHandler("callback", this._onCallback.bind(this)); 850 this.registerHandler("callback", this._onCallback.bind(this));
851 851
852 var channel = new MessageChannel(); 852 var channel = new MessageChannel();
853 this._port = channel.port1; 853 this._port = channel.port1;
854 this._port.addEventListener("message", this._onMessage.bind(this), false); 854 this._port.addEventListener("message", this._onMessage.bind(this), false);
855 this._port.start(); 855 this._port.start();
856 856
857 window.parent.postMessage("registerExtension", [ channel.port2 ], "*"); 857 window.parent.postMessage("registerExtension", "*", [ channel.port2 ]);
858 } 858 }
859 859
860 ExtensionServerClient.prototype = { 860 ExtensionServerClient.prototype = {
861 /** 861 /**
862 * @param {!Object} message 862 * @param {!Object} message
863 * @param {function()=} callback 863 * @param {function()=} callback
864 */ 864 */
865 sendRequest: function(message, callback) 865 sendRequest: function(message, callback)
866 { 866 {
867 if (typeof callback === "function") 867 if (typeof callback === "function")
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 { 1011 {
1012 return "(function(injectedScriptId){ " + 1012 return "(function(injectedScriptId){ " +
1013 "var extensionServer;" + 1013 "var extensionServer;" +
1014 defineCommonExtensionSymbols.toString() + ";" + 1014 defineCommonExtensionSymbols.toString() + ";" +
1015 injectedExtensionAPI.toString() + ";" + 1015 injectedExtensionAPI.toString() + ";" +
1016 buildPlatformExtensionAPI(extensionInfo, inspectedTabId, themeName) + "; " + 1016 buildPlatformExtensionAPI(extensionInfo, inspectedTabId, themeName) + "; " +
1017 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + 1017 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" +
1018 "return {};" + 1018 "return {};" +
1019 "})"; 1019 "})";
1020 } 1020 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698