Closed
Bug 906074
Opened 12 years ago
Closed 11 years ago
Mozmill fails to preserve the whole persisted object after a restart if it contains non-serializable data
Categories
(Testing Graveyard :: Mozmill, defect)
Testing Graveyard
Mozmill
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: andrei, Unassigned)
References
Details
Attachments
(2 files)
1.00 KB,
text/javascript
|
Details | |
1.20 KB,
patch
|
whimboo
:
feedback-
|
Details | Diff | Splinter Review |
We use the persisted object to store information between different tests.
If we store a more complex object (I am not sure of the trigger yet, might seem unserializable references) all persisted items are destroyed.
Relevant testcase coming up shortly.
Reporter | ||
Comment 1•12 years ago
|
||
Run this with mozmill 2.0
I've left some dump statements in there.
Notice how when persisted.two is referencing the window object, after a restart persisted.one is lost.
If persisted.two is a regular string, we correctly maintain the value of persisted.one
=====
Bottom line: an undesired element stored in persisted should *not* influence (destroy) other persisted entries.
Comment 2•12 years ago
|
||
And that's fully correct. You can not include any kind of object in the persisted data, if it cannot be converted to a JSON string. There is nothing Mozmill can do here as forgetting all of it.
The question here is do we fail with an exception or not? If we do all is fine. Otherwise we should fix that.
Priority: P2 → --
Reporter | ||
Comment 3•12 years ago
|
||
We should fail graciously.
Lets take the following example:
> persisted.one = "one";
> persisted.two = window;
> persisted.one; // undefined
persisted.one should retain its value.
We should not invalidate the *whole* persisted object if one of its attributes is faulty.
Reporter | ||
Comment 4•12 years ago
|
||
Here is a potential approach.
The problem is that we send the whole persisted object to be serialized:
https://github.com/mozilla/mozmill/blob/master/jsbridge/jsbridge/extension/resource/modules/Server.jsm#L56
To make sure that we persist good objects, and discard only rotten ones, as I am exemplifying in this patch, we can try to serialize each persisted object before sending it further, and nullifying its contents if that fails.
As Henrik pointed out in comment 2, should we throw an exception?
I'd say we should only throw a warning.
Assignee: nobody → andrei.eftimie
Status: NEW → ASSIGNED
Attachment #792056 -
Flags: feedback?(hskupin)
Attachment #792056 -
Flags: feedback?(dave.hunt)
Comment 5•12 years ago
|
||
Comment on attachment 792056 [details] [diff] [review]
patch v1
Review of attachment 792056 [details] [diff] [review]:
-----------------------------------------------------------------
Any checks like that have to be part of jsbridge, which indeed might already have a special handling if we fail in using JSON.stringify(). That given code will have to be updated. I don't think it's helpful to have it at two separate locations.
Attachment #792056 -
Flags: feedback?(hskupin)
Attachment #792056 -
Flags: feedback?(dave.hunt)
Attachment #792056 -
Flags: feedback-
Reporter | ||
Comment 6•12 years ago
|
||
This is not an easy problem to solve.
If we reference DOM elements we fail with:
> TypeError: cyclic object value
because they contain cyclic references.
I've tried a few approaches:
1) to "decycle" the problematic object if the serialization fails, with Douglas Crockford's cycle.js https://github.com/douglascrockford/JSON-js/blob/master/cycle.js
This is failing to on some "protected" objects, would fail with:
> [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMWindow.sessionStorage]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: resource://jsbridge/modules/Server.jsm :: derez :: line 280" data: no]
I've patched the cycle code to ignore these objects, but we failed with:
> CRITICAL | Framework Failure | {
> "message": "[JavaScript Error: \"invalid property id\" {file: \"resource://jsbridge/modules/Server.jsm\" line: 32 column: 60 source: \"ache\": {}, \"toolbar\": {}, \"onprogress\": null, \"scrollX\": 0, \"scro\"}]"
> }
Which is looks like an encoding problem or maybe the resulting string is to long and gets trimmed. Maybe something else entirely.
2) I've tried writing my own small function to either break these cyclic references or nullify them.
But this is problematic, I haven't been able to come up with a good & reliable solution.
In theory this would improve our stringify calls, but at this point might be overkill for our particular problem.
After a good day and a half trying to fix this in a generalised and abstract way in jsbridge, fixing it locally for our persisted object, similar to attachement 792056 looks like a more viable option.
Comment 7•12 years ago
|
||
This is nothing new and the behavior exists since the 1.5 branch. So it should not block 2.0. We can try to find a nice solution for 2.1. For now the tests should ensure that they clean-up the persisted object (if used) from non-supported data.
Whiteboard: [mozmill-2.0?] → [mozmill-2.1?]
Reporter | ||
Updated•12 years ago
|
Assignee: andrei.eftimie → nobody
Comment 8•12 years ago
|
||
This bug will not be taken for version 2.1. We might want to re-evaluate for 2.2.
Whiteboard: [mozmill-2.1?] → [mozmill-2.2?]
Comment 9•11 years ago
|
||
We lived with that for years, so I do not think it is a blocker for the latest releases of Mozmill.
Also Mozmill will reach its end of life soon. We are currently working on getting all the tests for Firefox ported to Marionette. For status updates please see bug 1080766.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
Whiteboard: [mozmill-2.2?]
Assignee | ||
Updated•9 years ago
|
Product: Testing → Testing Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•