JavaScript focus() throws "Permission denied to get property XULElement.selectedIndex"

RESOLVED FIXED in mozilla1.8.1beta1

Status

()

Toolkit
Form Manager
RESOLVED FIXED
14 years ago
9 years ago

People

(Reporter: Daniel Kirsch, Assigned: Joey Minta)

Tracking

({fixed1.8.1})

Trunk
mozilla1.8.1beta1
x86
All
fixed1.8.1
Points:
---
Dependency tree / graph
Bug Flags:
blocking-firefox2 +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: swag:2d)

Attachments

(7 attachments, 2 obsolete attachments)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8

When using the focus() method on a HTML object using JavaScript, firefox 0.8
throws an "Permission Denied Exception". However the focus will be set.

<error>
Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
file:///D:/Ida/Test/focus.html :: setFocus :: line 11"  data: no]
Source File: file:///D:/Ida/Test/focus.html
Line: 11
</error>

Reproducible: Always
Steps to Reproduce:
Set the focus to an input field using the focus() method.
Actual Results:  
Exception is thrown

Expected Results:  
No Exception
(Reporter)

Comment 1

14 years ago
Created attachment 143270 [details]
Example to reproduce focus() exception on firefox 0.8

The attached example works in Firebird 0.7 but throws an exception in Firefox
0.8 (Open your JavaScript Console)

Comment 2

