diff --git a/packages/puppeteer-core/src/bidi/Serializer.ts b/packages/puppeteer-core/src/bidi/Serializer.ts index 643e8405..077f3e02 100644 --- a/packages/puppeteer-core/src/bidi/Serializer.ts +++ b/packages/puppeteer-core/src/bidi/Serializer.ts @@ -157,8 +157,7 @@ export class BidiSerializer { if (objectHandle) { if ( objectHandle.realm.environment.context() !== - sandbox.environment.context() && - !('sharedId' in objectHandle.remoteValue()) + sandbox.environment.context() ) { throw new Error( 'JSHandles can be evaluated only in the context they were created!' diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 3ebee477..c3a44359 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -551,12 +551,6 @@ "parameters": ["cdp"], "expectations": ["FAIL"] }, - { - "testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should throw if elementHandles are from other frames", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["FAIL"] - }, { "testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluateOnNewDocument *", "platforms": ["darwin", "linux", "win32"], @@ -1769,6 +1763,18 @@ "parameters": ["cdp", "firefox"], "expectations": ["SKIP"] }, + { + "testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should throw if elementHandles are from other frames", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, + { + "testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should throw if elementHandles are from other frames", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "webDriverBiDi"], + "expectations": ["PASS"] + }, { "testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should throw when evaluation triggers reload", "platforms": ["darwin", "linux", "win32"],