Improve test case from bug 1146116 (mozSetFileArray recompartmenting)

RESOLVED FIXED in Firefox 40

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: jld, Assigned: jld)

Tracking

Trunk
mozilla40
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox40 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
The patch from bug 1146116 contains a test case which confirms that, after calling mozSetFileArray on an input element, the File object read back from it belongs to the element's global, even if the original File did not.  This part is working correctly.

The test also, as a sanity check, confirms that it did in fact pass a cross-origin File.  Unfortunately, this part is incorrect:

  isnot(SpecialPowers.Cu.getGlobalForObject(elem), window,
        "File from MessageManager is wrapped");

This test will never fail, because the return value of getGlobalForObject will be a Proxy (as for SpecialPowers.wrap), and will therefore not compare equal to any actual global; it has to be passed through SpecialPowers.unwrap, as is done for the second test.  It would also fail if it did that, because it's testing `elem` (the input element, which does belong to the script's global) rather than `file` (the cross-origin-wrapped File object).

Aside from being slightly embarrassing, this defeats the purpose of adding that check: to verify that the test is in fact testing what it's meant to be.
(Assignee)

Comment 1

3 years ago
(This bug isn't really about *submitting* an HTML form, anymore.)
Component: HTML: Form Submission → DOM: Core & HTML
(Assignee)

Comment 2

3 years ago
Created attachment 8586435 [details] [diff] [review]
bug1149395-oops-hg0.diff

Rolling the magic 8-ball of DOM peers....
Attachment #8586435 - Flags: review?(mrbkap)
Comment on attachment 8586435 [details] [diff] [review]
bug1149395-oops-hg0.diff

Review of attachment 8586435 [details] [diff] [review]:
-----------------------------------------------------------------

Good catch.
Attachment #8586435 - Flags: review?(mrbkap) → review+
(Assignee)

Comment 4

3 years ago
No try run for C-N because: it's a change to one specific test, and the changes shouldn't depend on platform.  Tested locally on x86_64/Linux desktop (e10s and not), and B2G emulator (non-debug) and emulator-x86-kk (debug).
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/82a14807801c
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox40: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.