13 years ago
(In reply to comment #1)
I reproduced the same JS error on Mozilla/5.0 (Windows; U; Win98; en-US;
rv:1.7b) Gecko/20040321 Firefox/0.8.0+.

Similar JS error messages were obtained when I accessed to
http://www.google.co.jp/ .
The JS error messages are ;
Error: 
[Exception... "'Permission denied to get property XULElement.selectedIndex' when
calling method: 
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  
location: "JS frame :: http://www.google.co.jp/ :: <TOP_LEVEL> :: line 15" 
data: no]
Source File: http://www.google.co.jp/  Line: 15

Comment 3

13 years ago
Not sure if I should file another bug, but seems related. There seems to be a
problem with alerts as well. In particular, replacing the following line in example 

 	document.getElementById("bar").focus();

with

 	alert("bar");

produces the same exception for me. On nightlies from 03/25 and 04/05

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040325
Firefox/0.8.0+

and 

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040405
Firefox/0.8.0+


Here is the exception itself:

Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
http://bugzilla.mozilla.org/attachment.cgi?id=143270&action=view :: setFocus ::
line 11"  data: no]
Source File: http://bugzilla.mozilla.org/attachment.cgi?id=143270&action=view
Line: 11

Comment 4

13 years ago
*** Bug 240221 has been marked as a duplicate of this bug. ***

Comment 5

13 years ago
*** Bug 241944 has been marked as a duplicate of this bug. ***

Updated

13 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 6

13 years ago
Mozilla/5.0 (Windows; U; Win98; ja-JP; rv:1.8a2) Gecko/20040526 Firefox/0.8.0+

When I click "Reload" at viewing the page of http://bugzilla.mozilla.org/,
I get the same JS error message as
Error:  
[Exception... "'Permission denied to get property XULElement.selectedIndex' 
when calling method: [nsIAutoCompletePopup::selectedIndex]"  nsresult: 
"0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
http://bugzilla.mozilla.org/ :: <TOP_LEVEL> :: line 95"  data: no]
Source File: http://bugzilla.mozilla.org/   line: 95

Updated

13 years ago
Assignee: firefox → bugs
Component: General → Form Manager

Comment 7

13 years ago
*** Bug 245995 has been marked as a duplicate of this bug. ***

Comment 8

13 years ago
*** Bug 237396 has been marked as a duplicate of this bug. ***

Comment 9

13 years ago
This happens for me as well using:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040615 Firefox/0.9

For me, I'm doing the focus() onload, but I've noticed that if you delay the
focus using a timer, it doesn't throw that error.

Comment 10

13 years ago
I was getting this error as well and found that the following appears to prevent
this error from occurring.  

It seems to be an issue with autocomplete, so when changing the focus to a field
element:

<input type="text" autocomplete="OFF" name="claim_no" size="25">

does not produce an error.

Whereas, <input type="text" name="claim_no" size="25">, produces the error when
using focus().

Comment 11

13 years ago
I also got this error when setting the value of an input element to empty (e.g.
""). See bluefade.js.

Comment 12

13 years ago
Created attachment 153857 [details]
JavaScript that works correctly. But an error is thrown.

This script tries to find an input with document.getElementByID, then set its
value to empty whenever user focuses on it.

It works perfectly on Firefox, Safari, Opera and IE. But an error is thrown
when setting the value to empty:
Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]"	nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
http://144.214.120.82/bluefade.js :: hideSearchHint :: line 25"  data: no]
Source File: http://144.214.120.82/bluefade.js
Line: 25

Comment 13

13 years ago
Still having this problem with FireFox 0.9.3
here is some html that crates the problem.

I've boiled it down (in my case) that when the focus is moved from input 'c' to
another element, the autocomplete code tries to fire for input 'c', even though
input 'c' no longer has focus.  

Sample:
------------------------
<html>
<head><title>test</title></head>
<body>
<form>

  a <input type="text" name="a"/><br/>
  b <input type="text" name="b"/><br/>
  c <input  type="text" name="c" onfocus="this.form.a.focus();"/><br/>
  d <input type="text" name="d"/><br/>

</form>
</body>
</html>
-------------------------

Also why is the Autocomplete looking for 'selectedIndex'??? Especially when this
is a 'text' input box

My guess is something like this happening:

input gets focus 
 |
 |->evaluate JS onfocus() // if sends focus away, autofill gets lost?
 |
 |->try to autofill
         |
         |->switch(input.typeof){
               case ('text'): .... break;  //nope
               case ('checkbox'): .... break;  //nope
               default: // assuming selectbox because it is the only one left??
                       si = input.selectedIndex // oops selectedIndex isn't valid??

Comment 14

13 years ago
(In reply to comment #13)
> Still having this problem with FireFox 0.9.3
> here is some html that crates the problem.

Please post your build.  For example, mine is:
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.7) Gecko/20040614 Firefox/0.9

This is an awfully old build, and by all rights I shouldn't even be using it
anymore.  It may have been fixed since this build, or even 0.9.3, and we
wouldn't realize it without updating to the most recent nightly build.  You can
find your build in Help -> About.

That said, nightly builds can be less stable, and you should not use them unless
you are comfortable with them.

> Also why is the Autocomplete looking for 'selectedIndex'??? Especially when this
> is a 'text' input box
> 
> My guess is something like this happening:

I'm going to guess this is.... not correct.  First off, the error message
references an XULElement, not a HTMLElement.  This means, pretty much, that it's
not an error on YOUR element, but rather on the drop down it's trying to make
for autocomplete.  This makes sense, doesn't it?

Remember, in Firefox everything is controlled by XUL and JavaScript - even the
browser itself.

-[Unknown]

Comment 15

13 years ago
I also get the error on
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1
and on netscape 7.1.

Mozilla works fine.

Comment 16

13 years ago
Michael Young: setting autocomplete="OFF" on the input that was causing the error did *indeed* work 
for me. Thanks so much for your tip :)

Comment 17

13 years ago
*** Bug 264060 has been marked as a duplicate of this bug. ***

Comment 18

13 years ago
Confirmed that this is still a problem in PR1

Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20040913 
Firefox/0.10.1

Comment 19

13 years ago
blocking 1.0
Flags: blocking-aviary1.0+

Comment 20

13 years ago
Only aviary peers can set blocking +/- flags.. Everybody else should nominate ?
the flag for a peer ro grant or deny. :-) Clearing blocking flag. (5th flag
wrongfully set by this user today)
Flags: blocking-aviary1.0+
*** Bug 266951 has been marked as a duplicate of this bug. ***

Comment 22

13 years ago
*** Bug 270696 has been marked as a duplicate of this bug. ***

Comment 23

13 years ago
*** Bug 270657 has been marked as a duplicate of this bug. ***

Updated

13 years ago
Blocks: 272350

Comment 24

13 years ago
*** Bug 274056 has been marked as a duplicate of this bug. ***

Comment 25

13 years ago
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107
Firefox/1.0

This bug continues to annoy me.  I can confirm that it occurs when I use the
focus() method, but I even get it when simply setting a form field value.

doc=window.document;
frmElem=doc.form1.elements;
frmElem['I___STOCK_GENOTYPIC_VAR__VARIATION'].value="";

Comment 26

13 years ago
autocomplete="OFF" did not work for me. The permission error was not displayed
always but the focus was set to the address bar. This workaround (code
simplified) works for me

oLibPage.windowSetTimeout(window,'setFocus',1)

function setFocus(){
document.getElementById('myControlId').focus()
}

Comment 27

13 years ago
*** Bug 283448 has been marked as a duplicate of this bug. ***

Comment 28

13 years ago
Hello, I can confirm that this bug still exists in version 1.0.1.  It is
reproducable every time.  Clearly it is the focus() method being run in an
document.onload triggered function that causes it, as when I comment out the
focus() method, the error goes away.  Also, you can cause this error by calling
the alert() function before the document completes loading.
Also, occasionally this bug causes Firefox to crash completely.  Therefore I
recommend that severity on this bug be updated to critical.

Comment 29

13 years ago
please provide a talkback incident id (run components\talkback.exe)

Comment 30

13 years ago
*** Bug 272350 has been marked as a duplicate of this bug. ***

Comment 31

12 years ago
Clicking the left textbox of the first attachment game me this error:

------------------------------------------------------------------
Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
https://bugzilla.mozilla.org/attachment.cgi?id=143270 :: setFocus :: line 11" 
data: no]
Source File: https://bugzilla.mozilla.org/attachment.cgi?id=143270
Line: 11
-------------------------------------------------------------------

I'm on a trunk, Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2)
Gecko/20050322 Firefox/1.0+

Comment 32

12 years ago
Hi.

I've just been bitten by this bug in 1.0.3 on Linux.

The JS console says:

Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame :: http://google.co.uk/maps
:: _blur :: line 2"  data: no]
Source File: http://google.co.uk/maps
Line: 2


Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3

Comment 33

12 years ago
I encounter this bug.  I have javascript that add a piece of a form field to a
table row dynamically.  This form field is an input text field.  As suggested by
someone on the internet, I put this in the <input> tag and it goes away:

autocomplete='off'

The exception I got is:

Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
http://localhost/index.jsp:: addLine :: line 118"  data: no]
Source File: http://localhost/index.jsp
Line: 118

Comment 34

12 years ago
*** Bug 294016 has been marked as a duplicate of this bug. ***

Comment 35

12 years ago
*** Bug 295682 has been marked as a duplicate of this bug. ***

Comment 36

12 years ago
Encountered this bug as well with a piece of code that sets the value of an
input element to empty string in a focus event listener (it works fine if the
handler is set via onfocus and not via addEventListener!).
The autocomplete='off' solution fixes the problem but seems to be too harsh for
our framework.
[My build: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050206
Firefox/1.0 (Debian package 1.0+dfsg.1-5)]

Anyone working on a fix?
Kind regards, Stefan

Comment 37

12 years ago
With Firefox 1.0.3:

I'm getting this error when I use .focus() with an INPUT node of the "text" 
type. 

Using .focus() on INPUT nodes of "radio", "checkbox", and "select-one" types 
(as well as on TEXTAREA nodes) works without error.

Using .select() on INPUT nodes of the "text" type also gives the same error 
message.

Comment 38

12 years ago
Just to add my 2 cents, I'm getting the same problem in version: 

Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

I have three input fields and am changing focus in a onKeyUp event, when there are a certain number of 
characters in the field, I advance the focus to the next field - like you see sometimes when entering a 
phone number in 3 fields it will advance from area code to exchange to number automatically when the 
fields have the correct number of digits.

