Error: Permission denied to access property "mediaText" when refreshing salvatore.js.org with devtools enabled.
Categories
(DevTools :: Style Editor, defect)
Tracking
(firefox-esr78 unaffected, firefox82 wontfix, firefox83 verified, firefox84 verified)
Tracking | Status | |
---|---|---|
firefox-esr78 | --- | unaffected |
firefox82 | --- | wontfix |
firefox83 | --- | verified |
firefox84 | --- | verified |
People
(Reporter: emilio, Assigned: emilio)
References
(Depends on 1 open bug, Regression)
Details
(Keywords: regression)
Attachments
(3 files)
285 bytes,
text/html
|
Details | |
47 bytes,
text/x-phabricator-request
|
pascalc
:
approval-mozilla-beta+
|
Details | Review |
47 bytes,
text/x-phabricator-request
|
pascalc
:
approval-mozilla-beta+
|
Details | Review |
Assignee | ||
Comment 1•4 years ago
|
||
I can reproduce that issue, and mozregression gave me https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=0ae2362c2288c83b8cf0c41670288911f4ada69e&tochange=5ce60ce82c5268b5f6a219c61f13c183939a608d so it seems like a devtools issue.
Daisuke, can you take a look?
Updated•4 years ago
|
Comment 2•4 years ago
|
||
Thank you very much for letting me know, Emilio.
Yes, I will take a look at this issue.
Updated•4 years ago
|
Comment 3•4 years ago
|
||
Let me report as far as I investigated this issue.
It seems that if DevTools touches a field such as mediaText
of MediaList
earlier than the content document, this will happen.
We can confirm this problem with the attachment. The attached html define the media query at first, then access that 1sec later from js.
STRs:
- Open html of the attachment.
- Open DevTools and select inspector.
- Select console.
- Reload the content document.
If we encounter this issue, it seems that media
object in the rule have been as Restricted
object.
(So, permission denied?)
But, if stop referring to mediaText
from following lines of DevTools , there will be no errors.
https://searchfox.org/mozilla-central/rev/a147181ece866c1ecd176ac49f112785f960aac0/devtools/server/actors/resources/stylesheets.js#379,388
That's it.
However, this may be related to management of MediaList in platform side, do you have any ideas? Emilio?
Assignee | ||
Comment 4•4 years ago
|
||
Hmm, so my guess is that we create a privileged wrapper for the MediaList object, and the page can't access it anymore. But I wonder why that is an issue for media
but not for other accessors like .cssRules
and such...
From a quick look, I think it's because MediaList
doesn't keep any reference to the parent global (GetParentObject
returns null), so when we create a reflector we associate it with the caller's global which in this case is privileged (and thus content can't access).
Olli can probably sanity-check me. We could arguably try to keep a reference to the stylesheet we came from, which would fix this I suspect.
That being said, why does the front end access .media
at all? It's already accessing the .conditionText
which is the same as the .media.mediaText
.
Assignee | ||
Comment 5•4 years ago
|
||
Otherwise if devtools or other privileged JS access them then content
can choke.
Updated•4 years ago
|
Assignee | ||
Comment 6•4 years ago
|
||
The patch I attached should fix it. Can you confirm it fixes it on your end too?
Also, do you know how to best write a test for this?
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f936bdfd0ee6 Make MediaList objects return a style sheet parent so that we associate reflectors to the right global. r=smaug
Comment 8•4 years ago
|
||
Set release status flags based on info from the regressing bug 1659589
Comment 9•4 years ago
|
||
bugherder |
Comment 10•4 years ago
|
||
It works well! Thank you very much, Emilio!
And yes, I tried to write the test, I'd like you to review it.
Comment 11•4 years ago
|
||
Updated•4 years ago
|
Comment 12•4 years ago
|
||
Pushed by dakatsuka.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/16914662147b Add a test whether it can access a filed in MediaList with normal privilege after accessing with chrome privilege. r=emilio
Comment 13•4 years ago
|
||
bugherder |
Comment 14•4 years ago
|
||
The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?
If not please set status_beta
to wontfix
.
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 15•4 years ago
|
||
Comment on attachment 9184479 [details]
Bug 1673199 - Make MediaList objects return a style sheet parent so that we associate reflectors to the right global. r=smaug
Beta/Release Uplift Approval Request
- User impact if declined: Some pages may misfunction with devtools enabled.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: Yes
- If yes, steps to reproduce: comment 0
- List of other uplifts needed: none
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): very low-risk patch, returning a sensible global to create the object from.
- String changes made/needed: none
Assignee | ||
Updated•4 years ago
|
Comment 16•4 years ago
|
||
Reproduced the initial issue in Beta 83.0b7 using Windows 10, following the steps from https://bugzilla.mozilla.org/show_bug.cgi?id=1423300#c12
Verified - Fixed in latest Nightly 84.0a1 (build id: 20201102095541) using Windows 10 and Ubuntu 18.04. There is no Uncaught Error encountered in console after reloading the page.
Updated•4 years ago
|
Comment 17•4 years ago
|
||
Comment on attachment 9184479 [details]
Bug 1673199 - Make MediaList objects return a style sheet parent so that we associate reflectors to the right global. r=smaug
Low risk patch, verified by QA on Nightly and we want web developers to have a normal browsing experience to work on Firefox Web compatibility, approved for 83 beta 8, thanks.
Updated•4 years ago
|
Comment 18•4 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-beta/rev/e6c52aa87aac
https://hg.mozilla.org/releases/mozilla-beta/rev/4a0a8a36217a
Comment 19•4 years ago
|
||
Verified - Fixed in latest Beta 83.0b8 (build id: 20201103183834) using Windows 10 and Ubuntu 18.04. There is no Uncaught Error encountered in console after reloading the page.
Comment 20•4 years ago
|
||
Thank you all!
I can verify that's fixed (Firefox 83.0, build-id: 20201112153044, agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0).
No bug in devtools on https://salvattore.js.org/ and on a new website I'm working on.
Description
•