Closed Bug 895180 Opened 11 years ago Closed 11 years ago

Add a new Scratchpad context - remote connection

Categories

(DevTools Graveyard :: Scratchpad, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 27

People

(Reporter: bbenvie, Assigned: bbenvie)

References

Details

Attachments

(1 file, 14 obsolete files)

37.88 KB, patch
bbenvie
: review+
Details | Diff | Splinter Review
Scratchpad needs a new context so the user can execute to a remotely connected DebuggerServer.
Priority: -- → P3
I was thinking, if a remote toolbox included the scratchpad icon on the right and had some way to pass the target to it, then we wouldn't need an explicit scratchpad context or connection screen. I haven't looked into this, but IIRC those tools (scratchpad, tilt, etc.) don't have panel definitions with isTargetSupported() and constructors that take the target as a parameter. Joe may remember why, but if we can make them more like the other tools, that would go a long way towards letting them target remote devices.
Attached patch remote-scratchpad.patch (obsolete) — Splinter Review
Rather than create a new context option, this patch adds a Scratchpad tab to the toolbox that uses the toolbox's target. This is an early WIP.
Attached patch remote-scratchpad.patch (obsolete) — Splinter Review
Attachment #796563 - Attachment is obsolete: true
Attached patch remote-scratchpad.patch (obsolete) — Splinter Review
rebase
Attachment #796565 - Attachment is obsolete: true
Attached patch WIP3 (obsolete) — Splinter Review
Changes ScratchpadPanel.jsm to be scratchpad-panel.js, uses module loader. Something changed recently though, and the panel will not open when I add the Scratchpad as a tool. Not getting any useful debug dump either, so having a hell of a time debugging it.
Assignee: nobody → bbenvie
Attachment #797849 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attached patch WIP4 (obsolete) — Splinter Review
Forgot to add scratchpad-panel.js.
Attachment #801774 - Attachment is obsolete: true
Attached patch WIP4 (obsolete) — Splinter Review
fail
Attachment #801836 - Attachment is obsolete: true
Oh dear god this patch is going to bit rot my patch for bug 912260 so hard. Or vice versa. :)
it's a race!™
Going crazy trying to figure out why this won't work!
Attached patch WIP5 (obsolete) — Splinter Review
I'm a dunce, it was working. How does computer work.
Attachment #801837 - Attachment is obsolete: true
Attached patch WIP6 (obsolete) — Splinter Review
Attachment #801970 - Attachment is obsolete: true
Attached patch WIP7 (obsolete) — Splinter Review
The last piece remaining is to update the webconsole so that when clicking on a console message link from a Scratchpad that lives in a devtools toolbox, it focuses the toolbox and switches to the Scratchpad tab.

Rob, I just wanted you to check that this is something we actually want landing. When I discussed it with other people, there seemed to be agreement that adding a Scratchpad tab for remote targets was acceptable.
Attachment #802599 - Attachment is obsolete: true
Attachment #803186 - Flags: feedback?(rcampbell)
Attached patch WIP8 (obsolete) — Splinter Review
This iteration makes it so clicking the link from the webconsole that resulted from a Scratchpad tab console message will switch to the correct tab and focus the editor.
Attachment #803186 - Attachment is obsolete: true
Attachment #803186 - Flags: feedback?(rcampbell)
Attachment #803352 - Flags: feedback?(rcampbell)
Attached patch WIP9 (obsolete) — Splinter Review
I'm going to go ahead and upgrade this to a review, since this is complete in its current form and it would be nice to get this landed for 26.
Attachment #803352 - Attachment is obsolete: true
Attachment #803352 - Flags: feedback?(rcampbell)
Attachment #803780 - Flags: review?(rcampbell)
Comment on attachment 803780 [details] [diff] [review]
WIP9

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

this looks pretty clean.

We could probably use a unittest to verify that we get the correct scratchpad when clicking via the webconsole.

tagging dcamp for changes to main.js.

::: browser/devtools/main.js
@@ +231,5 @@
>    Tools.jsdebugger,
>    Tools.inspector,
>    Tools.jsprofiler,
> +  Tools.netMonitor,
> +  Tools.scratchpad

should we add this behind a pref in case we need to disable in a later release?

Would also like Dave to review the loader changes.
Attachment #803780 - Flags: review?(rcampbell)
Attachment #803780 - Flags: review?(dcamp)
Attachment #803780 - Flags: review+
JavaScript error: resource://gre/modules/devtools/Loader.jsm, line 86: NS_ERROR_FILE_UNRECOGNIZED_PATH: Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]
JavaScript error: chrome://browser/content/browser.xul, line 1: DeveloperToolbar is not defined

