Bug 33982 - Add BlobConstructor to DOMWindow
Summary: Add BlobConstructor to DOMWindow
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jian Li
Depends on:
Reported: 2010-01-21 17:56 PST by Jian Li
Modified: 2010-01-22 15:04 PST (History)
2 users (show)

See Also:

Proposed Patch (4.97 KB, patch)
2010-01-22 09:56 PST, Jian Li
darin: review+
jianli: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jian Li 2010-01-21 17:56:01 PST
We need to add BlobConstructor to DOMWindow.
Comment 1 Jian Li 2010-01-22 09:56:02 PST
Created attachment 47209 [details]
Proposed Patch
Comment 2 Darin Adler 2010-01-22 10:16:32 PST
Comment on attachment 47209 [details]
Proposed Patch

It doesn't seem right that File and Blog have the same prototype.
Comment 3 Jian Li 2010-01-22 10:42:34 PST
(In reply to comment #2)
> (From update of attachment 47209 [details])
> It doesn't seem right that File and Blog have the same prototype.

Thank you for pointing out this. Do you know what causes this problem? Should I make custom constructor?
Comment 4 Dmitry Titov 2010-01-22 12:21:40 PST
The reason the test has the output that appears to mean File and Blob have the same prototype is because it marks already-enumerated prototype objects by adding a property to them. Since File is derived from Blob, there is a chain of prototypes. If the Blob prototype is enumerated by the test earlier, the query on the File prototype will yield the same property value, even though the actual prototype object is different.

To illustrate:
window.Blob.prototype.foo = 153;
alert(window.File.prototype.foo) <-- outputs '153'

window.File.prototype.foo = 153;
alert(window.Blob.prototype.foo) <-- outputs 'undefined'

This test already does the same for all Element-derived types, like this:
window.HTMLAnchorElement.prototype [printed above as window.Element.prototype]
Comment 5 Jian Li 2010-01-22 13:41:00 PST
The infinite recursion detection logic in this layout test is broken. I have
filed a new bug (https://bugs.webkit.org/show_bug.cgi?id=34018) for this issue.

For this patch, I would rather keep the current behavior. So I reactivate this
Comment 6 Jian Li 2010-01-22 15:04:31 PST
Committed as http://trac.webkit.org/changeset/53722.