Commit c95ef4af authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

[inspector] nullifyObjectPrototype -> InjectedScriptHost.nullifyPrototype

Current implementation is unsafe if __proto__ getter is defined on Object.prototype.

BUG=chromium:595206
R=dgozman@chromium.org

Review-Url: https://codereview.chromium.org/2770263003
Cr-Commit-Position: refs/heads/master@{#44206}
parent d7d201d4
...@@ -76,18 +76,6 @@ function toStringDescription(obj) ...@@ -76,18 +76,6 @@ function toStringDescription(obj)
return toString(obj); return toString(obj);
} }
/**
* @param {T} obj
* @return {T}
* @template T
*/
function nullifyObjectProto(obj)
{
if (obj && typeof obj === "object")
obj.__proto__ = null;
return obj;
}
/** /**
* @param {number|string} obj * @param {number|string} obj
* @return {boolean} * @return {boolean}
...@@ -449,7 +437,6 @@ InjectedScript.prototype = { ...@@ -449,7 +437,6 @@ InjectedScript.prototype = {
descriptor.isOwn = true; descriptor.isOwn = true;
if (isSymbol(property)) if (isSymbol(property))
descriptor.symbol = property; descriptor.symbol = property;
descriptor = nullifyObjectProto(descriptor);
if (!addPropertyIfNeeded(descriptors, descriptor)) if (!addPropertyIfNeeded(descriptors, descriptor))
return false; return false;
} }
...@@ -1039,7 +1026,8 @@ InjectedScript.RemoteObject.prototype = { ...@@ -1039,7 +1026,8 @@ InjectedScript.RemoteObject.prototype = {
preview.overflow = true; preview.overflow = true;
break; break;
} }
var entry = nullifyObjectProto(entries[i]); var entry = entries[i];
InjectedScriptHost.nullifyPrototype(entry);
var previewEntry = { var previewEntry = {
value: generateValuePreview(entry.value), value: generateValuePreview(entry.value),
__proto__: null __proto__: null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment