Closed
Bug 202817
Opened 23 years ago
Closed 23 years ago
Clicking on a link that returns a file of non-trivial mimetype results in an attempt to download rather than view, even if viewing is possible
Categories
(Core Graveyard :: Embedding: GTK Widget, defect, P1)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla1.4beta
People
(Reporter: mozillabugs.philipl, Assigned: bzbarsky)
References
()
Details
(Keywords: regression)
Attachments
(2 files, 1 obsolete file)
|
117.14 KB,
image/pjpeg
|
Details | |
|
8.58 KB,
patch
|
blizzard
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
This is reproduceable in TestGtkEmbed with both gtk1 and gtk2 embedding (and
galeon, where problem was originally observed).
In the last two weeks or so, something has changed, causing normally handled
mimetypes such as image/pjpeg and application/pdf (with acrobat plugin) to fail
to be handled if links to them are clicked on normally. On the other hand, if
the url is typed into the url box so that |gtk_moz_embed_load_url| is called,
the mimetype is handled in the correct manner.
As such, this appears to be not so much gtkmozembed going wrong, but it failing
to account for some change in backend behaviour that has occured.
This is not simply a failure to recognise plugins, image/pjpeg is handled
internally by mozilla, so there is obviously some core list of mimetypes which
is being referred to to decide on displayability, rather than the comprehensive
list. I seem to recall a hardcoded list of basic mimetypes being used somewhere
in the depths of gecko.
| Assignee | ||
Comment 1•23 years ago
|
||
There are several such lists.. but there have been no changes to any of this
code, really, with the exception of bug 201618 (which was not supposed to change
any behavior).
Does backing that patch out fix things for you? If not, any chance of narrowing
the regression window?
| Reporter | ||
Comment 2•23 years ago
|
||
Well, backing it out does fix the problem... It's obviously a little more than a
reorganisation...
| Assignee | ||
Comment 3•23 years ago
|
||
Taking, since this looks like it's mine...
Assignee: blizzard → bzbarsky
Keywords: regression
Priority: -- → P1
Target Milestone: --- → mozilla1.4beta
| Assignee | ||
Comment 4•23 years ago
|
||
| Assignee | ||
Comment 5•23 years ago
|
||
Well, I've figured out the problem... the old code had this hack for getting
helper apps to work -- if no listener were found, it would ask the docshell to
handle the load anyway and then when the docshell bailed it would pass the load
the the helper app service.
I changed this to just go to the helper app service directly if we have no
internal listeners.
This uncovered a bug in the GTK embedding widget, however... In particular, see
http://lxr.mozilla.org/seamonkey/source/docshell/base/nsDSURIContentListener.cpp#125
(nsDSURIContentListener::IsPreferred -- this is called when loading via a link
click). In the embedding case, the parentListener is a EmbedContentListener --
see
http://lxr.mozilla.org/seamonkey/source/embedding/browser/gtk/src/EmbedContentListener.cpp#83
Oops. That list is kinda short... and should not exist, imo.
Pre my change we would not find a listener, then magically succeed in handling
the load when it was punted back to the docshell. Which is _very_ wrong -- the
docshell may say it doesn't want a load even if it _could_ handle it -- that's
what the IsPreferred setup is for.
The only reason that loading via a non-click works is that in that case the
docshell does not go up to its parent listener to find out whether to load the
content -- it just looks for a content viewer directly (see CanHandleContent).
The problem I see is that the parent has no way to tell its child "oh, just
decide on your own without me" at the moment. And this parent listener needs to
exist in order to handle the OnStartURIOpen notification.
I'm considering adding a success nsresult value that the parent listener could
return to indicate to the child listener to just decide on its own. Then
EmbedContentListener should just use that instead of what it does now....
Thoughts?
| Assignee | ||
Comment 6•23 years ago
|
||
Problem is, of course, that nsIURIContentListener is in fact frozen. I'm not
sure whether the change I propose constitutes an API change or not... (I sorta
think it does, actaully). And it's not clear to me where I could put the
nsresult value so embedders could get at it -- there seems to be no
error-definition header in docshell/...
I suppose I could just put the old behavior back in place, but it's pretty
broken, imo....
| Assignee | ||
Comment 7•23 years ago
|
||
Mental notes:
embedding/browser/photon/src/EmbedContentListener.cpp copied this code and needs
the same fix we do for gtk.
xpfe/components/xremote/src/XRemoteContentListener.cpp just seems confused
(returning NS_OK without setting the out param is just WRONG).
xpfe/browser/resources/content/nsBrowserContentListener.js should be forwarding
isPreferred to the docshell, imo.
embedding/browser/activex/src/control/WebBrowserContainer.cpp does the same
check for a content viewer that the docshell itself does; perhaps the other
embedding listeners should do the same?
Comment 8•23 years ago
|
||
can you just replace that list with a query to the category manager (the
Gecko-Content-Viewers category)? that list should include all types that mozilla
can render (including plugins).
| Assignee | ||
Comment 10•23 years ago
|
||
| Assignee | ||
Comment 11•23 years ago
|
||
Comment on attachment 121293 [details] [diff] [review]
Seems like the sanest way to go
Reviews?
I'll not be around tonight, so if this gets reviews, could someone check it in?
Attachment #121293 -
Flags: superreview?(darin)
Attachment #121293 -
Flags: review?(blizzard)
Comment 12•23 years ago
|
||
Comment on attachment 121293 [details] [diff] [review]
Seems like the sanest way to go
>Index: embedding/browser/photon/src/EmbedContentListener.cpp
>+ return CanHandleContent(aContentType, PR_TRUE, aDesiredContentType,
>+ aCanHandleContent);
tabs ok?
> EmbedContentListener::CanHandleContent(const char *aContentType,
...
> {
>+ if (aContentType) {
...
>+ if (NS_FAILED(rv) && rv != NS_ERROR_NOT_AVAILABLE)
>+ return rv;
>+
>+ if (value && *value)
>+ *_retval = PR_TRUE;
>+ }
>+ return NS_OK;
hmm... if rv == NS_ERROR_NOT_AVAILABLE wouldn't you leave _retval
unassigned? that seems bad.
maybe:
*_retval = (value && *value);
then you are ok. also what does it mean for aContentType == nsnull?
does returning NS_OK without assigning _retval make sense?
Attachment #121293 -
Flags: superreview?(darin) → superreview-
| Assignee | ||
Comment 13•23 years ago
|
||
> tabs ok?
The whole file is tab-indented.
> wouldn't you leave _retval unassigned?
Fixed.
> also what does it mean for aContentType == nsnull?
Most likely, that the caller fucked up. If this were not the day before
freeze, I'd take that test out and replace it with an assert.... For now,
we'll just treat it as a "can't handle".
Attachment #121293 -
Attachment is obsolete: true
| Assignee | ||
Updated•23 years ago
|
Attachment #121303 -
Flags: superreview?(darin)
Attachment #121303 -
Flags: review?(blizzard)
Comment 14•23 years ago
|
||
Comment on attachment 121303 [details] [diff] [review]
Updated to comments
looks good to me sr=darin
Attachment #121303 -
Flags: superreview?(darin) → superreview+
Comment 15•23 years ago
|
||
Fixed on Trunk
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 16•23 years ago
|
||
Excuse me? When did this get r=?
Comment 17•23 years ago
|
||
Comment on attachment 121303 [details] [diff] [review]
Updated to comments
r=blizzard
Attachment #121303 -
Flags: review?(blizzard) → review+
Comment 18•23 years ago
|
||
Comment on attachment 121293 [details] [diff] [review]
Seems like the sanest way to go
(clearing review request on obsolete attachment)
Attachment #121293 -
Flags: review?(blizzard)
Updated•14 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•