Closed Bug 829553 Opened 11 years ago Closed 11 years ago

[toolbox] If the last browser tab is closed with ctrl-w, the undocked toolbox is not closed.

Categories

(DevTools :: Framework, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 22

People

(Reporter: paul, Assigned: dcrewi)

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Blocks: 816946
Blocks: DevToolsPaperCuts
No longer blocks: 816946
Attached patch patch v1 (obsolete) — Splinter Review
From https://developer.mozilla.org/en-US/docs/Mozilla_event_reference/close_event

> Note that the close event is only fired when the user presses the
> close button on the titlebar; (i.e. not File -> Quit). The unload
> event should be used to capture all attempts to unload the window.

So, the easy fix is for Target to hook into unload events instead of
close events. That works, mostly. Unfortunately, the web console was
written under the assumption that a browser window always exists, so
this patch breaks its destroy method.

> TypeError: this.browserWindow is null: WebConsole.prototype.mainPopupSet@resource:///modules/HUDService.jsm:202
> WC_destroy@resource:///modules/HUDService.jsm:375
> WCP_destroy@resource:///modules/WebConsolePanel.jsm:65
> TBOX_destroy@resource:///modules/devtools/Toolbox.jsm:661
> EventEmitter_once/handler<@resource:///modules/devtools/EventEmitter.jsm:56
> EventEmitter_emit@resource:///modules/devtools/EventEmitter.jsm:100
> TabTarget.prototype.destroy@resource:///modules/devtools/Target.jsm:274
> TabTarget.prototype.handleEvent@resource:///modules/devtools/Target.jsm:233

What is the proper procedure here? Do I open a new bug, fix it there,
and add a dependency from this bug? Do I try to land this patch
immediately, or wait for a web console fix to come along?
(In reply to David Creswick from comment #1)
> What is the proper procedure here? Do I open a new bug, fix it there,
> and add a dependency from this bug? Do I try to land this patch
> immediately, or wait for a web console fix to come along?

Because this patch causes a web console problem then the problem should be fixed as part of this patch. We would normally only open a new bug if the patch worked and something else and was planned that depended on this patch.
This patch fixes the problem by setting WebConsole's "browserWindow" property at object constructor time, where formerly it was set lazily. This guarantees that browserWindow is defined when WebConsole#destroy runs. I ran the full suite of devtools tests locally and didn't find any new failures, so I assume this doesn't affect any other web console functionality.
Attachment #713404 - Attachment is obsolete: true
Assignee: nobody → dcrewi
Whiteboard: [has-patch]
Comment on attachment 714956 [details] [diff] [review]
patch v2 - with a fix for web console

Simple fix that does the job perfectly.

Great job!
Attachment #714956 - Flags: review?(mratcliffe) → review+
Whiteboard: [has-patch] → [has-patch][land-in-fx-team]
Whiteboard: [has-patch][land-in-fx-team] → [land-in-fx-team]
https://hg.mozilla.org/integration/fx-team/rev/9800064fbb22
Whiteboard: [land-in-fx-team] → [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/9800064fbb22
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 22
No longer blocks: DevToolsPaperCuts
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: