Bug#774808: debsources: line number undefined
On 9 January 2015 at 05:05, Jason Pleau ja...@jpleau.ca wrote: I was wrong in my previous email, the code I mentionned is not the cause of the bug in question. It was an error that I did not catch when testing with Firefox. Matthieu, can you test the attached patch and see if it fixes the issue for you? Hi Jason, Thank you for your fast answer. I encountered this week-end hardware problems and won't be able to test your patch before I fix my laptop. I'll come back here later, sorry. Cheers, -- Matthieu -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#774808: debsources: line number undefined
Hello again. I was wrong in my previous email, the code I mentionned is not the cause of the bug in question. It was an error that I did not catch when testing with Firefox. Matthieu, can you test the attached patch and see if it fixes the issue for you? Cheers Jason From 181b7b6e6f57966b534f352c61a8e7cc81572b7d Mon Sep 17 00:00:00 2001 From: Jason Pleau ja...@jpleau.ca Date: Thu, 8 Jan 2015 22:51:43 -0500 Subject: [PATCH] web app: fix 'undefined' line numbers in source code pages Problem: In Iceweasel / Firefox, clicking on a line-number when browsing a source file caused the line number returned to be undefined, and so #Lundefined appeared in the URL. The cause was that to retrieve the line numbers from the a elements we clicked on, I was using .innerText, which is not supported by Firefox / Iceweasel. The alternative is using .textContent. The solution was to use element.textContent || element.innerText, so that it works browsers that support either .textContent or .innerText. Closes #774808 --- debsources/app/static/javascript/debsources.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debsources/app/static/javascript/debsources.js b/debsources/app/static/javascript/debsources.js index 6c8d2ee..844e58a 100644 --- a/debsources/app/static/javascript/debsources.js +++ b/debsources/app/static/javascript/debsources.js @@ -115,10 +115,10 @@ var debsources = function(message_pos) { if (!event.shiftKey || !last_clicked) { last_clicked = callerElement; -change_hash_without_scroll(callerElement, L + callerElement.innerText); +change_hash_without_scroll(callerElement, L + (callerElement.textContent || callerElement.innerText)); } else { -var first_line = parseInt(last_clicked.innerText); -var second_line = parseInt(callerElement.innerText); +var first_line = parseInt(last_clicked.textContent || last_clicked.innerText); +var second_line = parseInt(callerElement.textContent || callerElement.innerText); if (second_line first_line) { var tmp = first_line; -- 2.1.4
Bug#774808: debsources: line number undefined
On 7 January 2015 at 20:43, Reiner Herrmann rei...@reiner-h.de wrote: I'm using Iceweasel 34.0, and when I'm viewing a source file on sources.debian.net and click on a line number, it jumps to the current URL with #Lundefined appended (instead of e.g. #L123). It is working correctly with konqueror, but it occurs even with a new iceweasel profile (i.e. no addons installed). Hi, Thanks for the report. I can reproduce this bug. As it works fine when I manually enter such an URL, I believe the bug is due to the new javascript module (debsources.js) which automatically highlights lines with internal links (#L42). Jason: any idea where this comes from? Cheers, -- Matthieu -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#774808: debsources: line number undefined
Hello! On 08/01/15 10:31 AM, Matthieu Caneill wrote: On 7 January 2015 at 20:43, Reiner Herrmann rei...@reiner-h.de wrote: I'm using Iceweasel 34.0, and when I'm viewing a source file on sources.debian.net and click on a line number, it jumps to the current URL with #Lundefined appended (instead of e.g. #L123). It is working correctly with konqueror, but it occurs even with a new iceweasel profile (i.e. no addons installed). Hi, Thanks for the report. I can reproduce this bug. As it works fine when I manually enter such an URL, I believe the bug is due to the new javascript module (debsources.js) which automatically highlights lines with internal links (#L42). Jason: any idea where this comes from? I will need to have a more closer look tonight after work, but at first sight what I can notice is that there is a javascript error in the page (in debsources.js at line 35). This part of the file was added by this commit [1] --- 33: var msgbox = document.getElementById('messages'); 34: var index = document.getElementById('sourceslinenumbers'); 35: var divHeight = msgbox.offsetHeight; --- If msgbox is null (because there are no elements with an ID of 'messages', then msgbox.offsetHeight will error out. Sometimes a javascript error like this can lead to weird behaviors, similar to what Reiner reported. But I will test a bit more tonight to confirm if that's the case or not (and try to submit a patch for the little issue I pointed above). Cheers, -- Matthieu Thanks Jason [1]: http://anonscm.debian.org/cgit/qa/debsources.git/commit/debsources/app/static/javascript/debsources.js?id=e246fcfeb7f20dde3f026d2c4ff8f7e71fc8e303 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#774808: debsources: line number undefined
Package: qa.debian.org Severity: normal User: qa.debian@packages.debian.org Usertags: debsources Hi, I'm using Iceweasel 34.0, and when I'm viewing a source file on sources.debian.net and click on a line number, it jumps to the current URL with #Lundefined appended (instead of e.g. #L123). It is working correctly with konqueror, but it occurs even with a new iceweasel profile (i.e. no addons installed). Regards, Reiner signature.asc Description: OpenPGP digital signature