<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>16644</bug_id>
          
          <creation_ts>2007-12-28 11:42:16 -0800</creation_ts>
          <short_desc>REGRESSION (r28880-r28886): Global variable access</short_desc>
          <delta_ts>2008-04-03 12:48:52 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://netvibes.com/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, NeedsReduction, Regression</keywords>
          <priority>P1</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Woody Gilk">woody.gilk</reporter>
          <assigned_to name="Geoffrey Garen">ggaren</assigned_to>
          <cc>abarth</cc>
    
    <cc>cameowood</cc>
    
    <cc>collinj</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>dev+webkit</cc>
    
    <cc>eric</cc>
    
    <cc>ggaren</cc>
    
    <cc>jon</cc>
    
    <cc>nvdtech</cc>
    
    <cc>oliver</cc>
    
    <cc>sam</cc>
    
    <cc>sdimitrovski</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>65476</commentid>
    <comment_count>0</comment_count>
    <who name="Woody Gilk">woody.gilk</who>
    <bug_when>2007-12-28 11:42:16 -0800</bug_when>
    <thetext>If you visit netvibes.com with WebKit, r28886 or later, it will cause 3 JS &quot;TypeError: value undefined&quot; errors.

This regression is not present in r28880 and earlier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65660</commentid>
    <comment_count>1</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-12-29 19:30:19 -0800</bug_when>
    <thetext>The bisect-builds script reports:
Works: r28880  Fails: r28886

Revision r28884 looks most suspicious.
http://trac.webkit.org/projects/webkit/changeset/28884

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65662</commentid>
    <comment_count>2</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-12-29 19:31:15 -0800</bug_when>
    <thetext>&lt;rdar://problem/5665251&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65679</commentid>
    <comment_count>3</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-12-29 21:32:58 -0800</bug_when>
    <thetext>The initial &quot;TypeError: value undefined&quot; error occurs on this statement:

HTMLElement.prototype.htmlElement=function(){};

The cause is that HTMLElement.prototype is undefined.  HTMLElement is defined as this when the statement is run:

function () 
{
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65681</commentid>
    <comment_count>4</comment_count>
      <attachid>18176</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-12-29 21:49:52 -0800</bug_when>
    <thetext>Created attachment 18176
Reduction

This is a reduction of the original JavaScript from the web site.

With Safari 3.0.4 (523.12.2) with original WebKit on Mac OS X 10.4.11 (8S165), loading the test case, then loading this URL:

javascript:alert(HTMLElement)

Produces:

[object HTMLElementConstructor]

And thus the code in the if() statement never runs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65682</commentid>
    <comment_count>5</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-12-29 21:51:51 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; With Safari 3.0.4 (523.12.2) with original WebKit on Mac OS X 10.4.11 (8S165),
&gt; loading the test case, then loading this URL:
&gt; 
&gt; javascript:alert(HTMLElement)
&gt; 
&gt; Produces:
&gt; 
&gt; [object HTMLElementConstructor]
&gt; 
&gt; And thus the code in the if() statement never runs.

Ignore that.  The local debug build of WebKit r29032 does this as well.  The issue lies somewhere else.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65684</commentid>
    <comment_count>6</comment_count>
      <attachid>18177</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-12-29 22:00:08 -0800</bug_when>
    <thetext>Created attachment 18177
Better reduction

If the &quot;var HTMLElement = function(){};&quot; statement is removed (or commented out), the test passes.

However, having that statement inside the if() block causes the if() condition to return true, which I find to be completely bizarre.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65687</commentid>
    <comment_count>7</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2007-12-29 22:29:50 -0800</bug_when>
    <thetext>This is almost certainly due to r28884

As an educated guess the problem is like to be that in:
if (typeof HTMLElement == &apos;undefined&apos;) {
    var HTMLElement=function(){};
    document.write(&quot;FAIL&quot;);
} else {
    document.write(&quot;PASS&quot;);
}

the references to HTMLElement are replaced with fast indexed lookups into the symbol table, however when the symbol table is initialised it does not allow for the potential for these variables to be present on the global object, and just assumes that they are all undefined by default.I would guess that the fix would be to have the global symbol table be initalised from the values in the global object if there are any attempts to shadow any of the ghlobal objects properties.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65759</commentid>
    <comment_count>8</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-12-30 09:43:47 -0800</bug_when>
    <thetext>The Netvibes site uses Mootools v1.11 as well.  See Bug 16605 and Bug 16679.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66031</commentid>
    <comment_count>9</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-01-02 07:37:13 -0800</bug_when>
    <thetext>*** Bug 16702 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66848</commentid>
    <comment_count>10</comment_count>
    <who name="Matt Lilek">dev+webkit</who>
    <bug_when>2008-01-10 17:38:17 -0800</bug_when>
    <thetext>This broke Lively Kernel as well - http://research.sun.com/projects/lively/index.xhtml</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66919</commentid>
    <comment_count>11</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2008-01-11 09:58:22 -0800</bug_when>
    <thetext>Great diagnosis, Oliver and Dave.

I think it would be best not to make an entry in the symbol table at all. In order to make an entry, you would need to know (a) that the existing property was DontDelete and (b) that it was a permanent property, and not any of the many global properties that come and go and return different values at different times.

Maybe we can figure out how to optimize this case down the line, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66924</commentid>
    <comment_count>12</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2008-01-11 10:30:55 -0800</bug_when>
    <thetext>*** Bug 16813 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66958</commentid>
    <comment_count>13</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2008-01-11 13:16:31 -0800</bug_when>
    <thetext>This is a very challenging bug. FF does what I suggested in Comment #11. IE 6 &amp; 7, though, match current TOT, while Opera is somewhere in the middle. It&apos;s not clear what correct behavior would be, but I tend to prefer IE&apos;s behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66959</commentid>
    <comment_count>14</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-01-11 13:25:45 -0800</bug_when>
    <thetext>(In reply to comment #13)
&gt; This is a very challenging bug. FF does what I suggested in Comment #11. IE 6 &amp;
&gt; 7, though, match current TOT, while Opera is somewhere in the middle. It&apos;s not
&gt; clear what correct behavior would be, but I tend to prefer IE&apos;s behavior.
&gt; 

Remember to check the lively kernel when fixing this :D

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66960</commentid>
    <comment_count>15</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-01-11 13:54:46 -0800</bug_when>
    <thetext>(In reply to comment #13)
&gt; This is a very challenging bug. FF does what I suggested in Comment #11. IE 6 &amp;
&gt; 7, though, match current TOT, while Opera is somewhere in the middle. It&apos;s not
&gt; clear what correct behavior would be, but I tend to prefer IE&apos;s behavior.

Does Brendan Eich have a bugs.w.o account?  ;)  On a more serious note, perhaps he hangs out on one of the Mozilla IRC channels on irc.freenode.net?

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67009</commentid>
    <comment_count>16</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2008-01-11 23:20:45 -0800</bug_when>
    <thetext>Committed revision 29428.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67045</commentid>
    <comment_count>17</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-01-12 10:52:16 -0800</bug_when>
    <thetext>*** Bug 16605 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67047</commentid>
    <comment_count>18</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-01-12 10:56:55 -0800</bug_when>
    <thetext>*** Bug 16679 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76257</commentid>
    <comment_count>19</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-04-03 12:48:52 -0700</bug_when>
    <thetext>Ick.  FF&apos;s behavior seems poor here.  Ours is even worse (since we seem to silently fail instead of throwing an exception).  CCing myself with the intention of at least re-writing these tests to use the modern JS testing framework so that they run in FF and we can confirm that our behavior matches (which I&apos;m not sure it does 100%).</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>18176</attachid>
            <date>2007-12-29 21:49:52 -0800</date>
            <delta_ts>2007-12-29 22:00:08 -0800</delta_ts>
            <desc>Reduction</desc>
            <filename>bug-16644-test.html</filename>
            <type>text/html</type>
            <size>298</size>
            <attacher name="David Kilzer (:ddkilzer)">ddkilzer</attacher>
            
              <data encoding="base64">PHNjcmlwdD4Kd2luZG93LndlYmtpdCA9IHRydWU7CmlmKHR5cGVvZiBIVE1MRWxlbWVudD09J3Vu
ZGVmaW5lZCcpewogICAgdmFyIEhUTUxFbGVtZW50PWZ1bmN0aW9uKCl7fTsKICAgIGlmKHdpbmRv
dy53ZWJraXQpZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiaWZyYW1lIik7CiAgICBIVE1MRWxlbWVu
dC5wcm90b3R5cGU9KHdpbmRvdy53ZWJraXQpP3dpbmRvd1siW1tET01FbGVtZW50LnByb3RvdHlw
ZV1dIl06e307Cn0KSFRNTEVsZW1lbnQucHJvdG90eXBlLmh0bWxFbGVtZW50PWZ1bmN0aW9uKCl7
fTsKPC9zY3JpcHQ+Cg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>18177</attachid>
            <date>2007-12-29 22:00:08 -0800</date>
            <delta_ts>2007-12-29 22:00:08 -0800</delta_ts>
            <desc>Better reduction</desc>
            <filename>bug-16644-test-v2.html</filename>
            <type>text/html</type>
            <size>161</size>
            <attacher name="David Kilzer (:ddkilzer)">ddkilzer</attacher>
            
              <data encoding="base64">PHNjcmlwdD4KaWYgKHR5cGVvZiBIVE1MRWxlbWVudCA9PSAndW5kZWZpbmVkJykgewogICAgdmFy
IEhUTUxFbGVtZW50PWZ1bmN0aW9uKCl7fTsKICAgIGRvY3VtZW50LndyaXRlKCJGQUlMIik7Cn0g
ZWxzZSB7CiAgICBkb2N1bWVudC53cml0ZSgiUEFTUyIpOwp9Cjwvc2NyaXB0Pgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>