Closed Bug 681461 Opened 13 years ago Closed 13 years ago

Do not unwrap the window and opener when handling modal dialogs (breaks testSubmitUnencryptedInfoWarning.js)

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: u279076, Assigned: whimboo)

References

()

Details

(Keywords: regression, Whiteboard: [lib][mozmill-test-failure])

Attachments

(4 files, 1 obsolete file)

Test: Functional::Security::testSubmitUnencryptedInfoWarning
Fail: Disconnect Error: Application unexpectedly closed
Branch: default, aurora
This patch skips the test -- only applies for Nightly and Aurora.
Attachment #555200 - Flags: review?(hskupin)
Comment on attachment 555200 [details] [diff] [review]
Patch v1.0 (nightly/aurora) [checked-in]

I believe both disconnects in the last couple of days are related to each other. We should really get those investigated.
Attachment #555200 - Flags: review?(hskupin) → review+
Comment on attachment 555200 [details] [diff] [review]
Patch v1.0 (nightly/aurora) [checked-in]

Landed:
http://hg.mozilla.org/qa/mozmill-tests/rev/e658459426f6 (default)
http://hg.mozilla.org/qa/mozmill-tests/rev/77206068e42a (aurora)
Attachment #555200 - Attachment description: Patch v1.0 (nightly/aurora) → Patch v1.0 (nightly/aurora) [checked-in]
Whiteboard: [mozmill-test-failure] → [mozmill-test-failure][mozmill-test-skipped]
Remus, can you have a look at this bug and see if you can reproduce it? If not I will have to look into it next week on QA-Horus.
I was able to reproduce it by running this test on the latest nightly and aurora. It seems that the test cannot get over the dialog that appears. Even if I manually click continue the test fails.
Assignee: nobody → remus.pop
Status: NEW → ASSIGNED
Which dialog do you see? Can you attach a screenshot? Is that a modal dialog? Do we expect such a dialog in the test?
Attached image screenshot of dialog
We expect this dialog in the test.
Running this test stops us to:
found = (mozmill.utils.getChromeWindow(opener) == this._opener);
which is part of the findWindow function in the modal dialog observer.
Please do a regression test with Nightly builds of Firefox to find out for which build it started to happen. The same code base works fine with Firefox Beta so there is a regression in Firefox.
(In reply to Remus Pop from comment #10)
> This appears to be related to bug 626455.

This is Panorama related which we make not use of in this test. So I can't believe it's directly related. I will do a hg bisect to narrow down the regression range.
When running with a debug build I get the following exception:

************************************************************
* Call to xpconnect wrapped JSObject produced this error:  *
[Exception... "'Error: Permission denied for <https://www.mozilla.org> to create wrapper for object of class UnnamedClass' when calling method: [nsIObserver::observe]"  nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)"  location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"  data: no]
************************************************************
(In reply to Henrik Skupin (:whimboo) from comment #13)
> ************************************************************
> * Call to xpconnect wrapped JSObject produced this error:  *
> [Exception... "'Error: Permission denied for <https://www.mozilla.org> to
> create wrapper for object of class UnnamedClass' when calling method:
> [nsIObserver::observe]"  nsresult: "0x8057001c
> (NS_ERROR_XPC_JS_THREW_JS_OBJECT)"  location: "native frame :: <unknown
> filename> :: <TOP_LEVEL> :: line 0"  data: no]
> ************************************************************

Blake, could that be a regression from your patch on bug 674182? Those errors always happen when a website spawns a modal dialog.
(In reply to Henrik Skupin (:whimboo) from comment #14)
> Blake, could that be a regression from your patch on bug 674182? Those
> errors always happen when a website spawns a modal dialog.

Ok, so my assumption was correct. It is a regression from this mentioned bug:

The first bad revision is:
changeset:   73447:83535f44db38
user:        Blake Kaplan <mrbkap@gmail.com>
date:        Wed Jul 27 12:29:26 2011 -0700
summary:     Fix bug 674182. r=jst

/CC some folks who probably can help as long as Blake is away.
Keywords: regression
The code we are using to handle modal dialogs can be found here:
http://hg.mozilla.org/qa/mozmill-tests/file/default/lib/modal-dialog.js
So, looking at that code, I see that you're using something called unwrapNode. I can't find the implementation of that function, but from bug 629832, it appears to be a function that takes a (possibly) Xray-wrapped object and "unwraps" it by calling XPCNativeWrapper.unwrap.

I don't understand why you're using that function in modal-dialog.js. It doesn't appear that you're using any sort of XBL on the content node and in this case, security wrappers are actually doing their job. When you unwrap an Xray wrapper, you're explicitly saying that "everything that happens beyond this point should happen as though chrome is doing it." Therefore, what I assume is happening is that you're QIing to something that has to create an XPCWrappedNative, but since we're going though the .wrappedJSObject of something, XPConnect doesn't think you're chrome and it throws.

By the way, where are the implementations of the mozmill.utils functions?
(In reply to Blake Kaplan (:mrbkap) from comment #17)
> So, looking at that code, I see that you're using something called
> unwrapNode. I can't find the implementation of that function, but from bug
> 629832, it appears to be a function that takes a (possibly) Xray-wrapped
> object and "unwraps" it by calling XPCNativeWrapper.unwrap.

The method has been moved to Mozmill native and is available here:
https://github.com/mozautomation/mozmill/blob/hotfix-1.5/mozmill/mozmill/extension/resource/modules/utils.js#L401

> I don't understand why you're using that function in modal-dialog.js. It
> doesn't appear that you're using any sort of XBL on the content node and in
> this case, security wrappers are actually doing their job. When you unwrap
> an Xray wrapper, you're explicitly saying that "everything that happens
> beyond this point should happen as though chrome is doing it." Therefore,
> what I assume is happening is that you're QIing to something that has to
> create an XPCWrappedNative, but since we're going though the
> .wrappedJSObject of something, XPConnect doesn't think you're chrome and it
> throws.

So you say that we do not have to unwrap those nodes. I can remember that I have had problems with it when I have implemented that code. Now when I do not call unwrap it works fine and I don't see any problem across all of our tests which make use of the modal dialog module.
Blocks: 675914
Attached patch Fix v1.0 (obsolete) — Splinter Review
Blake, is that what you expect to see? At least it is working fine for our tests.
Assignee: remus.pop → hskupin
Attachment #557805 - Flags: review?(gmealer)
Attachment #557805 - Flags: feedback?(mrbkap)
A Pivotal Tracker story has been created for this Bug: https://www.pivotaltracker.com/story/show/17805221
Attachment #557805 - Flags: review?(gmealer)
Comment on attachment 557805 [details] [diff] [review]
Fix v1.0

Yeah. For most use cases, .wrappedJSObect is totally unnecessary. The only reason that you'd want to use it would be if you want to interact directly with page JS (e.g. call a function defined by a page) or interact directly with XBL attached to an element in the page.
Attachment #557805 - Flags: feedback?(mrbkap) → feedback+
Thanks Blake! I will remember that. Here a slightly updated patch, to clean-up the code a bit more.
Attachment #557805 - Attachment is obsolete: true
Attachment #557943 - Flags: review?(gmealer)
Comment on attachment 557943 [details] [diff] [review]
Fix v1.1 [checked-in]

r+ looks fine. Maybe should echo the landing comment to 675914 too, to make it clear what fix closed it out.

Are you taking care of re-enabling the tests in the Litmus run?
Attachment #557943 - Flags: review?(gmealer) → review+
Component: Mozmill Tests → Mozmill Shared Modules
QA Contact: mozmill-tests → mozmill-shared-modules
Summary: testSubmitUnencryptedInfoWarning.js fails due to Disconnect → Do not unwrap the window and opener when handling modal dialogs (breaks testSubmitUnencryptedInfoWarning.js)
Backport for beta, release, and hopefully 1.9.2 too.
Attachment #557965 - Flags: review?(gmealer)
Comment on attachment 557943 [details] [diff] [review]
Fix v1.1 [checked-in]

Landed as:
http://hg.mozilla.org/qa/mozmill-tests/rev/9845dbe7a9cf (default)
http://hg.mozilla.org/qa/mozmill-tests/rev/4141d370e16b (aurora)
Attachment #557943 - Attachment description: Fix v1.1 → Fix v1.1 [checked-in]
Comment on attachment 557965 [details] [diff] [review]
Fix (backport) [checked-in]

Looks fine, r+
Attachment #557965 - Flags: review?(gmealer) → review+
Comment on attachment 557965 [details] [diff] [review]
Fix (backport) [checked-in]

Landed as:
http://hg.mozilla.org/qa/mozmill-tests/rev/53a5c1403898 (beta)
http://hg.mozilla.org/qa/mozmill-tests/rev/b1940f446522 (release)

I don't intend to land it on 1.9.2.
Attachment #557965 - Attachment description: Fix (backport) → Fix (backport) [checked-in]
This test were never disabled on Litmus in the interim. :/ So nothing to change on that end, and we are done.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [mozmill-test-failure][mozmill-test-skipped] → [mozmill-test-failure]
Component: Mozmill Shared Modules → Mozmill Tests
Whiteboard: [mozmill-test-failure] → [lib]
Whiteboard: [lib] → [lib][mozmill-test-failure]
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: