Closed Bug 1322678 Opened 8 years ago Closed 6 years ago

Title of image tab changes back to filename on user zoom

Categories

(Core :: DOM: Core & HTML, defect, P3)

45 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: vincent.spallek, Assigned: edgar)

Details

(Keywords: reproducible, testcase)

Attachments

(2 files)

Attached file zoom-bug.html
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0; Firefox 45.5.1 - 11712-1502020039-1.31
Build ID: 20161129180326

Steps to reproduce:

Create a webpage that opens a huge image in a new tab with JavaScript and changes the title of that new tab after load.
Initially, the new tab is shown with the custom title, and the image is zoomed to show the full image.
If clicking on the image with the mouse, the image zooms to 100%. 


Actual results:

In this moment, the tab's title is changed back to the filename of the image.
If using CTRL + "+" or CTRL + "-" for zooming, then the title is not changed (as expected).


Expected results:

The tab's title shouldn't change.
OS: Unspecified → Windows 7
I see this problem in 45.5.1esr and Fx51b6, with the testcase and a local image file. But the custom title will be overwritten immediately if use image on web address. And the tab title will be overwritten every time the page zoom (not image zoom) level reaches 100%, including using the hotkey.
Severity: normal → minor
Status: UNCONFIRMED → NEW
Has STR: --- → yes
Ever confirmed: true
OS: Windows 7 → Windows
Hardware: Unspecified → All
For local image file, add "newWin.addEventListener('resize', function() {" will fix the problem. But it seems useless to open web image.
Use case is if the underlying CMS is generating a really ugly long URL for an uploaded image, but we want to show the familiar filename to the user.
… otherwise, the tab title is completely useless to the user if several tabs are open.
In this case, using a page, iframe or AJAX element to display, or generate a short and pseudo-URL, may be a better way.

Or, may the Content-Disposition:"inline; filename="jshang.png"" right for you? like https://bug1320571.bmoattachments.org/attachment.cgi?id=8816766.
Hi,
The attachment from description is not working. YF based on the fact that you succeeded to reproduce this can you think to a component for this bug?
Flags: needinfo?(yfdyh000)
I've reproduced the reporter's problem, but I don't know if it's a problem with this example or a browser issue.
Flags: needinfo?(yfdyh000)
Product: Firefox → Core
This issue reproduces on other browsers?
I tried my example on IE and Chrome on Windows as well. Both browsers do not show this bug but show the expected behavior: the tab's title doesn't change back.
I opened the attached file and clicked on "Link" the result is "Object not found". How can I use the attached file? Thanks
The attached file is meant as documentation, please read its source code. To make it work, you need to change it to open an image with dimensions bigger than your screen.
Component: Untriaged → Tabbed Browser
Product: Core → Firefox
This is because of the implementation of https://dxr.mozilla.org/mozilla-central/source/dom/html/ImageDocument.cpp , which updates the title to include zoom factors etc. I guess it should be taught not to overwrite custom-set titles.
Component: Tabbed Browser → DOM
Product: Firefox → Core
Edgar, can you take a look?
Flags: needinfo?(echen)
Priority: -- → P3
Assignee: nobody → echen
Flags: needinfo?(echen)
I can reproduce this on Mac and Linux as well.
OS: Windows → All
(In reply to Edgar Chen [:edgar] from comment #17)
> https://treeherder.mozilla.org/#/
> jobs?repo=try&tier=1&revision=fd8de2c8ce01f83e857af4a5d8afb2b07c3bf052&group_
> state=expanded

There are some failures that are actually not related to this change. Rebase and try again, https://treeherder.mozilla.org/#/jobs?repo=try&tier=1&group_state=expanded&revision=8154027e4ffce44797aaef7fa5ac7a57aeb5857a, it looks good now.
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6343e6061b9e
Don't overwrite the custom-set title of ImageDocument; r=smaug
https://hg.mozilla.org/mozilla-central/rev/6343e6061b9e
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
QA Whiteboard: [good first verify]
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: