Closed Bug 522764 Opened 15 years ago Closed 15 years ago

COWs need tests

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- final-fixed

People

(Reporter: avarma, Assigned: avarma)

Details

Attachments

(1 file)

COWs need a test suite to ensure that they expose properties as per our specification (see bug 518991).
I've got a 17-test suite in a patch against trunk here:

  http://hg.mozilla.org/users/avarma_mozilla.com/cow-patches/file/df226305b064/cow_tests_3.patch

However, there's a notable TODO in it. At the moment, because it's not yet possible to create a COW from script, I've added a method called GetCOWForObject() to nsIDOMWindowUtils.  This method should only be callable from mochitest pages with UniversalXPConnect privileges, but right now the patch disables this functionality because it prevents a content-space Components.utils.Sandbox() from being able to make COWs.

There's different ways we can get around this.  One, which is mentioned in the patch, may be to make GetCOWForObject() a factory method that checks for UniversalXPConnect and then returns a function for creating COWs.  Another option is to figure out exactly what's causing the privilege-checking code to fail when uncommented and fixing it, if that's possible (if it is, I don't know how to accomplish it).  If we want to do the former, I can add the functionality to the patch.
Fixed this problem after talking to mrbkap and finding out that we can just enable UniversalXPConnect in the getCOW() function that's injected into the sandbox; UniversalXPConnect doesn't leak b/c it goes away once the stack frame it was enabled in disappears.

Latest patch is now here:

  http://hg.mozilla.org/users/avarma_mozilla.com/cow-patches/file/9e232a2d8276/cow_tests_3.patch
nsDOMWindowUtils::getCOWForObject() now takes a scope parameter, as per mrbkap's suggestion:

  http://hg.mozilla.org/users/avarma_mozilla.com/cow-patches/file/309eb898fadc/cow_tests_3.patch
Comment on attachment 406791 [details] [diff] [review]
Patch for this bug.

Looks good.
Attachment #406791 - Flags: review?(mrbkap) → review+
http://hg.mozilla.org/mozilla-central/rev/8976e1704153 with a new iid for nsIDOMWindowUtils.
Assignee: nobody → avarma
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Blake, shouldn't this get pushed to the 1.9.2 branch to ensure that COWs work on it, since COW support is in 1.9.2?
jst, in order to get this on 1.9.2, do we need to make an nsIDOMWindowUtils_1_9_2?
Flags: wanted1.9.2?
Comment on attachment 406791 [details] [diff] [review]
Patch for this bug.

It would be good to get tests for COWs on the 1.9.2 branch. I talked with jst, who said not to worry about the interface change.
Attachment #406791 - Flags: approval1.9.2?
Comment on attachment 406791 [details] [diff] [review]
Patch for this bug.

a=jst with a new iid on 1.9.2 as well.
Attachment #406791 - Flags: approval1.9.2? → approval1.9.2+
Flags: wanted1.9.2?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: