Closed
Bug 1198438
Opened 9 years ago
Closed 9 years ago
nsIContentPolicy should not modify srcset
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla44
People
(Reporter: jonalmeida, Assigned: smaug)
References
Details
Attachments
(4 files, 1 obsolete file)
10.07 KB,
patch
|
Details | Diff | Splinter Review | |
4.13 KB,
text/x-log
|
Details | |
3.52 KB,
patch
|
Details | Diff | Splinter Review | |
3.86 KB,
patch
|
johns
:
review+
jonalmeida
:
feedback+
|
Details | Diff | Splinter Review |
When using the content policy interface in Fennec, we can return Ci.nsIContentPolicy.ACCEPT to simulate no change. However this still fails some mochitests[1][2] which expect srcset to be undefined. I've attached a sample patch that causes the issue. (See: test_contentpolicy.patch) [1]: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f80ce1845481 [2]: https://treeherder.mozilla.org/#/jobs?repo=try&revision=848f778a9c50
Comment 1•9 years ago
|
||
Adding John since he worked on <picture> and srcset stuff. John - We are attempting to add a nsIContentPolicy-based feature in bug 1170725. That patch causes some tests to fail. Jonathan tracked the failure down to just needing a simple, almost empty, nsIContentPolicy impl. Something about just having a content policy is causing the tests to fail. Is this expected?
Flags: needinfo?(john)
Comment 2•9 years ago
|
||
This test is asserting that disabling dom.images.*.enabled prefs should result in the element losing those attributes, yet with this CSP somehow `image.srcset` is returning something. This could be do to e.g. a race condition where CSP touching the element is causing it to be initialized as if srcset is enabled prior to the pref being flipped. So they look like legit failures, but it will take some debugging to figure out why the pref isn't taking effect.
Flags: needinfo?(john)
Comment 3•9 years ago
|
||
snorp, could you help us look into this? Or should we ask someone from the DOM team to help out? It looks like this is the only thing blocking us from landing bug 1170725.
Flags: needinfo?(snorp)
I'm not sure what the right thing is here. Smaug?
Flags: needinfo?(snorp) → needinfo?(bugs)
Assignee | ||
Comment 5•9 years ago
|
||
So isn't comment 2 explaining what probably happens here. The ContentPolicy (not CSP!) probably causes one to access some img element, which means the interface object for it is created in the global scope. And since getters/setters live in the interface object, changing the preference afterwards doesn't hide them, even if a new img object was created. Note, function runTest(iframe) { accesses prototypes from the main test page, not from iframe. So, this looks very much like a bug in the test.
Flags: needinfo?(bugs)
Comment 6•9 years ago
|
||
Thanks for the quick reply. Smaug, is there someone on your team who could help fix this test?
Flags: needinfo?(bugs)
Assignee | ||
Comment 8•9 years ago
|
||
I assume this is only about test_srcset_pref.html
Assignee | ||
Comment 9•9 years ago
|
||
hmm, that test contentpolicy is for Android only :/
Assignee | ||
Comment 10•9 years ago
|
||
ah, also test_picture_pref.html test
Assignee | ||
Comment 11•9 years ago
|
||
This is tested without the contentpolicy, but manually touching img objects before changing pref. So, please test if this helps with the issue you're seeing.
Attachment #8663911 -
Flags: feedback?(jonalmeida942)
Reporter | ||
Comment 12•9 years ago
|
||
Thanks smaug! Trying this out right now.
Reporter | ||
Comment 13•9 years ago
|
||
Smaug, I'm still seeing the same tests fail with the wip patch. I've attached the logs from my run.
Flags: needinfo?(bugs)
Reporter | ||
Comment 14•9 years ago
|
||
Comment on attachment 8663911 [details] [diff] [review] wip Review of attachment 8663911 [details] [diff] [review]: ----------------------------------------------------------------- See comment 13.
Attachment #8663911 -
Flags: feedback?(jonalmeida942)
Assignee | ||
Comment 15•9 years ago
|
||
logs don't really help, but I need some way to test this on desktop.
Flags: needinfo?(bugs)
Assignee | ||
Comment 16•9 years ago
|
||
Would really help here if the contentpolicy would work on desktop builds.
Assignee | ||
Comment 17•9 years ago
|
||
/me modifies the test contentpolicy
Assignee | ||
Comment 18•9 years ago
|
||
Assignee | ||
Comment 19•9 years ago
|
||
So this should actually have the same fixes as the previous wip patch, and seems to work just fine locally when testing with the content policy for desktop. Jonathan, can you still reproduce with Android. Since if this doesn't help, I don't really have any way to hack this (I don't have Android dev environment).
Attachment #8663911 -
Attachment is obsolete: true
Attachment #8664557 -
Flags: feedback?
Reporter | ||
Comment 20•9 years ago
|
||
Is the last patch correct? It looks like the same one at that was marked obsolete?
Flags: needinfo?(bugs)
Assignee | ||
Comment 21•9 years ago
|
||
It is correct. I rewrote the fix after I had the test contentpolicy working, and the fix looked the same again.
Flags: needinfo?(bugs)
Reporter | ||
Comment 22•9 years ago
|
||
I've tested this with the test contentpolicy patch (for mobile) and my click-to-play images patch, and both of them still fail with the same errors.
Reporter | ||
Comment 23•9 years ago
|
||
Just to be clear, it's the test_srcset_pref.html test which is still failing, but the test_picture_pref.html one passes now. Other things we've tried include putting the `img` in an iframe (like the picture test) and running it like that.
Assignee | ||
Comment 24•9 years ago
|
||
:( Could you check if the relevant prefs are already on on all the platforms (desktop,mobile,ffos,tb)? If they are, even in release branches, perhaps we should just remove the tests.
Reporter | ||
Comment 25•9 years ago
|
||
I tried pushing the patches to try to see if my local build env wasn't working correctly and it seems good! \o/ (All my Android 4.0 builds seem to fail regardless of what I'm pushing, but I think that's a separate issue when I reset my credentials) https://treeherder.mozilla.org/#/jobs?repo=try&revision=677392c33edb I'm going to rebuild my tree and confirm if the tests pass there later in the day.
Reporter | ||
Comment 26•9 years ago
|
||
Comment on attachment 8664557 [details] [diff] [review] test fixes Verified working on local builds! \o/ NI for smaug to land :D
Flags: needinfo?(bugs)
Attachment #8664557 -
Flags: feedback? → feedback+
Comment 27•9 years ago
|
||
Comment on attachment 8664557 [details] [diff] [review] test fixes Review of attachment 8664557 [details] [diff] [review]: ----------------------------------------------------------------- LGTM
Attachment #8664557 -
Flags: review+
Assignee | ||
Updated•9 years ago
|
Flags: needinfo?(bugs)
Comment 29•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2b5a7e0e2082
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•