Last Comment Bug 622491 - Enable global scope polluter in standards mode
: Enable global scope polluter in standards mode
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: All All
: -- normal with 1 vote (vote)
: mozilla14
Assigned To: Boris Zbarsky [:bz] (still a bit busy)
:
: Andrew Overholt [:overholt]
Mentors:
http://desuchan.ru:800/aa/wakaba.html
: 658435 737760 (view as bug list)
Depends on:
Blocks: 630454 759995
  Show dependency treegraph
 
Reported: 2011-01-02 23:16 PST by Yakove
Modified: 2016-08-03 03:10 PDT (History)
17 users (show)
bzbarsky: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Make the global scope polluter work in standards mode too. (3.36 KB, patch)
2012-03-20 23:56 PDT, Boris Zbarsky [:bz] (still a bit busy)
jst: review+
Details | Diff | Splinter Review

Description Yakove 2011-01-02 23:16:27 PST
User-Agent:       Mozilla/5.0 (Windows NT 6.1; rv:2.0b9pre) Gecko/20110102 Firefox/4.0b9pre
Build Identifier: 

When added one file, should appear automatically form for uploading another one. It works on all browsers except FF

Reproducible: Always

Steps to Reproduce:
1. go to desuchan.ru/aa
2. choose file in form for uploading
3. that's all. New form does not appear
Actual Results:  
New form does not appear

Expected Results:  
You should see a new file upload form
Comment 1 David Mandelin [:dmandelin] 2011-01-03 12:13:27 PST
Is it OK to upload random files for testing purposes?
Comment 2 Yakove 2011-01-03 12:22:00 PST
(In reply to comment #1)
> Is it OK to upload random files for testing purposes?

yes, it's OK, but the form designed for images
Comment 3 Boris Zbarsky [:bz] (still a bit busy) 2011-01-03 16:48:31 PST
David, you don't have to upload anything to reproduce.  The new file control is supposed to appear as soon as you select a file in the existing file control.
Comment 4 Boris Zbarsky [:bz] (still a bit busy) 2011-01-03 17:01:06 PST
The relevant JS error is likely this:

  Error: file_2_div is not defined
  Source File: http://desuchan.ru:800/aa/wakaba.html
  Line: 1

Line 1 is useless; all the text on the page is on one line.

The relevant markup (somewhat reduced) looks like this:

  <form>
    <table>
      <tbody>
        <tr>
          <td>
            <div id="file_1_div">
              <input type="file" onchange="more_files(file_2_div);">
            </div>
            <div id="file_2_div" style="display:none">
              <input type="file" name="file_2" size="35">
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </form>

Note the bareword "file_2_div" in that event handler.  In quirks mode, we map bareword lookups on the global object to id lookups and the like.  In standards mode, which is what the page is in, we don't do that.  If I switch the page into quirks mode, everything works.

It looks to me like http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#dom-window-nameditem requires the behavior in all modes, though this part of the spec is not final and I think we should push back on having this global scope pollution in standards mode....

In any case, either using quirks mode or using getElementById if that's what you actually mean will make the page work without relying on non-standard browser behavior.
Comment 5 :Ms2ger (⌚ UTC+1/+2) 2011-01-04 04:21:26 PST
(In reply to comment #4)
> non-standard browser behavior.

That's a bit of a stretch now ;)

However, I would like it as well if we could avoid putting this horrible mess in standards mode.

For reference:

Oct 07 20:34:21 <Ms2ger>	Also, what's the cabal's opinion on making the named access on window quirks-only?
Oct 07 20:34:41 <gsnedders>	I would be amazed if that didn't break a large number of sites.
Oct 07 20:35:01 <Workshiva>	Large may not be large enough
Oct 07 20:35:08 <Ms2ger>	Gecko doesn't have it in standards mode
Oct 07 20:35:35 <gsnedders>	Ms2ger: Oh. That surprises me. Oh well.
Comment 6 Boris Zbarsky [:bz] (still a bit busy) 2011-05-20 06:01:38 PDT
*** Bug 658435 has been marked as a duplicate of this bug. ***
Comment 7 Boris Zbarsky [:bz] (still a bit busy) 2012-03-20 23:50:26 PDT
*** Bug 737760 has been marked as a duplicate of this bug. ***
Comment 8 Boris Zbarsky [:bz] (still a bit busy) 2012-03-20 23:56:43 PDT
Created attachment 607869 [details] [diff] [review]
Make the global scope polluter work in standards mode too.

I give up.  WebKit and IE are never going to change this, Ian is never going to change the spec, and sites are actually starting to depend on this now.
Comment 9 alex_mayorga 2012-03-21 07:27:13 PDT
(In reply to Boris Zbarsky (:bz) from comment #8) 
> I give up.  WebKit and IE are never going to change this, Ian is never going
> to change the spec, and sites are actually starting to depend on this now.

How about educating web masters of said sites if known?
Wouldn't that be better than caving in because the other two players are doing it wrong?

I don't even know what "Ian spec" you're referring to here, so please "take this with many grains of salt" =)
Comment 10 Boris Zbarsky [:bz] (still a bit busy) 2012-03-21 07:29:33 PDT
> How about educating web masters of said sites if known?

Have fun with that.  Start with Microsoft (see bug 737760).  And they'll just tell you that the code is perfectly per spec, which at the moment it is.

> Wouldn't that be better than caving in because the other two players are doing it wrong?

<shrug>.  I've spent several weeks of my life at this point on evangelism efforts here.  I no longer have time to spend on it, and no one else is doing anything about it.

> I don't even know what "Ian spec" you're referring to here

HTML5. Ian is the editor.
Comment 11 Johnny Stenback (:jst, jst@mozilla.com) 2012-03-21 12:02:20 PDT
Comment on attachment 607869 [details] [diff] [review]
Make the global scope polluter work in standards mode too.

As sad as this makes me, I agree we should go ahead and do this.
Comment 12 Boris Zbarsky [:bz] (still a bit busy) 2012-03-21 21:11:33 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/607f61e5b648
Comment 13 Marco Bonardo [::mak] 2012-03-22 18:05:37 PDT
https://hg.mozilla.org/mozilla-central/rev/607f61e5b648

Note You need to log in before you can comment on or make changes to this bug.