| Index: Source/core/inspector/InjectedScriptSource.js
|
| diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js
|
| index 6f6cf4021567157befba576e0b2b18f2b215e668..b1d7d0b4660c0687afc843cbc27bd56cec988e4c 100644
|
| --- a/Source/core/inspector/InjectedScriptSource.js
|
| +++ b/Source/core/inspector/InjectedScriptSource.js
|
| @@ -31,10 +31,10 @@
|
|
|
| /**
|
| * @param {!InjectedScriptHostClass} InjectedScriptHost
|
| - * @param {!Window} inspectedWindow
|
| + * @param {!Window|!WorkerGlobalScope} inspectedGlobalObject
|
| * @param {number} injectedScriptId
|
| */
|
| -(function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
|
| +(function (InjectedScriptHost, inspectedGlobalObject, injectedScriptId) {
|
|
|
| /**
|
| * Protect against Object overwritten by the user code.
|
| @@ -244,7 +244,7 @@ function doesAttributeHaveObservableSideEffectOnGet(object, attribute)
|
| {
|
| for (var interfaceName in domAttributesWithObservableSideEffectOnGet) {
|
| var isInstance = InjectedScriptHost.suppressWarningsAndCallFunction(function(object, interfaceName) {
|
| - return /* suppressBlacklist */ typeof inspectedWindow[interfaceName] === "function" && object instanceof inspectedWindow[interfaceName];
|
| + return /* suppressBlacklist */ typeof inspectedGlobalObject[interfaceName] === "function" && object instanceof inspectedGlobalObject[interfaceName];
|
| }, null, [object, interfaceName]);
|
| if (isInstance) {
|
| return attribute in domAttributesWithObservableSideEffectOnGet[interfaceName];
|
| @@ -288,13 +288,13 @@ InjectedScript.prototype = {
|
| /**
|
| * @param {*} object
|
| * @param {string} groupName
|
| - * @param {boolean} canAccessInspectedWindow
|
| + * @param {boolean} canAccessInspectedGlobalObject
|
| * @param {boolean} generatePreview
|
| * @return {!RuntimeAgent.RemoteObject}
|
| */
|
| - wrapObject: function(object, groupName, canAccessInspectedWindow, generatePreview)
|
| + wrapObject: function(object, groupName, canAccessInspectedGlobalObject, generatePreview)
|
| {
|
| - if (canAccessInspectedWindow)
|
| + if (canAccessInspectedGlobalObject)
|
| return this._wrapObject(object, groupName, false, generatePreview);
|
| return this._fallbackWrapper(object);
|
| },
|
| @@ -326,14 +326,14 @@ InjectedScript.prototype = {
|
| },
|
|
|
| /**
|
| - * @param {boolean} canAccessInspectedWindow
|
| + * @param {boolean} canAccessInspectedGlobalObject
|
| * @param {!Object} table
|
| * @param {!Array.<string>|string|boolean} columns
|
| * @return {!RuntimeAgent.RemoteObject}
|
| */
|
| - wrapTable: function(canAccessInspectedWindow, table, columns)
|
| + wrapTable: function(canAccessInspectedGlobalObject, table, columns)
|
| {
|
| - if (!canAccessInspectedWindow)
|
| + if (!canAccessInspectedGlobalObject)
|
| return this._fallbackWrapper(table);
|
| var columnNames = null;
|
| if (typeof columns === "string")
|
| @@ -424,7 +424,7 @@ InjectedScript.prototype = {
|
| var argsArray = /** @type {!Array.<*>} */ (InjectedScriptHost.eval("(" + args + ")"));
|
| var result = InjectedScriptHost.callFunction(this[methodName], this, argsArray);
|
| if (typeof result === "undefined") {
|
| - inspectedWindow.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName);
|
| + inspectedGlobalObject.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName);
|
| result = null;
|
| }
|
| return result;
|
| @@ -740,7 +740,7 @@ InjectedScript.prototype = {
|
| try {
|
|
|
| var remoteObjectAPI = { bindRemoteObject: bind(wrap, this), __proto__: null};
|
| - InjectedScriptHost.setNonEnumProperty(inspectedWindow, "__remoteObjectAPI", remoteObjectAPI);
|
| + InjectedScriptHost.setNonEnumProperty(inspectedGlobalObject, "__remoteObjectAPI", remoteObjectAPI);
|
|
|
| var func = InjectedScriptHost.eval("with (typeof __remoteObjectAPI !== 'undefined' ? __remoteObjectAPI : { __proto__: null }) {(" + expression + ")}");
|
| if (typeof func !== "function")
|
| @@ -753,7 +753,7 @@ InjectedScript.prototype = {
|
| return this._createThrownValue(e, objectGroup, false);
|
| } finally {
|
| try {
|
| - delete inspectedWindow["__remoteObjectAPI"];
|
| + delete inspectedGlobalObject["__remoteObjectAPI"];
|
| } catch(e) {
|
| }
|
| }
|
| @@ -877,19 +877,19 @@ InjectedScript.prototype = {
|
|
|
| var scopeExtensionForEval = (callFrame && injectCommandLineAPI) ? new CommandLineAPI(this._commandLineAPIImpl, callFrame) : undefined;
|
|
|
| - injectCommandLineAPI = !scopeExtensionForEval && !callFrame && injectCommandLineAPI && !("__commandLineAPI" in inspectedWindow);
|
| - var injectScopeChain = scopeChain && scopeChain.length && !("__scopeChainForEval" in inspectedWindow);
|
| + injectCommandLineAPI = !scopeExtensionForEval && !callFrame && injectCommandLineAPI && !("__commandLineAPI" in inspectedGlobalObject);
|
| + var injectScopeChain = scopeChain && scopeChain.length && !("__scopeChainForEval" in inspectedGlobalObject);
|
|
|
| try {
|
| var prefix = "";
|
| var suffix = "";
|
| if (injectCommandLineAPI) {
|
| - InjectedScriptHost.setNonEnumProperty(inspectedWindow, "__commandLineAPI", new CommandLineAPI(this._commandLineAPIImpl, callFrame));
|
| + InjectedScriptHost.setNonEnumProperty(inspectedGlobalObject, "__commandLineAPI", new CommandLineAPI(this._commandLineAPIImpl, callFrame));
|
| prefix = "with (typeof __commandLineAPI !== 'undefined' ? __commandLineAPI : { __proto__: null }) {";
|
| suffix = "}";
|
| }
|
| if (injectScopeChain) {
|
| - InjectedScriptHost.setNonEnumProperty(inspectedWindow, "__scopeChainForEval", scopeChain);
|
| + InjectedScriptHost.setNonEnumProperty(inspectedGlobalObject, "__scopeChainForEval", scopeChain);
|
| for (var i = 0; i < scopeChain.length; ++i) {
|
| prefix = "with (typeof __scopeChainForEval !== 'undefined' ? __scopeChainForEval[" + i + "] : { __proto__: null }) {" + (suffix ? " " : "") + prefix;
|
| if (suffix)
|
| @@ -908,13 +908,13 @@ InjectedScript.prototype = {
|
| } finally {
|
| if (injectCommandLineAPI) {
|
| try {
|
| - delete inspectedWindow["__commandLineAPI"];
|
| + delete inspectedGlobalObject["__commandLineAPI"];
|
| } catch(e) {
|
| }
|
| }
|
| if (injectScopeChain) {
|
| try {
|
| - delete inspectedWindow["__scopeChainForEval"];
|
| + delete inspectedGlobalObject["__scopeChainForEval"];
|
| } catch(e) {
|
| }
|
| }
|
| @@ -1107,10 +1107,10 @@ InjectedScript.prototype = {
|
| delete this._modules[name];
|
| var moduleFunction = InjectedScriptHost.eval("(" + source + ")");
|
| if (typeof moduleFunction !== "function") {
|
| - inspectedWindow.console.error("Web Inspector error: A function was expected for module %s evaluation", name);
|
| + inspectedGlobalObject.console.error("Web Inspector error: A function was expected for module %s evaluation", name);
|
| return null;
|
| }
|
| - var module = /** @type {!Object} */ (InjectedScriptHost.callFunction(moduleFunction, inspectedWindow, [InjectedScriptHost, inspectedWindow, injectedScriptId, this]));
|
| + var module = /** @type {!Object} */ (InjectedScriptHost.callFunction(moduleFunction, inspectedGlobalObject, [InjectedScriptHost, inspectedGlobalObject, injectedScriptId, this]));
|
| this._modules[name] = module;
|
| return module;
|
| },
|
| @@ -1321,11 +1321,11 @@ InjectedScript.RemoteObject.prototype = {
|
| */
|
| function logError(error)
|
| {
|
| - Promise.resolve().then(inspectedWindow.console.error.bind(inspectedWindow.console, "Custom Formatter Failed: " + error.message));
|
| + Promise.resolve().then(inspectedGlobalObject.console.error.bind(inspectedGlobalObject.console, "Custom Formatter Failed: " + error.message));
|
| }
|
|
|
| try {
|
| - var formatters = inspectedWindow["devtoolsFormatters"];
|
| + var formatters = inspectedGlobalObject["devtoolsFormatters"];
|
| if (!formatters || !isArrayLike(formatters))
|
| return null;
|
|
|
| @@ -1689,7 +1689,7 @@ function CommandLineAPI(commandLineAPIImpl, callFrame)
|
| function inScopeVariables(member)
|
| {
|
| if (!callFrame)
|
| - return (member in inspectedWindow);
|
| + return (member in inspectedGlobalObject);
|
|
|
| var scopeChain = callFrame.scopeChain;
|
| for (var i = 0; i < scopeChain.length; ++i) {
|
| @@ -1773,7 +1773,7 @@ CommandLineAPIImpl.prototype = {
|
| if (this._canQuerySelectorOnNode(opt_startNode))
|
| return opt_startNode.querySelector(selector);
|
|
|
| - return inspectedWindow.document.querySelector(selector);
|
| + return inspectedGlobalObject.document.querySelector(selector);
|
| },
|
|
|
| /**
|
| @@ -1785,7 +1785,7 @@ CommandLineAPIImpl.prototype = {
|
| {
|
| if (this._canQuerySelectorOnNode(opt_startNode))
|
| return opt_startNode.querySelectorAll(selector);
|
| - return inspectedWindow.document.querySelectorAll(selector);
|
| + return inspectedGlobalObject.document.querySelectorAll(selector);
|
| },
|
|
|
| /**
|
| @@ -1804,7 +1804,7 @@ CommandLineAPIImpl.prototype = {
|
| */
|
| $x: function(xpath, opt_startNode)
|
| {
|
| - var doc = (opt_startNode && opt_startNode.ownerDocument) || inspectedWindow.document;
|
| + var doc = (opt_startNode && opt_startNode.ownerDocument) || inspectedGlobalObject.document;
|
| var result = doc.evaluate(xpath, opt_startNode || doc, null, XPathResult.ANY_TYPE, null);
|
| switch (result.resultType) {
|
| case XPathResult.NUMBER_TYPE:
|
| @@ -1827,7 +1827,7 @@ CommandLineAPIImpl.prototype = {
|
| */
|
| dir: function(var_args)
|
| {
|
| - return InjectedScriptHost.callFunction(inspectedWindow.console.dir, inspectedWindow.console, slice(arguments));
|
| + return InjectedScriptHost.callFunction(inspectedGlobalObject.console.dir, inspectedGlobalObject.console, slice(arguments));
|
| },
|
|
|
| /**
|
| @@ -1835,7 +1835,7 @@ CommandLineAPIImpl.prototype = {
|
| */
|
| dirxml: function(var_args)
|
| {
|
| - return InjectedScriptHost.callFunction(inspectedWindow.console.dirxml, inspectedWindow.console, slice(arguments));
|
| + return InjectedScriptHost.callFunction(inspectedGlobalObject.console.dirxml, inspectedGlobalObject.console, slice(arguments));
|
| },
|
|
|
| /**
|
| @@ -1862,7 +1862,7 @@ CommandLineAPIImpl.prototype = {
|
| */
|
| profile: function(opt_title)
|
| {
|
| - return InjectedScriptHost.callFunction(inspectedWindow.console.profile, inspectedWindow.console, slice(arguments));
|
| + return InjectedScriptHost.callFunction(inspectedGlobalObject.console.profile, inspectedGlobalObject.console, slice(arguments));
|
| },
|
|
|
| /**
|
| @@ -1870,7 +1870,7 @@ CommandLineAPIImpl.prototype = {
|
| */
|
| profileEnd: function(opt_title)
|
| {
|
| - return InjectedScriptHost.callFunction(inspectedWindow.console.profileEnd, inspectedWindow.console, slice(arguments));
|
| + return InjectedScriptHost.callFunction(inspectedGlobalObject.console.profileEnd, inspectedGlobalObject.console, slice(arguments));
|
| },
|
|
|
| /**
|
| @@ -1981,7 +1981,7 @@ CommandLineAPIImpl.prototype = {
|
|
|
| table: function(data, opt_columns)
|
| {
|
| - InjectedScriptHost.callFunction(inspectedWindow.console.table, inspectedWindow.console, slice(arguments));
|
| + InjectedScriptHost.callFunction(inspectedGlobalObject.console.table, inspectedGlobalObject.console, slice(arguments));
|
| },
|
|
|
| /**
|
| @@ -2024,7 +2024,7 @@ CommandLineAPIImpl.prototype = {
|
| */
|
| _logEvent: function(event)
|
| {
|
| - inspectedWindow.console.log(event.type, event);
|
| + inspectedGlobalObject.console.log(event.type, event);
|
| }
|
| }
|
|
|
|
|