I am focusing by using document.getElementById () and if the item in valid calling focus:

var focusNext = document.getElementById (i_szNextId);
if (focusNext)
	focusNext.focus ();

Even when the exception gets thrown, the focus was happening.

I was able to work around the problem by using the previously mentioned possibly solution of setting 
autocomplete to off.  It makes sense in my case, but might not for others.

Hopfullly this will be solved soon!

Comment 39

12 years ago
*** Bug 300711 has been marked as a duplicate of this bug. ***

Comment 40

12 years ago
*** Bug 302873 has been marked as a duplicate of this bug. ***

Comment 41

12 years ago
Also affects SeaMonkey suite:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050730
SeaMonkey/1.0a

See bug 302873 (marked as a duplicate of this bug) for an example.

Comment 42

12 years ago
I also get this error on

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.10) Gecko/20050716
Firefox/1.0.6

Comment 43

12 years ago
the same Error message with
<input onkeyup="this.blur()">

on Linux and win
Firefox 1.0.6: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.10)
Gecko/20050717 Firefox/1.0.6
Firefox 1.0.2: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050317
Firefox/1.0.6

Comment 44

12 years ago
Suggest reword summary to:

Functions/code called from text INPUT box that call focus() element of form
elements throws "Permission denied to get property XULElement.selectedIndex"

The rest is the testing I did: I tried making a simplified testcase, but I don't
it's that much different from the initial example. Here's what I found though:

Browser version is Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10)
Gecko/20050716 Firefox/1.0.6)

<code>document.getElementById('bar').focus();</code>

* BODY: onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup,
onmousemove (and I will venture to guess that all events from body are
unaffected) and function calls from body that immediately result in focus being
pressed (guessing that all functions under any level work as long as it doesn't
result in a event).
* Testing onclick, these elements are not affected: SPAN, DIV, FONT, TD, UL (I
would venture to guess that most elements are not affected and that these
elements exhibit the same properties as BODY)
* Notably, testing onclick, TEXTAREA does not exhibit error (same hypotheses as
above)
* INPUT _is_ affected, as many others have reported, but it is only affected
when INPUT renders as a textbox.
* INPUT where type equals "button", "radio", "checkbox" (guess all other types
are unaffected)

Comment 45

12 years ago
I can't imagine this bug can still survive till now. It *IS* is usability bug
since the exception causes the browser to freeze for around 0.2-0.5 seconds,
depending on the speed of your system. Users feeling slow is a bad thing (tm).

I am noticeing this bug because I have an application which (in its correct
design) calls focus() hundreds of times in a session and users complain that it
works but very slow on Gecko-based browsers.

Since no one tried, let me request for blocking aviary2.0.
Flags: blocking-aviary2.0?

Comment 46

12 years ago
This seems to happen in Firefox 1.0.6 when focus is taken from an "input"
element of type "text" and given to form "select" element.

The following triggers this error when an input element previously had focus:
document.getElementById("select_box_id").focus();

Here is the error I get...
________________________________________
Error: [
Exception... "'Permission denied to get property XULElement.selectedIndex' when
calling method:
[nsIAutoCompletePopup::selectedIndex]"
nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"
location: "JS frame :: http://localhost/test_script.js :: switchOnKeyPress ::
line 386"
data: no
]
Source File: http://localhost/test_script.js
Line: 386
________________________________________

Comment 47

12 years ago
*** Bug 308507 has been marked as a duplicate of this bug. ***

Comment 48

12 years ago
Attachement https://bugzilla.mozilla.org/attachment.cgi?id=143270
STILL triggers this bug in 1.0.6
I need autocomplete ON so no workaround. 

(In reply to comment #46)
> This seems to happen in Firefox 1.0.6 when focus is taken from an "input"
> element of type "text" and given to form "select" element.
> 
> The following triggers this error when an input element previously had focus:
> document.getElementById("select_box_id").focus();
> 
> Here is the error I get...
> ________________________________________
> Error: [
> Exception... "'Permission denied to get property XULElement.selectedIndex' when
> calling method:
> [nsIAutoCompletePopup::selectedIndex]"
> nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"
> location: "JS frame :: http://localhost/test_script.js :: switchOnKeyPress ::
> line 386"
> data: no
> ]
> Source File: http://localhost/test_script.js
> Line: 386
> ________________________________________

Updated

12 years ago
Summary: JavaScript focus() throws "Permission Denied" error → JavaScript focus() throws "Permission denied to get property XULElement.selectedIndex"

Comment 49

12 years ago
confirmed on firefox 1.5 RC3 on mac.
autocomplet="off" does fix the problem for me :)
We should find out what is causing this, and fix it to not break web content.
Assignee: bugs → nobody
Flags: blocking-aviary2? → blocking-aviary2+
Keywords: helpwanted
QA Contact: form.manager

Comment 51

12 years ago
Bug as described still exists in Firefox 1.5 (WinXP):
Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8) Gecko/20051111 Firefox/1.5

Comment 52

12 years ago
Error: [Exception... "'Permission denied to set property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame :: http://10.0.0.10/ :: common :: line 1"  data: no]


Whenever I use focus I get the above javascript error. try/catch fails to trap it. It is a set property as oppose to get. We use focus alot in our web application and javascript console gets flatted with these errors. Is it so hard to fix?

This is happening on Firefox 1.5. Disableing auto complete does not solve it. We  open a window with no addressbar; when the addressbar is not shown, why it is still trying it?

Looks like every focus method call stops by the address text box of the browser first then travels to the destination. 

Comment 53

12 years ago
I am getting the exact same error in Firefox 1.5, windows 2000.  
With a input field where onFocus='this.blur()'.

I can only use javascript to remove that event (.onfocus = '') 
after the user tries to give the field focus.

Comment 54

12 years ago
Error goes on.

Mozilla/5.0 (Windows; U; Windows NT 5.1; es-AR; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1

Btw, autocomplete="OFF" works for me.

-Tabu-

Comment 55

12 years ago
Same here:
Mozilla/5.0 (Windows; U; Windows NT 5.0; de; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1

Comment 56

12 years ago
*** Bug 327989 has been marked as a duplicate of this bug. ***

Comment 57

12 years ago
Created attachment 212697 [details]
stacktrace

The exception gets throw because autocomplete attempts to close the (not open) popup, and as part of that clears any selection within the popup.

This is a stack from the call to ClosePopup that results in the exception (using attachment 143270 [details]).  A previous call works without the exception.  The fact that web content is effectively calling into this code at all seems a bit scary.

Comment 58

11 years ago
Just my $0.02...

I can easily reproduce this problem in Firefox 1.5.0.1 when browsing Amazon.com. The steps I use to reproduce it:

1. Visit Amazon.com.
2. Browse into the "Computer and Video Games" category.
3. Note the error in the JavaScript console.

This error apparently steals the focus from the webpage, because when I get said error, my [PgDn], [PgUp], [Spacebar], and arrow keys no longer scroll the page. Clicking the page after receiving the error will 'reset' things, so that the aforementioned keys scroll the page as intended. This is highly irritating when browsing Amazon.com, since the error seems to appear on so many pages.

Updated

11 years ago
OS: Windows XP → All
Version: unspecified → Trunk

Updated

11 years ago
Target Milestone: --- → Firefox 2 beta1

Comment 59

11 years ago
Using autocomplete="off" in text tags doesn't work for me,
because I use struts <html:text> tags to generate my input fields
and there is no way to pass the option through to the output.

Comment 60

11 years ago
I figured out that I can workaround it if I add a
function to the page onload event that does this:

	var inputs = document.getElementsByTagName("INPUT");
	for(var i=0; i<inputs.length; i++) {
		inputs[i].setAttribute('autocomplete', 'off');
	}

(I would still really like a fix for this bug)

Comment 61

11 years ago
*** Bug 255377 has been marked as a duplicate of this bug. ***

Comment 62

11 years ago
*** Bug 312873 has been marked as a duplicate of this bug. ***

Updated

11 years ago
Blocks: 338801

Updated

11 years ago
Assignee: nobody → jminta
(Assignee)

Comment 63

11 years ago
Created attachment 224211 [details]
another stack

Similar stack to the previous one that was attached.  This one includes a few more frames to show where we're actually hitting the permission denied error.  The interesting bit I think is between frames 15 and 14, where NS_IS_TRUSTED_EVENT is true.  This clashes with the later check in xpconnect for the js-context, which is untrusted here.  As said comment #57, this NS_IS_TRUSTED_EVENT bit is somewhat scary.  It's not clear to me that focus(), when fired from an untrusted script, should be a trusted event.

In terms of a toolkit fix, I think the best we could do would be a band-aid, to try to avoid having to cross the xpconnect boundary because i don't see a good, safe way to elevate privs enough to let ClosePopup() work nicely.
(Assignee)

Comment 64

11 years ago
CC'ing some folks for help answering the trusted events/js-context caps stuff here to figure out who's really at fault, the event dispatcher for firing a trusted event or the script-security manager for being overly strict.
(Assignee)

Updated

11 years ago
Whiteboard: swag:2d

Comment 65

11 years ago
Created attachment 224439 [details] [diff] [review]
band aid

I'm really not sure if we want to take this kind of fix.
Although, atm I don't know any other simple and secure way to do it.
(Pushing a null JSContext wouldn't be safe in this case, I think, but I'm not 
familiar enough with that.)
Attachment #224439 - Flags: review?(mconnor)

Comment 66

11 years ago
Created attachment 224442 [details] [diff] [review]
Using null context

Or why not? XBL uses anyway the context of the bound element.
Attachment #224439 - Attachment is obsolete: true
Attachment #224442 - Flags: review?(jst)
Attachment #224439 - Flags: review?(mconnor)

Comment 67

11 years ago
Comment on attachment 224442 [details] [diff] [review]
Using null context

Still too scary patch.
Sorry for spamming
Attachment #224442 - Flags: review?(jst)

Updated

11 years ago
Attachment #224442 - Attachment is obsolete: true
(Assignee)

Comment 68

11 years ago
Created attachment 224717 [details] [diff] [review]
another bandaid

This bandaid patch adds an additional tracker for whether or not the popup has been opened.  In these testcases, the popup was actually never opened, so there really isn't a point in closing it.  You might ask why we don't ask the popup itself whether or not its open, since autocomplete popups do expose this?  The answer is that even asking this question involves crossing the xpconnect barrier, triggering a similar error to the one here.

I'm still scared that there's more going on here at a deeper level, but mconnor suggested letting smaug split that out into another bug, if he's willing.
Attachment #224717 - Flags: review?
Attachment #224717 - Flags: approval-branch-1.8.1?(mconnor)
(Assignee)

Updated

11 years ago
Attachment #224717 - Flags: review? → review?(mconnor)

Updated

11 years ago
Attachment #224717 - Flags: review?(mconnor)
Attachment #224717 - Flags: review+
Attachment #224717 - Flags: approval-branch-1.8.1?(mconnor)
Attachment #224717 - Flags: approval-branch-1.8.1+
(Assignee)

Comment 69

11 years ago
Patch landed on trunk and 1.8 branch.  Would love to get this bandaid verified asap.
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20060607 Minefield/3.0a1 ID:2006060712 [cairo]

testcase Bug 326345 ( https://bugzilla.mozilla.org/attachment.cgi?id=168410 )is WFM now 

Updated

11 years ago
Depends on: 341309
No longer depends on: 341309

Comment 71

11 years ago
*** Bug 318118 has been marked as a duplicate of this bug. ***
*** Bug 342147 has been marked as a duplicate of this bug. ***

Comment 73

11 years ago
Error: [Exception... "'Permission denied to set property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame :: https://x.x.x.x/xx/x/zzzz.js :: anonymous :: line 328"  data: no]
Source File: https://x.x.x.x/xx/x/zzzz.js
Line: 328

From lastest nightly of Bon Echo. Is the fix going to be included in Firefox 2.0? or this is another bug?

also refere to Comment #52 
(Assignee)

Comment 74

11 years ago
(In reply to comment #73)
> Error: [Exception... "'Permission denied to set property
> XULElement.selectedIndex' when calling method:
> [nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
> (NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
Can you please attach a testcase?

Comment 75

11 years ago
I am unable to reproduce it!(darn). I don't know where it popped up in 20 thousands lines of code. I will post a test case if I meet it again. Isn't that exception saying anything at all? There is even a line number ;). Anyhow, as far as the current state goes, the that constant exception flow is gone. thanks for the fix.

Comment 76

11 years ago
Here is some code to reproduce the error:
You open the HTML page an type a text in the first edit box.

<html>
<body>

<script type="text/javascript" LANGUAGE="JavaScript">
function focusNext(elmnt) {
	elts = elmnt.form.elements;
	elts[1].focus();
}
</script>
	
	<form name="t">
		<input type="text" name="t1" onKeyPress="return focusNext(this, event);">,
		<input type="text" name="t2">
	</form>

</body>
</html>

Comment 77

11 years ago
Oliver, please file a separate bug on that issue and make it block this bug. Thanks!
Keywords: helpwanted

Comment 78

11 years ago
I have this bug even when my js are not using the focus method explicitly.

This is the portion of my js which firefox says, throws the exception:

        document.getElementById('submit' + keyPressed).click();

        document.forms[0].elements.['submit' + keyPressed].click();

Both are two approaches to get the same result; both throws the exception, the first time the page is requested.

This is the firefox information:
    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010    firefox/2.0

The html elements i'm trying to interact with are submits i tried using the autocomplete="false" workaraound but it didn't work at all.

Updated

10 years ago
Duplicate of this bug: 379035

Comment 80

10 years ago
I seem to have the same bug in 2.0.0.9

Attached a test case which seems to have the error only showing up when the id of the element has a '.' in it.



Comment 81

10 years ago
Created attachment 287527 [details]
test case showing up the bug when the id of the element contains a '.'

Comment 82

9 years ago
Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14

I'm still having this problem here.
The "autocomplete" workaround don't work for me.

Should this bug be reopened or this is because the fix is not in 2.0.0.14 yet ??

Thank you.
Product: Firefox → Toolkit

Comment 83

9 years ago
Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3

I'm having this problem with FF 3.0.3. 
See the attachment. When typing a value in the first field, the JS c
Permission denied to get property XULElement.popUpOpen
Permission denied to set property XULElement.selectedIndex

The errors only occurs when I enter a value that I have entered before (triggering the autocomplete on the field), and when the name of the field is the same as before (i.e. when the name of the first field is changed, the errors no longer occur). 

The autocomplete workaround is working for me when I set autocomplete="off" on the field where the cursor is coming from. However, I think this bug should be reopened, as it is clearly not fixed in 3.0.

Comment 84

9 years ago
Created attachment 345454 [details]
Test case with an onfocus() call in a autotab-style javascript function

Comment 85

9 years ago
I am getting the error when calling textInput.blur() :

Permission denied to get property XULElement.selectedIndex

Should this be reopened, or is that a different bug?
When in doubt, always file a new bug.

Comment 87

9 years ago
Filed bug 472422. Also see bug 470968.

Comment 88

9 years ago
Was this bug ever fixed in an official release?
It's pretty annoying that Firefox litters Firebug with these XULElement.openPopup and XULElement.selectedIndex errors. And in turn people litter Bugzilla with lots of duplicate reports of this bug :P.

The errors seem to appear more often in Firefox 3 when using the awesomebar (url autocomplete), focussing a textedit and then blurring it.
Using setAttribute('autocomplete', 'off') after each createElement('input') fixed the symptoms in our cms/framework.
You need to log in before you can comment on or make changes to this bug.