Closed
Bug 1261003
Opened 9 years ago
Closed 9 years ago
W3C referrerpolicy content attribute doesn't work in FF
Categories
(Core :: DOM: Security, defect)
Core
DOM: Security
Tracking
()
RESOLVED
FIXED
mozilla49
Tracking | Status | |
---|---|---|
firefox49 | --- | fixed |
People
(Reporter: tnguyen, Assigned: tnguyen)
References
Details
(Whiteboard: [domsecurity-active])
Attachments
(2 files)
2.70 KB,
patch
|
jdm
:
review+
franziskus
:
review+
|
Details | Diff | Splinter Review |
24.56 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
Running web platform test [1] on FF, it fails in many cases because referrerpolicy content attribute doesn't work.
https://dxr.mozilla.org/mozilla-central/source/testing/web-platform/tests/referrer-policy/generic/referrer-policy-test-case.js#79
(for example one case : /referrer-policy/no-referrer/attr-referrer/cross-origin/http-http/iframe-tag/generic.keep-origin-redirect.http.html)
Tried to change referrerpolicy in this line to IDL attribute referrerPolicy and the case passed
Running on Canary Chrome I had an opposite result : referrerpolicy works and referrePolicy does not work.
[1] https://github.com/w3c/web-platform-tests/tree/master/referrer-policy
Updated•9 years ago
|
Assignee | ||
Comment 1•9 years ago
|
||
https://dxr.mozilla.org/mozilla-central/source/testing/web-platform/tests/referrer-policy/generic/common.js#28
I think content attribute should be set in more official way like setAttribute(attr, attributes[attr]).
Comment 2•9 years ago
|
||
So this is specifically about the *IDL* attribute rather than the *content* attribute?
Assignee | ||
Comment 3•9 years ago
|
||
More clearly,
In current web-platform-test, line [2] set attribute which is defined in [1] (referrerpolicy - content attribute in this case)
AFAIK, content attribute is the attribute (set from the content HTML) and could be set in javascript using element.setAttribute() (I have no idea but it seems FF does not support set using element[attr] = xxx, we should use setAttribute())
On the other hand, IDL attribute is also known as a JavaScript property could be set using JavaScript like element.idlAttr = xxx (or element[idlAttr] = xxx).
That's why if we replace referrerpolicy (content attr) to referrerPolicy (idl attr) in line [1], we could pass the test.
Or, changing the line [2] to use setAttribute() also passes. It would make more sense.
[1] https://dxr.mozilla.org/mozilla-central/source/testing/web-platform/tests/referrer-policy/generic/referrer-policy-test-case.js#79
[2] https://dxr.mozilla.org/mozilla-central/source/testing/web-platform/tests/referrer-policy/generic/common.js#28
(In reply to :Ms2ger from comment #2)
> So this is specifically about the *IDL* attribute rather than the *content*
> attribute?
I am not sure the object of these tests is IDL or content attribute, personally I think it should be idl attribute. Anyway, purpose of the tests is triggering referrer policy, so both of them are fine.
Thanks
Comment 4•9 years ago
|
||
ok, looks like this an error in the web platform tests. filed https://github.com/w3c/web-platform-tests/issues/2822.
Flags: needinfo?(franziskuskiefer)
Updated•9 years ago
|
Assignee: nobody → tnguyen
Updated•9 years ago
|
Status: NEW → ASSIGNED
Whiteboard: [domsecurity-active]
Assignee | ||
Comment 5•9 years ago
|
||
Bracket used in [3] should be used to access property of element (or IDL attribute in this case) I think we should change content attribute (referrerpolicy) to IDL attribute (referrerPolicy) in [1]
Referrer policy IDL and content attribute are described in [3]
[1] https://dxr.mozilla.org/mozilla-central/source/testing/web-platform/tests/referrer-policy/generic/referrer-policy-test-case.js#79
[2] https://dxr.mozilla.org/mozilla-central/source/testing/web-platform/tests/referrer-policy/generic/common.js#28
[3] https://w3c.github.io/webappsec-referrer-policy/#html-image-element-attributes
Hi Franziskus, Josh. Could you please review that?
Attachment #8744773 -
Flags: review?(josh)
Attachment #8744773 -
Flags: review?(franziskuskiefer)
Updated•9 years ago
|
Attachment #8744773 -
Flags: review?(franziskuskiefer) → review+
Updated•9 years ago
|
Attachment #8744773 -
Flags: review?(josh) → review+
Assignee | ||
Comment 6•9 years ago
|
||
Comment on attachment 8744773 [details] [diff] [review]
IDL attribute
I think web-platform tests should not be enabled ( which is disabled in meta folder [1]) in this bug.
It should be enabled in Bug 1168540 after all dependencies are fixed, because one failed case might be caused by several reasons.
[1] https://dxr.mozilla.org/mozilla-central/source/testing/web-platform/meta/referrer-policy
Attachment #8744773 -
Flags: review?(ehsan)
Comment 7•9 years ago
|
||
We should enable them now, no question about it. The only reason they were disabled is <https://github.com/w3c/web-platform-tests/issues/1874>, which is long fixed.
Assignee | ||
Comment 8•9 years ago
|
||
(In reply to :Ms2ger from comment #7)
> We should enable them now, no question about it. The only reason they were
> disabled is <https://github.com/w3c/web-platform-tests/issues/1874>, which
> is long fixed.
At least, due to Bug 1223838, perElementRefererer policy preference is set to false. Then setting referrerPolicy attribute on image element has no effect. If we enable them here, there will be a lot failures on try.
Comment 9•9 years ago
|
||
(In reply to Thomas Nguyen[:tnguyen][:thomas][:nguyen] from comment #8)
> (In reply to :Ms2ger from comment #7)
> > We should enable them now, no question about it. The only reason they were
> > disabled is <https://github.com/w3c/web-platform-tests/issues/1874>, which
> > is long fixed.
> At least, due to Bug 1223838, perElementRefererer policy preference is set
> to false. Then setting referrerPolicy attribute on image element has no
> effect. If we enable them here, there will be a lot failures on try.
You can enable the pref for all of the tests in a directory by creating a __dir__.ini file like this: <https://dxr.mozilla.org/mozilla-central/source/testing/web-platform/meta/service-workers/service-worker/__dir__.ini>. With that you should be able to enable all of these tests. The test harness would set the pref before running the tests so everything should work correctly.
Does this make sense?
Flags: needinfo?(tnguyen)
Assignee | ||
Comment 10•9 years ago
|
||
Bug 1223838, comment 6, there're 76 cases failed with this bug (and more than a half of them also contains bug 1178337, and bug 1261298).
I will try with you suggestion, but only enable the bugs does not contain bug 1178337, and bug 1261298.
Thanks Ehsan
Flags: needinfo?(tnguyen)
Assignee | ||
Comment 11•9 years ago
|
||
Bug 1223838, comment 6, there're 76 cases failed with this bug (and more than a half of them also contain bug 1178337, and bug 1261298).
I will try with you suggestion, but only enable the case does not contain bug 1178337, and bug 1261298.
Thanks Ehsan
Comment 12•9 years ago
|
||
Cool. FWIW we can also have tests that are expected to fail. Once you have set the pref, you can use this tool <http://wptrunner.readthedocs.io/en/latest/expectation.html#generating-expectation-files> to update the expectation data. I'll clear the review request for now.
Updated•9 years ago
|
Attachment #8744773 -
Flags: review?(ehsan)
Assignee | ||
Comment 13•9 years ago
|
||
Assignee | ||
Comment 14•9 years ago
|
||
Assignee | ||
Comment 15•9 years ago
|
||
Assignee | ||
Comment 16•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Attachment #8746986 -
Flags: review?(ehsan)
Assignee | ||
Comment 17•9 years ago
|
||
Try looks good.
We still have tests that are expected to fail in img-tag due to bug 1257249
Updated•9 years ago
|
Attachment #8746986 -
Flags: review?(ehsan) → review+
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 18•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/3aff4dae71ac
https://hg.mozilla.org/integration/mozilla-inbound/rev/a25f97b1cf4d
Keywords: checkin-needed
Comment 19•9 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3aff4dae71ac
https://hg.mozilla.org/mozilla-central/rev/a25f97b1cf4d
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Comment 20•9 years ago
|
||
Thomas, thanks for fixing this!
You need to log in
before you can comment on or make changes to this bug.
Description
•