Closed
Bug 214626
Opened 22 years ago
Closed 21 years ago
[FIX]<a> tag attrib type="image/jpeg" ignored when using href="javascript:foo()" where foo() returns contents of a binary jpeg file
Categories
(Core Graveyard :: File Handling, defect, P1)
Core Graveyard
File Handling
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla1.6alpha
People
(Reporter: fasaxc, Assigned: bzbarsky)
Details
Attachments
(2 files, 1 obsolete file)
11.90 KB,
text/html
|
Details | |
23.41 KB,
patch
|
adamlock
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20030728 Mozilla Firebird/0.6 StumbleUpon/1.73
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20030728 Mozilla Firebird/0.6 StumbleUpon/1.73
when using <a type="image/jpeg" href="javascript:foo()"> where the javascript
function foo() returns the contents of a jpeg file the jpeg data is dumped as
text to the screen when I would expect the type="image/jpeg" attrib to direct
the browser to display it as a jpeg.
The same bug is present if I embed a jpeg in a html file using <img
src="javascript:foo()"> if I then click 'View image' on the context menu I
recieve the same dump however the image is correctly displayed inline.
The application of this javascript is to create a self decrypting webpage (enter
a password and the page decrypts itself via a javascript des library) so all the
images must be inlined in this fashion.
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Reporter | ||
Comment 1•22 years ago
|
||
Page with embedded image and link to embedded image.produced via <img
src="javasript:foo()"> and <a type="image/jpeg" href="javasript:foo()">
respectively. On click view image on the former the data is dumper to the
screen as text and on clicking the latter the same is true despite the type
attribute.
![]() |
Assignee | |
Comment 2•22 years ago
|
||
Taking; I've been meaning to implement this anyway. I'll do it when I get back.
Assignee: general → bz-vacation
Status: UNCONFIRMED → NEW
Component: Browser-General → File Handling
Ever confirmed: true
OS: Linux → All
Priority: -- → P1
Hardware: PC → All
Target Milestone: --- → mozilla1.6alpha
![]() |
Assignee | |
Comment 3•21 years ago
|
||
![]() |
Assignee | |
Comment 4•21 years ago
|
||
Comment on attachment 132260 [details] [diff] [review]
Proposed patch
Adam, what do you think? Is it ok to make webshell d this, or should I add
"type" to the nsILinkHandler methods and pass it from content?
Also, would it make sense to add an advisory type param to loadURI()? For now
I just added it to loadInternal....
Attachment #132260 -
Flags: review?(adamlock)
![]() |
Assignee | |
Updated•21 years ago
|
Summary: <a> tag attrib type="image/jpeg" ignored when using href="javascript:foo()" where foo() returns contents of a binary jpeg file → [FIX]<a> tag attrib type="image/jpeg" ignored when using href="javascript:foo()" where foo() returns contents of a binary jpeg file
I think the patch looks okay in principle although session history would have to
be dealt with and the XXXbz comments would need to be fixed. Changing loadURI
would require a lot of changes all over including js in Moz / Firebird etc., so
perhaps we should consider leaving that for the moment.
![]() |
Assignee | |
Updated•21 years ago
|
Attachment #132260 -
Flags: review?(adamlock) → review-
![]() |
Assignee | |
Comment 6•21 years ago
|
||
This fixes up session history and removes the XXX comments. This should be
ready to go, I think....
Attachment #132260 -
Attachment is obsolete: true
![]() |
Assignee | |
Updated•21 years ago
|
Attachment #132321 -
Flags: review?(adamlock)
Comment on attachment 132321 [details] [diff] [review]
Patch for review and all that
r=adamlock
Attachment #132321 -
Flags: review?(adamlock) → review+
![]() |
Assignee | |
Comment 8•21 years ago
|
||
Comment on attachment 132321 [details] [diff] [review]
Patch for review and all that
darin, would you review?
Attachment #132321 -
Flags: superreview?(darin)
Comment 9•21 years ago
|
||
Comment on attachment 132321 [details] [diff] [review]
Patch for review and all that
>Index: xpfe/components/shistory/public/nsISHEntry.idl
>+/** attribute to indicate the content-type of the document that this
>+ is a session history entry for **/
>+attribute ACString contentType;
nit: all other comments seem to end with a single * before the /
> /** Additional ways to create an entry */
> void create(in nsIURI aURI, in wstring aTitle, in nsIDOMDocument aDocument,
>+ in nsIInputStream aInputStream, in nsILayoutHistoryState aHistoryLayoutState,
>+ in nsISupports aCacheKey, in ACString aContentType);
nit: AString'ify aTitle? maybe save it for a later patch or can it
sometimes be null?
>Index: docshell/base/nsDocShell.cpp
>+ else {
>+ nsAutoString contentTypeHint;
>+ nsCOMPtr<nsIDOMWindow> window = do_GetInterface((nsIDocShell*)this);
>+ if (window) {
>+ nsCOMPtr<nsIDOMDocument> document;
>+ window->GetDocument(getter_AddRefs(document));
>+ nsCOMPtr<nsIDOMNSDocument> doc(do_QueryInterface(document));
>+ if (doc) {
>+ doc->GetContentType(contentTypeHint);
>+ }
>+ }
nit: be consistent in nsCOMPtr<T> initialization. either use operator=()
or ctor style for all.
sr=darin
Attachment #132321 -
Flags: superreview?(darin) → superreview+
![]() |
Assignee | |
Comment 10•21 years ago
|
||
> nit: all other comments
Yep. Fixed.
> maybe save it for a later patch
I'd rather, since it's in fact null some places and I'd need to change the
SetTitle code too...
> nit: be consistent
Fixed.
Patch checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 11•21 years ago
|
||
in combination with bug 247607's patch, this caused bug 249107. <sigh>
Updated•9 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•