Closed Bug 923281 Opened 11 years ago Closed 11 years ago

Console filter output does not match source filenames (listed on the right side of the console window)

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 27

People

(Reporter: cpeterson, Assigned: rtnpro)

References

Details

(Whiteboard: [good first bug][lang=js][mentor=msucan])

Attachments

(2 files, 2 obsolete files)

When filtering the web console, I wanted to isolate just the log messages from my .js file, but the console's filter output only matches the log messages, not the source filename listed on the right side of the console window.
Thanks for the bug report!
Priority: -- → P2
Whiteboard: [good first bug][lang=js][mentor=msucan]
M ready to solve this bug
Flags: needinfo?
Jayesh, what is the question do you have?


Overview of the workflow:

1. Get the firefox source:

https://developer.mozilla.org/en-US/docs/Developer_Guide/Source_Code/Mercurial

2. Build firefox:

https://developer.mozilla.org/en-US/docs/Simple_Firefox_build

3. Make a patch:

https://developer.mozilla.org/en-US/docs/Creating_a_patch

4. Submit the patch:

https://developer.mozilla.org/en-US/docs/Developer_Guide/How_to_Submit_a_Patch

If you read through the source code about something you do not know about, you may find documentation here:

1. Mozilla Developer Network - has a ton of info about XUL elements, HTML, JS, DOM, Gecko-specific APIs and more.

http://developer.mozilla.org/

2. MXR (Mozilla Cross-Reference) is a source code search engine - search for symbols you want to learn about, eg. nsIDocument.

http://mxr.mozilla.org/mozilla-central/

3. DXR is a smart source code search tool, similar to MXR but sometimes better.

http://dxr.mozilla.org


Here's an overview of how you can fix this bug: search for WCF_adjustVisibilityOnSearchStringChange() in browser/devtools/webconsole/webconsole.js. Use node.textContent instead of node.clipboardText for filtering the messages.
Flags: needinfo?
Attached file Testing bug 923281
[:msucan] Please do check in the test that I have tried on Firefox 24.0. I have attached a screen shot and some test files...
Jayesh, please use the needinfo flag when you have questions.

What is your question? I looked into the zip you attached, that seems fine, but it also seems unrelated to the task of fixing this bug here.

Please try to make a patch as suggested in comment 3. Thank you!
Can I help with this bug?
Flags: needinfo?
This allows filtering web console logs with file names too.
Attachment #817353 - Flags: review?(mihai.sucan)
Flags: needinfo?
Chris, Pardon me but I am still not able to understand what it is about, I've just written a normal | console.log("Hi"); | statement around 5 times in a test file called | test.js | and when put into HTML and run on firefox, the console shows the file name to the right as 

|test.js: 1|
|test.js: 2|


Tested on:
> Firefox 24 - Mac OS X, Linux Ubuntu, Windows 8
> Firefox UX - Mac OS X

I believe its working properly, What exactly have I missed. ? Could you please give in a few more details so that one of us can work on this.
Sudheesh, currently the web console filter works only on the log message and not on other data like timestamp, file name, etc. So, the feature request here is to improve the web console search filter so that it allows filtering with content from all the fields of the log.

https://bugzilla.mozilla.org/show_bug.cgi?id=923281#c7 adds the above requested feature. But, it needs more testing and review before it's ready to be merged.

I hope that I was able to explain this ticket.
Comment on attachment 817353 [details] [diff] [review]
webconsole_filter_by_filename.patch

This is fine. Thank you!

Did you get a chance to write a test?

The problem was that filtering worked with clipboardText, and the clipboardText for console API messages is incomplete: it does not include the message source URL. We could include it in WCF_logConsoleAPIMessage() -- see the clipboardText variable, it only includes the console API message, without the source URL.

The fix I suggested, which is included in this patch you submitted, is better long term, as we will remove clipboardText.
Attachment #817353 - Flags: review?(mihai.sucan) → feedback+
Assignee: nobody → rtnpro
Status: NEW → ASSIGNED
Hey Mihai,

Yesterday, I did not get time to work on the test. I am on it today and I hope to get it done by today.

Thanks
I have written some tests for the discussed fix. Please review it.

Thanks,
rtnpro
Attachment #818749 - Flags: review?(mihai.sucan)
Comment on attachment 818749 [details] [diff] [review]
webconsole_filter_by_filename_with_tests.patch

Review of attachment 818749 [details] [diff] [review]:
-----------------------------------------------------------------

Patch looks good, thank you! Good work! Will give r+ with the comments below addressed.

::: browser/devtools/webconsole/test/923281_browser_webconsole_live_extended_filtering_on_search_strings.js
@@ +1,4 @@
> +/* vim:set ts=2 sw=2 sts=2 et: */
> +/* This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

Please use the public domain license for tests.

see https://www.mozilla.org/MPL/headers/

::: browser/devtools/webconsole/test/923281_test.html
@@ +1,3 @@
> +<!DOCTYPE HTML>
> +<html dir="ltr" xml:lang="en-US" lang="en-US">
> +  <head>

Please add the public domain license boilerplate to all new test files.

::: browser/devtools/webconsole/test/923281_test1.js
@@ +1,1 @@
> +console.log("Sample log.");

PD license boilerplate.

::: browser/devtools/webconsole/test/923281_test2.js
@@ +1,1 @@
> +console.log("This is a random text.");

PD license boilerplate.

::: browser/devtools/webconsole/test/browser.ini
@@ +93,5 @@
>    test_bug_770099_bad_policy_uri.html^headers^
>    test_bug_770099_violation.html
>    test_bug_770099_violation.html^headers^
>    testscript.js
> +  923281_test.html

Please rename the test file to test-bug_923281_console_log_filter.html

@@ +95,5 @@
>    test_bug_770099_violation.html^headers^
>    testscript.js
> +  923281_test.html
> +  923281_test1.js
> +  923281_test2.js

Please add the "test-bug_" prefix to these file names.

@@ +233,5 @@
>  [browser_webconsole_output_order.js]
>  [browser_webconsole_property_provider.js]
>  [browser_webconsole_scratchpad_panel_link.js]
>  [browser_webconsole_view_source.js]
> +[923281_browser_webconsole_live_extended_filtering_on_search_strings.js]

Please rename to browser_webconsole_console_log_file_filter.js
Attachment #818749 - Flags: review?(mihai.sucan)
Hey Mihai,

I have updated the patch as you had suggested. Thanks for your help :)

Regards,
rtnpro
Attachment #817353 - Attachment is obsolete: true
Attachment #818749 - Attachment is obsolete: true
Attachment #819457 - Flags: feedback?(mihai.sucan)
Attachment #819457 - Flags: feedback?(mihai.sucan) → review?(mihai.sucan)
Comment on attachment 819457 [details] [diff] [review]
webconsole_filter_by_filename.patch

Thank you for the updated patch. r+

Try https://tbpl.mozilla.org/?tree=Try&rev=d17fb3a3d96a

I will land the patch once the try server shows that all tests pass.
Attachment #819457 - Flags: review?(mihai.sucan) → review+
Landed fx-team:
https://hg.mozilla.org/integration/fx-team/rev/e22ba40a686c
Whiteboard: [good first bug][lang=js][mentor=msucan] → [good first bug][lang=js][mentor=msucan][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/e22ba40a686c
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [good first bug][lang=js][mentor=msucan][fixed-in-fx-team] → [good first bug][lang=js][mentor=msucan]
Target Milestone: --- → Firefox 27
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.