Cut and Copy menuitem are enabled when Nightly starts up
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: u520171, Unassigned)
References
Details
(6 keywords)
Attachments
(1 file, 1 obsolete file)
|
55.89 KB,
image/png
|
Details |
Comment 4•10 years ago
|
||
Comment 6•10 years ago
|
||
Comment 7•10 years ago
|
||
Comment 9•10 years ago
|
||
Comment 10•10 years ago
|
||
Comment 11•10 years ago
|
||
Comment 12•10 years ago
|
||
Comment 13•10 years ago
|
||
Comment 16•7 years ago
|
||
| Assignee | ||
Updated•6 years ago
|
Comment 18•6 years ago
|
||
Nika,
As part of the load all XUL as XHTML work (bug 1550801), I've been running into issues with a number of copy/paste tests since we can no longer only filter XUL docs to allow if copy/paste in enabled.
I think we have two options going forward:
- Change the checks that use to be IsHTMLOrXHTML to also check if the document is chrome privileged. If it is chrome privilege than we let it control copy/paste enable/disable.
or
- We could get rid of the behavior that allows XUL to control copy/paste so it behaves like XHTML.
I lean towards #1, but wanted to get your feedback before I start updating tests.
Comment 19•6 years ago
|
||
(In reply to Brendan Dahl [:bdahl] from comment #18)
I lean towards #1, but wanted to get your feedback before I start updating tests.
I don't have any super strong feelings about this, so I would be OK with either approach. Given that our chrome HTML/XHTML is supposed to act like native UI, it probably makes sense to preserve the behaviour rather than returning to web behaviour.
I wonder if it would make sense to have this as a chrome-only attribute which can be set on the document or similar, rather than using the document's principal.
ni? :ehsan who helped me make the decision ~4 years ago when it first came up.
Comment 20•6 years ago
|
||
See comment 13. The reason why this was previously tied to the document being XUL was that XUL provides the mechanism for the document to tell the UA whether copy/cut commands should be enabled or not through the XUL command controller infrastructure (hopefully I'm using the right terminology to refer to it... the code in dom/commandhandler is what I'm referring to). That infrastructure just doesn't exist in HTML at all.
Note that this has nothing to do with chrome privileges and is available to non-privileged XUL documents as well. So I don't think either of the ideas in (1) in comment 18 are exactly the equivalent of what we used to have, and (2) is non-desirable.
So Brendan, in response to your question, I'll ask, what is the plan for replacing the command controller infrastructure in HTML? Based on the answer to that question, this mechanism should be tied to where that replacement is available. I hope that makes sense. :-)
Comment 21•6 years ago
|
||
The command/broadcaster infrastructure has already been moved out of XUL and is supported in chrome privileged HTML too (bug 1486888). Whether we want to keep that around in the long term is a different question, but we do currently have the ability to control enable/disable in HTML.
Comment 22•6 years ago
|
||
(In reply to Brendan Dahl [:bdahl] from comment #21)
The command/broadcaster infrastructure has already been moved out of XUL and is supported in chrome privileged HTML too (bug 1486888).
Hmm, based on https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/xul/nsXULElement.cpp#691 this isn't entirely true... There is nothing in this code that looks at privileges that I can see. Where do we check to make sure this is restricted to chrome-privileged documents?
Whether we want to keep that around in the long term is a different question, but we do currently have the ability to control enable/disable in HTML.
Well, by HTML I meant HTML in the sense of the HTML spec. HTML + elements from the XUL namespace isn't really HTML. :-) (Not trying to nitpick over terminology of course, just clarifying what I meant... I specifically did not mean any document where IsHTMLOrXHTML() returns true for.)
Comment 23•6 years ago
|
||
(In reply to :Ehsan Akhgari from comment #22)
Hmm, based on https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/xul/nsXULElement.cpp#691 this isn't entirely true... There is nothing in this code that looks at privileges that I can see. Where do we check to make sure this is restricted to chrome-privileged documents?
XUL elements can't be created (from content) in content privileged pages.
Well, by HTML I meant HTML in the sense of the HTML spec. HTML + elements from the XUL namespace isn't really HTML. :-) (Not trying to nitpick over terminology of course, just clarifying what I meant... I specifically did not mean any document where
IsHTMLOrXHTML()returns true for.)
Yes, sorry to be clear I mean chrome privileged HTML.
Comment 24•6 years ago
|
||
(In reply to Brendan Dahl [:bdahl] from comment #23)
(In reply to :Ehsan Akhgari from comment #22)
Hmm, based on https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/xul/nsXULElement.cpp#691 this isn't entirely true... There is nothing in this code that looks at privileges that I can see. Where do we check to make sure this is restricted to chrome-privileged documents?
XUL elements can't be created (from content) in content privileged pages.
They can with the allowXULXBL permission, no? The actual condition isn't based on permissions at all: https://searchfox.org/mozilla-central/rev/fe7dbedf223c0fc4b37d5bd72293438dfbca6cec/dom/xul/nsXULElement.cpp#260.
Well, by HTML I meant HTML in the sense of the HTML spec. HTML + elements from the XUL namespace isn't really HTML. :-) (Not trying to nitpick over terminology of course, just clarifying what I meant... I specifically did not mean any document where
IsHTMLOrXHTML()returns true for.)Yes, sorry to be clear I mean chrome privileged HTML.
To the best of my knowledge, we currently have these two restrictions in Gecko:
- We create XUL elements where we grant the allowXULXBL permission, see the link above.
- We allow loading XBL bindings from system privileged or chrome:// URI stylesheets unless the document has allowXULXBL permission.
(Note that Document::AllowXULXBL() returns true for chrome-privileged documents.)
Since what bug 1486888 implemented needs to work where XUL elements can work, I think that feature needs to be gated on Document::AllowXULXBL() checks. I think that would make things work exactly the same way as they did in the browser.xul era. Can you please give that a shot and see if the tests you mentioned still fail with the fixes for bug 1550801?
Comment 25•6 years ago
|
||
For the time being, I tried gating on Document::AllowXULXBL instead, but then several other tests start failing (e.g. test_bug1067255.html) since they are plain html mochitests, but they use super powers (allowXULXBL is set to true). I still think it makes sense to gate this on system principal instead. We only really want this special behavior enabled for chrome documents and we don't need to support it in content documents. There is the case of content documents force enabling XUL/XBL, but that's only ever done in crashtests/reftests and some mochitests, so I don't see why we need to support that use case.
If you have another suggestion I'm open to trying other things.
Comment 26•6 years ago
|
||
(In reply to Brendan Dahl [:bdahl] from comment #25)
For the time being, I tried gating on Document::AllowXULXBL instead, but then several other tests start failing (e.g. test_bug1067255.html) since they are plain html mochitests, but they use super powers (allowXULXBL is set to true). I still think it makes sense to gate this on system principal instead. We only really want this special behavior enabled for chrome documents and we don't need to support it in content documents. There is the case of content documents force enabling XUL/XBL, but that's only ever done in crashtests/reftests and some mochitests, so I don't see why we need to support that use case.
If you have another suggestion I'm open to trying other things.
Ugh, sorry, I really thought that would have worked, otherwise wouldn't have made you do the work. I suppose the good shouldn't be the enemy of the perfect here. You're right, since there is no need to support that use case, let's just gate this on the system principal-ness. Does that actually solve the problem at hand?
Updated•3 years ago
|
Description
•