Open
Bug 299526
Opened 20 years ago
Updated 3 years ago
Context menu not blocked on scrollbars when JS is turned off globally
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Core
DOM: UI Events & Focus Handling
Tracking
()
NEW
People
(Reporter: neil, Unassigned)
Details
(Keywords: regression)
Steps to reproduce problem:
1. Load a page with scrollbars (textarea, iframe or long page)
2. Enable JavaScript
3. Right-click on a scrollbar
4. Disable JavaScript
5. Right-click on a scrollbar
Expected result: no context menus appear
Actual result: context menu appears when JS is globally disabled
Additional information: scrollcorner doesn't seem to block context menu at all.
Comment 1•20 years ago
|
||
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050629
Firefox/1.0+
WFM
Comment 2•20 years ago
|
||
Could this be related to bug #228144?? Only if I could make sense of what the
reporter meant about "Expected Results:" but I understood the "Actual Results:"..
![]() |
||
Comment 3•20 years ago
|
||
So should the scrollbar block the event with a declarative <handler> rather than via script?
Reporter | ||
Comment 4•20 years ago
|
||
(In reply to comment #3)
>So should the scrollbar block the event with a declarative <handler> rather
>than via script?
Except a) disabling scripts also disables declarative handlers b) we use the same <handler> for preventdefault (declarative) and preventBubble() (script).
![]() |
||
Comment 5•20 years ago
|
||
> disabling scripts also disables declarative handlers
Er... it does? I was under the impression that it did not (eg the middle-paste-on-scrollbar fix uses declarative handlers to work even when script is off).
> and preventBubble() (script)
There is no declarative way to preventBubble?
Reporter | ||
Comment 6•20 years ago
|
||
Well, nsXBLBinding::InstallEventHandlers() is pretty much wrapped inside an if (AllowScripts()) block. This has only been a problem since you beefed up AllowScripts() for bug 292591.
There is no declarative equivalent to preventBubble(), but then if JS is disabled it doesn't really matter.
![]() |
||
Comment 7•20 years ago
|
||
> Well, nsXBLBinding::InstallEventHandlers() is pretty much wrapped inside an if
> (AllowScripts()) block.
Hmm... So it is. Perhaps we should change that and do the AllowScripts() check in the handler execution itself before running any JS?
But then I don't see why bug 301873 is fixed by the patches in it (or by the patch for bug 70698 on the trunk)...
Reporter | ||
Comment 8•20 years ago
|
||
Although it would work on 1.7.x it's still failing on trunk for me.
![]() |
||
Comment 9•20 years ago
|
||
Ah, I see. For editor scrollbars we do it in the C++...
Though at this point I'm confused. The scrollbar binding is a chrome binding, is it not? I'd pretty purposefully tried to not break those in bug 292591 -- see bug 292591 comment 18, last paragraph...
I wonder what gives here.
![]() |
||
Comment 10•20 years ago
|
||
And I can't reproduce this with current seamonkey trunk (either classic or modern theme). Should I look for a branch seamonkey build?
Reporter | ||
Comment 11•20 years ago
|
||
Sorry for jumping to conclusions earlier.
This is a combination of disabling JavaScript (which prevents the preventBubble) and dom.event.contextmenu.enabled (which prevents the preventDefault).
![]() |
||
Comment 12•20 years ago
|
||
But why is preventBubble prevented, given that this is a chrome binding?
Reporter | ||
Comment 13•20 years ago
|
||
Because nsScriptSecurityManager::CanExecuteScripts returns PR_FALSE.
Reporter | ||
Comment 14•20 years ago
|
||
(bindings execute with the principals of the bound, not binding, document)
Reporter | ||
Comment 15•20 years ago
|
||
If we could somehow make all xbl bindings on native anonymous content have the system principal then we could make scrollbars truly anonymous (which currently breaks because the constructor needs to access the element or something).
![]() |
||
Comment 16•20 years ago
|
||
> Because nsScriptSecurityManager::CanExecuteScripts returns PR_FALSE.
What's the caller of this method? Note that nsXBLBinding::AllowScripts uses the principal of the binding document for the check. So is this some other CanExecuteScripts check?
I also question why that pref affects preventDefault. I agree that it should affect preventDefault for unprivileged script, but privileged content (eg chrome XBL as in this case) should be able to block the context menu no matter what the pref is set to. Perhaps we need a separate bug on that.
Reporter | ||
Comment 17•20 years ago
|
||
I don't know why that pref was implemented in the way that it was, but it means that calling preventDefault on a context menu event has no effect.
From memory nsScriptSecurityManager::CanExecuteScripts is
called from nsScriptSecurityManager::CheckFunctionAccess
called from nsJSContext::CallEventHandler
called from nsJSEventListener::HandleEvent
called from nsXBLPrototypeHandler::ExecuteHandler
called from nsXBLEventHandler::HandleEvent
![]() |
||
Comment 18•20 years ago
|
||
> I don't know why that pref was implemented in the way that it was, but it means
> that calling preventDefault on a context menu event has no effect.
Right. I'm proposing we change that so it checks who the caller is, and have chrome XBL doing a declarative preventDefault push a null JSContext on the JS context stack, or something...
> From memory nsScriptSecurityManager::CanExecuteScripts is
> called from nsScriptSecurityManager::CheckFunctionAccess
> called from nsJSContext::CallEventHandler
Right. Not much we can do about that, I guess. :( Not without changing a lot of the arch of XBL.
Reporter | ||
Comment 19•20 years ago
|
||
(In reply to comment #18)
>Right. I'm proposing we change that so it checks who the caller is, and have
>chrome XBL doing a declarative preventDefault push a null JSContext on the JS
>context stack, or something...
I'm not sure what you mean by "it" here - I guess you'll need a new subclass of nsDOMEvent whose preventDefault method checks for content JS on the stack.
![]() |
||
Comment 20•20 years ago
|
||
Whatever class it is whose preventDefault method at the moment checks that pref is "it". Before checking the pref, it would check who's calling.
Reporter | ||
Comment 21•20 years ago
|
||
The pref is currently checked for by the context menu event listener.
![]() |
||
Comment 22•20 years ago
|
||
Er... you mean it just ignores the fact that the event was prevented? That sucks. A lot. :( Could we file a bug to fix it?
Reporter | ||
Comment 23•20 years ago
|
||
I suppose it would be too confusing to morph this one?
![]() |
||
Comment 24•20 years ago
|
||
Hmm... I guess this bug doesn't cover anything else, eh? ;) Let's do it.
Updated•16 years ago
|
Assignee: events → nobody
QA Contact: ian → events
Assignee | ||
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•