running with this patch installed. Attempting to open the Toolbar.
presumably this needs another try run.
Think I got hosed by something else landing, checking into it.
Attached patch WIP10 (obsolete) — Splinter Review
Did need a rebase, but there was also some tests to fix <:|. Should be fixed. Working on adding additional test now, but in the meantime have a tryrun:

https://tbpl.mozilla.org/?tree=Try&rev=658857742b35
Attachment #803780 - Attachment is obsolete: true
Attachment #803780 - Flags: review?(dcamp)
Attachment #804511 - Flags: review?(dcamp)
Attachment #804511 - Flags: review?(dcamp) → review+
Attached patch WIP11 (obsolete) — Splinter Review
Rebase. Still needs that test.
Attachment #804511 - Attachment is obsolete: true
Attached patch WIP12 (obsolete) — Splinter Review
Adds a test confirming the link behavior is as expected. Mihai, could you review the webconsole changes for this? The test I added lives in the webconsole tests and the additional behavior in the Scratchpad link click handler. Thanks!

https://tbpl.mozilla.org/?tree=Try&rev=71cd0e2412a9
Attachment #809364 - Attachment is obsolete: true
Attachment #812936 - Flags: review?(mihai.sucan)
Comment on attachment 812936 [details] [diff] [review]
WIP12

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

Patch looks good. Please remove all trailing white space from the patch.

r+ with the comments addressed.

::: browser/devtools/framework/test/browser_toolbox_options.js
@@ +77,5 @@
>    cleanup();
>  }
>  
>  function checkTools() {
> +  let toolsPref = panelWin.document.querySelectorAll("#default-tools-box > checkbox:not([label$='*'])");

is this safe? you might want an attribute or class name on the checkbox.

::: browser/devtools/webconsole/test/browser_webconsole_scratchpad_panel_link.js
@@ +51,5 @@
> +    yield scratchpad.run();
> +
> +    info("Clicking link to switch to and focus Scratchpad");
> +
> +    let [matched] = [...(yield message)[0].matched];

Nit: the test looks good but I was surprised to see waitForMessages() called before console.log() and without a yield.

Maybe you can move the |let message = wait...| line after the scratchpad.run() call, with a yield. Might be less confusing for me / more obvious that waitForMessages() returns a promise.

@@ +53,5 @@
> +    info("Clicking link to switch to and focus Scratchpad");
> +
> +    let [matched] = [...(yield message)[0].matched];
> +    ok(matched, "Found logged message from Scratchpad");
> +    let anchor = matched.querySelector("a");

The selector should probably be a.location.

@@ +56,5 @@
> +    ok(matched, "Found logged message from Scratchpad");
> +    let anchor = matched.querySelector("a");
> +    EventUtils.synthesizeMouse(anchor, 2, 2, {}, hud.iframeWindow);
> +
> +    is(aToolbox.getCurrentPanel(), scratchpadPanel,

The mouse click is sync but, IIAMN, it is only an implementation detail that the click also changes the current panel in sync. Should the test wait for the panel selection event?

::: browser/devtools/webconsole/webconsole.js
@@ +2589,5 @@
>  
>      // Make the location clickable.
>      this._addMessageLinkCallback(locationNode, () => {
>        if (isScratchpad) {
> +        // Check for matching top level Scratchpad window.

This callback function is growing too big. Can you please move the code from the if (isScratchpad) { ... } block into its own method? Please put it in hudservice.js, WebConsole.viewSourceInScratchpad(aURL, aLine), near the other viewSource*() methods.

Thanks!
Attachment #812936 - Flags: review?(mihai.sucan) → review+
Attached patch WIP13Splinter Review
Addresses Mihai's comments:

* Change to '@@iterator' since bug 907077 landed
* Make options toolbox add "unsupported" attribute for unsupported tool checkboxes and use this in the test
* Reorder test so `scratchpad.run()` comes before `yield waitForMessage()` to make more sense.
* Change selector in test to be "a.location"
* change test to use an event listener for "scratchpad-selected" so as to not assume synchronicity
* move logic to WebConsole#viewSourceInScratchpad
* remove trailing whitespace
Attachment #812936 - Attachment is obsolete: true
Attachment #813791 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/c99db0ab0cfa
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 27
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: