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

Unified Diff: LayoutTests/fast/dom/Window/script-tests/postmessage-clone.js

Issue 97883002: Remove structured cloning restriction over accessor properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test for cyclic-via-accessor-property object Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/window-postmessage-clone-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Window/script-tests/postmessage-clone.js
diff --git a/LayoutTests/fast/dom/Window/script-tests/postmessage-clone.js b/LayoutTests/fast/dom/Window/script-tests/postmessage-clone.js
index 0a07d0408b76793cca4a6f0e5e11631145828cce..9e940799b7d4ce86695a886bc3bc41c7c7b07bf5 100644
--- a/LayoutTests/fast/dom/Window/script-tests/postmessage-clone.js
+++ b/LayoutTests/fast/dom/Window/script-tests/postmessage-clone.js
@@ -33,6 +33,8 @@ tryPostMessage('cyclicObject', false, "cyclicObject");
cyclicArray=[];
cyclicArray[0] = cyclicArray;
tryPostMessage('cyclicArray', false, "cyclicArray");
+var cyclicObjectGetter = {get self() { return cyclicObjectGetter; }};
+tryPostMessage('cyclicObjectGetter', false, 'cyclicObject');
objectGraph = {};
object = {};
objectGraph.graph1 = object;
@@ -154,13 +156,14 @@ tryPostMessage(thunk(
doPassFail((v.b.p === 42 && v.a.p === 42) ||
(v.b.p === null && v.a.p === null), "accessors used (opposite order)");
});
-// We should nullify the results from accessors more than one level deep,
-// but leave other fields untouched.
+
+// Tests to verify that accessor and non-accessor properties are
+// treated equivalently.
tryPostMessage(thunk(
'var obja = {get p() { return 42; }, q: 43}; ' +
'return {get a() { return obja; }};'
), false, "evalThunk", function(v) {
- doPassFail(v.a.p === null, "accessor value was nullified");
+ doPassFail(v.a.p === 42, "accessor value was not nullified");
doPassFail(v.a.q === 43, "non-accessor value was not nullified");
});
tryPostMessage(thunk(
@@ -168,10 +171,10 @@ tryPostMessage(thunk(
'var obja = {get p() { return 42; }, q: 43, s: objb}; ' +
'return {get a() { return obja; }};'
), false, "evalThunk", function(v) {
- doPassFail(v.a.p === null, "accessor value was nullified");
+ doPassFail(v.a.p === 42, "accessor value was not nullified");
doPassFail(v.a.q === 43, "non-accessor value was not nullified");
doPassFail(v.s !== null, "non-accessor value was not nullified");
- doPassFail(v.a.s.r === null, "accessor value was nullified");
+ doPassFail(v.a.s.r === 44, "accessor value was not nullified");
doPassFail(v.a.s.t === 45, "non-accessor value was not nullified");
});
tryPostMessage(thunk(
@@ -181,13 +184,13 @@ tryPostMessage(thunk(
), false, "evalThunk", function(v) {
doPassFail(v.b === 46, "accessor value was not nullified");
doPassFail(v.c === 47, "accessor value was not nullified");
- doPassFail(v.a.p === null, "accessor value was nullified");
+ doPassFail(v.a.p === 42, "accessor value was not nullified");
doPassFail(v.a.q === 43, "non-accessor value was not nullified");
doPassFail(v.a.s !== null, "non-accessor value was not nullified");
doPassFail(v.a.s !== undefined, "non-accessor value is defined");
doPassFail(v.a.s[0] !== null, "non-accessor value was not nullified");
doPassFail(v.a.s[0] !== undefined, "non-accessor value is defined");
- doPassFail(v.a.s[0].r === null, "accessor value was nullified");
+ doPassFail(v.a.s[0].r === 44, "accessor value was not nullified");
doPassFail(v.a.s[0].t === 45, "non-accessor value was not nullified");
});
@@ -195,12 +198,10 @@ tryPostMessage(thunk(
tryPostMessage(thunk(
'return {get a() { throw "accessor-exn"; }};'
), true, null, 'accessor-exn');
-// We should still return the exception raised from nulled-out accessors.
tryPostMessage(thunk(
'var obja = {get p() { throw "accessor-exn"; }}; ' +
'return {get a() { return obja; }};'
), true, null, 'accessor-exn');
-// We should run the first nullified accessor, but no more.
tryPostMessage(thunk(
'window.bcalled = undefined; ' +
'window.acalled = undefined; ' +
@@ -209,10 +210,10 @@ tryPostMessage(thunk(
'var obja = {get a() { window.acalled = true; return objb; }}; ' +
'return { get p() { window.pcalled = true; return obja; }};'
), false, "evalThunk", function(v) {
- doPassFail(v.p.a === null, "accessor value was nullified");
+ doPassFail(v.p.a.b === 42, "accessor value was not nullified");
doPassFail(window.pcalled === true, "window.pcalled === true");
doPassFail(window.acalled === true, "window.acalled === true");
- doPassFail(window.bcalled === undefined, "window.bcalled === undefined");
+ doPassFail(window.bcalled === true, "window.bcalled === true");
});
// Reference equality between Boolean objects must be maintained.
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/window-postmessage-clone-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698