Closed Bug 380025 Opened 17 years ago Closed 17 years ago

document.domain

Categories

(Firefox :: General, defect)

2.0 Branch
x86
All
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 326337

People

(Reporter: attila.toth, Unassigned)

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
Build Identifier: Firefox 2.0.0.3

If the value of document.domain is not set it vorks fine:
(Sample)
http://chat.citromail.hu/simpleclient/firefox_test.html

But if the value of document.domain is set to citromail.hu it crashes:
(Sample) 
http://chat.citromail.hu/simpleclient/firefox_domain_test.html
 
So if the value of document.domain is changed the code below is not working:
 
   var doc = document.implementation.createDocument("","",null);

In the doc generated by the code above you cannot create any element because it gives back permission denied.
 
 var root = doc .createElement('gods');
 
If document.domain is set in the answer of the XHR request you cannot reach the resonseXML too. You can pass it the code below :
 
 var body = (new DOMParser()).parseFromString(adat.responseText, "text/xml");

but it is too slow.

Reproducible: Always

Steps to Reproduce:
If the value of document.domain is not set it vorks fine:
(Sample)
http://chat.citromail.hu/simpleclient/firefox_test.html

But if the value of document.domain is set to citromail.hu it crashes:
(Sample) 
http://chat.citromail.hu/simpleclient/firefox_domain_test.html
 
So if the value of document.domain is changed the code below is not working:
 
   var doc = document.implementation.createDocument("","",null);

In the doc generated by the code above you cannot create any element because it gives back permission denied.
 
 var root = doc .createElement('gods');
 
If document.domain is set in the answer of the XHR request you cannot reach the resonseXML too. You can pass it the code below :
 
 var body = (new DOMParser()).parseFromString(adat.responseText, "text/xml");

but it is too slow.


Expected Results:  
If the value of document.domain is not set it vorks fine:
(Sample)
http://chat.citromail.hu/simpleclient/firefox_test.html

But if the value of document.domain is set to citromail.hu it crashes:
(Sample) 
http://chat.citromail.hu/simpleclient/firefox_domain_test.html
 
So if the value of document.domain is changed the code below is not working:
 
   var doc = document.implementation.createDocument("","",null);

In the doc generated by the code above you cannot create any element because it gives back permission denied.
 
 var root = doc .createElement('gods');
 
If document.domain is set in the answer of the XHR request you cannot reach the resonseXML too. You can pass it the code below :
 
 var body = (new DOMParser()).parseFromString(adat.responseText, "text/xml");

but it is too slow.
I see a difference in behaviour between Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.4pre) Gecko/2007050204 BonEcho/2.0.0.4pre and Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a5pre) Gecko/20070508 Minefield/3.0a5pre ID:2007050804 [cairo]

Reporter, please can you try a nightly trunk build?

http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
Severity: critical → major
Version: unspecified → 2.0 Branch
WFM, Firefox trunk 2007050701 on Linux.
Severity: major → normal
Fixed on trunk in the range:  2006-02-02 05:00 -- 2006-02-03 04:00
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2006-02-02+04%3A00&maxdate=2006-02-03+06%3A00&cvsroot=%2Fcvsroot
(bug 324600?)

The 2006-02-02-05 build says in Error Console:
Error: uncaught exception: [Exception... "Access to restricted URI denied"  code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"  location: "http://chat.citromail.hu/simpleclient/firefox_domain_test.html Line: 66"]
OS: Windows XP → All
Steve,

It is not good.
It gives back this error message and (the ** marked line is the error line), but it is independent from the value of document.domain. It is wrong if document.domain is not set (the firefox 2 handles this good if document.domain is turned off)
 
 
Error: [Exception... "Could not convert JavaScript argument arg 2 [nsIDOMDOMImplementation.createDocument]"  nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame :: http://chat.citromail.hu/simpleclient/simpleclient_elemei/xmlextras.js :: anonymous :: line 136"  data: no]
Source File: http://chat.citromail.hu/simpleclient/simpleclient_elemei/xmlextras.js
Line: 136
 
function XmlDocument() {}
XmlDocument.create = function () {
  if (document.implementation && document.implementation.createDocument) {

**   var doc = document.implementation.createDocument("","",null); **

   if (doc.readyState == null) {
    doc.readyState = 1;
    doc.addEventListener("load", function () {
     doc.readyState = 4;
     if (typeof doc.onreadystatechange == "function")
      doc.onreadystatechange();
    }, false);
   }
   return doc;
  }
  if (window.ActiveXObject)
   return new ActiveXObject(getDomDocumentPrefix() + ".DomDocument");
};


Try with this HTML:
http://chat.citromail.hu/simpleclient/simpleclient.html
Login and pass is ok, just press login. You can try this other browsers (IE, OPERA...) and it is working.

Yeah, fixed on trunk by one of the numerous principal API/arch changes.  Those aren't landing on the branch, sorry.
Sorry, my english is a bit rookie. You mean that this bug will be fixed only the later 3.xx Firefox versions? 
If yes how can we solve this problem?
> You mean that this bug will be fixed only the later 3.xx Firefox versions? 

Yes.

I'm not sure what you can do to solve the problem in Firefox 2.x short of not using document.domain, to be honest...
Hi,

We tried this:
http://alexander.kirk.at/2006/07/27/firefox-15-xmlhttprequest-reqresponsexml-and-documentdomain/
and seems to be working but crashes in an xhr sending without any err. message.

If we turned the document.domain off at the sample HTML
http://chat.citromail.hu/simpleclient/simpleclient.html
with FF 2.0.0.3 it is running.

We tried on the latest Minefield and it stops, without message...
OK.  I read the original bug report carefully.  It's a combination of the DOMImplementation stuff we fixed and bug 326337.  Resolving accordingly.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.