Closed Bug 1164078 Opened 10 years ago Closed 7 years ago

In test_add_photo_to_contact.py, after tapping button that closes frame, you get MarionetteException: Error sending message to frame (NS_ERROR_NOT_INITIALIZED)

Categories

(Remote Protocol :: Marionette, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: martijn.martijn, Unassigned)

References

()

Details

Attachments

(1 file)

In the test for test_add_photo_to_contact.py , I had to add a workaround to not get failures as mentioned in bug 1161088: https://github.com/mozilla-b2g/gaia/pull/29874

However, this should not be necessary. 

On irc:
23:04 jgriffin: mwargers: you can ask ato tomorrow; I think we used to catch the frame's unload event to handle this situation, but maybe that was broken recently

From bug 1161088, comment 5:
If a frame has been closed there is a requirement that your next step be to switch frame otherwise you will get errors. This was documented in  bug 1104624.

I tried that and that didn't work.

Andreas, can you take a look at this when you have the time?
Flags: needinfo?(ato)
There is a similar issue in bug 1109213, see bug 1109213, comment 15.
Can you provide a test case that I can use to reproduce this?
Flags: needinfo?(ato)
And I suspect in bug 1170090, we have a similar issue going on.
I think I need to look all the code that closes a window and add workarounds for it.
(In reply to Andreas Tolfsen (:ato) from comment #2)
> Can you provide a test case that I can use to reproduce this?

See comment 0. Basically when you back out the pull request from bug 1161088: https://github.com/mozilla-b2g/gaia/pull/29874 , then you'll see the failure in test_add_photo_to_contact.py.
Or are you looking for a Gaia UI unit test or something?
Flags: needinfo?(ato)
Blocks: 1171038
In bug 1188924, we've now made a centralized workaround for this issue.
Blocks: 1188924
Clearing needinfo request until I have a way to reproduce this.
Flags: needinfo?(ato)
Attached patch 1164078.diffSplinter Review
Sorry for the delay, this is basically the issue that is going on.
When the Marionette is in an iframe and that iframe gets closed, then calling Marionette methods (like self.marionette.switch_to_frame()) afterwards are causing NoSuchWindowExceptions.
It seems to me that Marionette should automatically switch to the root frame or something, when this happens.
Flags: needinfo?(ato)
(In reply to Martijn Wargers [:mwargers] (QA) from comment #7)
> Sorry for the delay, this is basically the issue that is going on.
> When the Marionette is in an iframe and that iframe gets closed, then
> calling Marionette methods (like self.marionette.switch_to_frame())
> afterwards are causing NoSuchWindowExceptions.

Thanks for investigating this.  Switching to frame should not throw this error if the current frame disappears.

> It seems to me that Marionette should automatically switch to the root frame
> or something, when this happens.

This is the expected behaviour.  If something closes the frame you would want to know that some action has removed the frame.

The correct action to take in this case is to catch that error, or by some other measure detect that the frame has disappeared, and switch to a valid frame.
Flags: needinfo?(ato)
(In reply to Andreas Tolfsen (:ato) from comment #8)
> This is the expected behaviour.  If something closes the frame you would
> want to know that some action has removed the frame.
> 
> The correct action to take in this case is to catch that error, or by some
> other measure detect that the frame has disappeared, and switch to a valid
> frame.

How do I do switch to a valid frame in this case? When I call self.marionette.switch_to_frame(), I would normally have switched to the system frame, which is always there. But in this case, I'm getting this error.
Or do I need to re-instantiate a new Marionette client in this case?
Flags: needinfo?(ato)
(In reply to Martijn Wargers [:mwargers] (QA) from comment #9)
> (In reply to Andreas Tolfsen (:ato) from comment #8)
> > The correct action to take in this case is to catch that error, or by some
> > other measure detect that the frame has disappeared, and switch to a valid
> > frame.
> 
> How do I do switch to a valid frame in this case? When I call
> self.marionette.switch_to_frame(), I would normally have switched to the
> system frame, which is always there. But in this case, I'm getting this
> error.
> Or do I need to re-instantiate a new Marionette client in this case?

No, that is definitely a bug.  Switching to a frame should not check that the current frame context is still present.  It, and Switch To Window, are special commands that should circumvent these checks.
Flags: needinfo?(ato)
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
closing b2g related bugs
Status: REOPENED → RESOLVED
Closed: 8 years ago7 years ago
Resolution: --- → INCOMPLETE
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: