Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 82291bc

Browse files
author
Tim Taubert
committed
merge m-c to fx-team
2 parents 8650dc0 + 4f6d5bd commit 82291bc

9 files changed

Lines changed: 158 additions & 100 deletions

File tree

browser/base/content/browser.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,14 @@ var gBrowserInit = {
13351335

13361336
var isLoadingBlank = isBlankPageURL(uriToLoad);
13371337

1338+
// This pageshow listener needs to be registered before we may call
1339+
// swapBrowsersAndCloseOther() to receive pageshow events fired by that.
1340+
gBrowser.addEventListener("pageshow", function(event) {
1341+
// Filter out events that are not about the document load we are interested in
1342+
if (content && event.target == content.document)
1343+
setTimeout(pageShowEventHandlers, 0, event);
1344+
}, true);
1345+
13381346
if (uriToLoad && uriToLoad != "about:blank") {
13391347
if (uriToLoad instanceof Ci.nsISupportsArray) {
13401348
let count = uriToLoad.Count();
@@ -1393,12 +1401,6 @@ var gBrowserInit = {
13931401
AddonManager.addAddonListener(AddonsMgrListener);
13941402
WebrtcIndicator.init();
13951403

1396-
gBrowser.addEventListener("pageshow", function(event) {
1397-
// Filter out events that are not about the document load we are interested in
1398-
if (content && event.target == content.document)
1399-
setTimeout(pageShowEventHandlers, 0, event.persisted);
1400-
}, true);
1401-
14021404
// Ensure login manager is up and running.
14031405
Services.logins;
14041406

browser/base/content/newtab/newTab.xul

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
label="&newtab.undo.restoreButton;"
3232
class="newtab-undo-button" />
3333
<xul:toolbarbutton id="newtab-undo-close-button" tabindex="-1"
34-
title="&newtab.undo.closeTooltip;" />
34+
tooltiptext="&newtab.undo.closeTooltip;" />
3535
</div>
3636
</div>
3737

browser/base/content/tabbrowser.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3896,13 +3896,17 @@
38963896
this.tabbrowser.pinTab(newTab);
38973897
this.tabbrowser.moveTabTo(newTab, newIndex);
38983898
3899+
// We need to select the tab before calling swapBrowsersAndCloseOther
3900+
// so that window.content in chrome windows points to the right tab
3901+
// when pagehide/show events are fired.
3902+
this.tabbrowser.selectedTab = newTab;
3903+
38993904
draggedTab.parentNode._finishAnimateTabMove();
39003905
this.tabbrowser.swapBrowsersAndCloseOther(newTab, draggedTab);
39013906
3902-
// We need to select the tab after we've done
3903-
// swapBrowsersAndCloseOther, so that the updateCurrentBrowser
3904-
// it triggers will correctly update our URL bar.
3905-
this.tabbrowser.selectedTab = newTab;
3907+
// Call updateCurrentBrowser to make sure the URL bar is up to date
3908+
// for our new tab after we've done swapBrowsersAndCloseOther.
3909+
this.updateCurrentBrowser(true);
39063910
} else {
39073911
// Pass true to disallow dropping javascript: or data: urls
39083912
let url;

browser/base/content/test/Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ _BROWSER_FILES = \
183183
browser_pluginnotification.js \
184184
browser_plugins_added_dynamically.js \
185185
browser_CTPScriptPlugin.js \
186+
browser_CTP_drag_drop.js \
186187
browser_pluginplaypreview.js \
187188
browser_pluginplaypreview2.js \
188189
browser_private_browsing_window.js \

browser/base/content/test/browser_CTPScriptPlugin.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ function testExpectPopupPart1() {
144144
var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
145145
ok(notification, "should have a click-to-play notification (" + getCurrentTestLocation() + ")");
146146

147-
var condition = function() !notification.dismissed;
147+
var condition = function() {
148+
var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
149+
return !notification.dismissed;
150+
};
148151
waitForCondition(condition, testExpectPopupPart2, "waited too long for popup notification to show (" + getCurrentTestLocation() + ")");
149152
}
150153

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/* Any copyright is dedicated to the Public Domain.
2+
* http://creativecommons.org/publicdomain/zero/1.0/ */
3+
4+
let gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
5+
6+
let gNextTest = null;
7+
let gNewWindow = null;
8+
9+
Components.utils.import("resource://gre/modules/Services.jsm");
10+
11+
function test() {
12+
waitForExplicitFinish();
13+
registerCleanupFunction(function() { Services.prefs.clearUserPref("plugins.click_to_play"); });
14+
Services.prefs.setBoolPref("plugins.click_to_play", true);
15+
16+
gBrowser.selectedTab = gBrowser.addTab();
17+
gBrowser.selectedBrowser.addEventListener("PluginBindingAttached", handleEvent, true, true);
18+
gNextTest = part1;
19+
gBrowser.selectedBrowser.contentDocument.location = gHttpTestRoot + "plugin_test.html";
20+
}
21+
22+
function handleEvent() {
23+
gNextTest();
24+
}
25+
26+
function part1() {
27+
gBrowser.selectedBrowser.removeEventListener("PluginBindingAttached", handleEvent);
28+
ok(PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should have a click-to-play notification in the initial tab");
29+
30+
gNextTest = part2;
31+
gNewWindow = gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
32+
gNewWindow.addEventListener("load", handleEvent, true);
33+
}
34+
35+
function part2() {
36+
gNewWindow.removeEventListener("load", handleEvent);
37+
let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser);
38+
waitForCondition(condition, part3, "Waited too long for click-to-play notification");
39+
}
40+
41+
function part3() {
42+
ok(PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser), "Should have a click-to-play notification in the tab in the new window");
43+
ok(!PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should not have a click-to-play notification in the old window now");
44+
45+
gBrowser.selectedTab = gBrowser.addTab();
46+
gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, gNewWindow.gBrowser.selectedTab);
47+
let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
48+
waitForCondition(condition, part4, "Waited too long for click-to-play notification");
49+
}
50+
51+
function part4() {
52+
ok(PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should have a click-to-play notification in the initial tab again");
53+
54+
gBrowser.removeCurrentTab();
55+
finish();
56+
}

browser/devtools/debugger/debugger-panes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
104104
*/
105105
addSource: function DVS_addSource(aSource, aOptions = {}) {
106106
let url = aSource.url;
107-
let label = SourceUtils.getSourceLabel(url);
108-
let group = SourceUtils.getSourceGroup(url);
107+
let label = SourceUtils.getSourceLabel(url.split(" -> ").pop());
108+
let group = SourceUtils.getSourceGroup(url.split(" -> ").pop());
109109

110110
// Append a source item to this container.
111111
let sourceItem = this.push([label, url, group], {

toolkit/devtools/debugger/server/dbg-script-actors.js

Lines changed: 74 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -520,105 +520,97 @@ ThreadActor.prototype = {
520520
* The location of the breakpoint as specified in the protocol.
521521
*/
522522
_setBreakpoint: function TA__setBreakpoint(aLocation) {
523-
// Fetch the list of scripts in that url.
524-
let scripts = this._scripts[aLocation.url];
525-
// Fetch the outermost script in that list.
526-
let script = null;
527-
for (let i = 0; i <= aLocation.line; i++) {
528-
// Stop when the first script that contains this location is found.
529-
if (scripts[i]) {
530-
// If that first script does not contain the line specified, it's no
531-
// good. Note that |i === scripts[i].startLine| in this case, so the
532-
// following check makes sure we are not considering a script that does
533-
// not include |aLocation.line|.
534-
if (i + scripts[i].lineCount < aLocation.line) {
535-
continue;
536-
}
537-
script = scripts[i];
538-
break;
539-
}
540-
}
523+
let breakpoints = this._breakpointStore[aLocation.url];
541524

542-
let location = { url: aLocation.url, line: aLocation.line };
543-
// Get the list of cached breakpoints in this URL.
544-
let scriptBreakpoints = this._breakpointStore[location.url];
545-
let bpActor;
546-
if (scriptBreakpoints &&
547-
scriptBreakpoints[location.line] &&
548-
scriptBreakpoints[location.line].actor) {
549-
bpActor = scriptBreakpoints[location.line].actor;
550-
}
551-
if (!bpActor) {
552-
bpActor = new BreakpointActor(this, location);
553-
this._hooks.addToParentPool(bpActor);
554-
if (scriptBreakpoints[location.line]) {
555-
scriptBreakpoints[location.line].actor = bpActor;
556-
}
525+
let actor;
526+
if (breakpoints[aLocation.line].actor) {
527+
actor = breakpoints[aLocation.line].actor;
528+
} else {
529+
actor = breakpoints[aLocation.line].actor = new BreakpointActor(this, {
530+
url: aLocation.url,
531+
line: aLocation.line
532+
});
533+
this._hooks.addToParentPool(actor);
557534
}
558535

559-
if (!script) {
560-
return { error: "noScript", actor: bpActor.actorID };
536+
let scripts = this.dbg.findScripts(aLocation);
537+
if (scripts.length == 0) {
538+
return {
539+
error: "noScript",
540+
actor: actor.actorID
541+
};
561542
}
562543

563-
let inner, codeFound = false;
564-
// We need to set the breakpoint in every script that has bytecode in the
565-
// specified line.
566-
for (let s of this._getContainers(script, aLocation.line)) {
567-
// The first result of the iteration is the innermost script.
568-
if (!inner) {
569-
inner = s;
570-
}
571-
572-
let offsets = s.getLineOffsets(aLocation.line);
573-
if (offsets.length) {
574-
bpActor.addScript(s, this);
575-
for (let i = 0; i < offsets.length; i++) {
576-
s.setBreakpoint(offsets[i], bpActor);
577-
codeFound = true;
544+
let found = false;
545+
for (let script of scripts) {
546+
let offsets = script.getLineOffsets(aLocation.line);
547+
if (offsets.length > 0) {
548+
for (let offset of offsets) {
549+
script.setBreakpoint(offset, actor);
578550
}
551+
actor.addScript(script, this);
552+
found = true;
579553
}
580554
}
555+
if (found) {
556+
return {
557+
actor: actor.actorID
558+
};
559+
}
560+
561+
let scripts = this.dbg.findScripts({
562+
url: aLocation.url,
563+
line: aLocation.line,
564+
innermost: true
565+
});
581566

582567
let actualLocation;
583-
if (!codeFound) {
584-
// No code at that line in any script, skipping forward in the innermost
585-
// script.
586-
let lines = inner.getAllOffsets();
587-
let oldLine = aLocation.line;
588-
for (let line = oldLine; line < lines.length; ++line) {
589-
if (lines[line]) {
590-
for (let i = 0; i < lines[line].length; i++) {
591-
inner.setBreakpoint(lines[line][i], bpActor);
592-
codeFound = true;
568+
let found = false;
569+
for (let script of scripts) {
570+
let offsets = script.getAllOffsets();
571+
for (let line = aLocation.line; line < offsets.length; ++line) {
572+
if (offsets[line]) {
573+
for (let offset of offsets[line]) {
574+
script.setBreakpoint(offset, actor);
593575
}
594-
bpActor.addScript(inner, this);
595-
actualLocation = {
596-
url: aLocation.url,
597-
line: line,
598-
column: aLocation.column
599-
};
600-
// If there wasn't already a breakpoint at that line, update the cache
601-
// as well.
602-
if (scriptBreakpoints[line] && scriptBreakpoints[line].actor) {
603-
let existing = scriptBreakpoints[line].actor;
604-
bpActor.onDelete();
605-
delete scriptBreakpoints[oldLine];
606-
return { actor: existing.actorID, actualLocation: actualLocation };
576+
actor.addScript(script, this);
577+
if (!actualLocation) {
578+
actualLocation = {
579+
url: aLocation.url,
580+
line: line,
581+
column: aLocation.column
582+
};
607583
}
608-
bpActor.location = actualLocation;
609-
scriptBreakpoints[line] = scriptBreakpoints[oldLine];
610-
scriptBreakpoints[line].line = line;
611-
delete scriptBreakpoints[oldLine];
584+
found = true;
612585
break;
613586
}
614587
}
615588
}
616-
617-
if (!codeFound) {
618-
return { error: "noCodeAtLineColumn", actor: bpActor.actorID };
589+
if (found) {
590+
if (breakpoints[actualLocation.line] &&
591+
breakpoints[actualLocation.line].actor) {
592+
actor.onDelete();
593+
delete breakpoints[aLocation.line];
594+
return {
595+
actor: breakpoints[actualLocation.line].actor.actorID,
596+
actualLocation: actualLocation
597+
};
598+
} else {
599+
actor.location = actualLocation;
600+
breakpoints[actualLocation.line] = breakpoints[aLocation.line];
601+
breakpoints[actualLocation.line].line = actualLocation.line;
602+
delete breakpoints[aLocation.line];
603+
return {
604+
actor: actor.actorID,
605+
actualLocation: actualLocation
606+
};
607+
}
619608
}
620609

621-
return { actor: bpActor.actorID, actualLocation: actualLocation };
610+
return {
611+
error: "noCodeAtLineColumn",
612+
actor: actor.actorID
613+
};
622614
},
623615

624616
/**
@@ -1488,7 +1480,7 @@ SourceActor.prototype = {
14881480
_loadSource: function SA__loadSource() {
14891481
let deferred = defer();
14901482
let scheme;
1491-
let url = this._url;
1483+
let url = this._url.split(" -> ").pop();
14921484

14931485
try {
14941486
scheme = Services.io.extractScheme(url);

toolkit/devtools/debugger/tests/unit/test_breakpoint-02.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ function run_test()
2727

2828
function test_breakpoint_running()
2929
{
30-
let path = getFilePath('test_breakpoint-02.js');
31-
let location = { url: path, line: gDebuggee.line0 + 2};
32-
3330
gDebuggee.eval("var line0 = Error().lineNumber;\n" +
3431
"var a = 1;\n" + // line0 + 1
3532
"var b = 2;\n"); // line0 + 2
3633

34+
let path = getFilePath('test_breakpoint-02.js');
35+
let location = { url: path, line: gDebuggee.line0 + 2};
36+
3737
// Setting the breakpoint later should interrupt the debuggee.
3838
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
3939
do_check_eq(aPacket.type, "paused");
@@ -43,7 +43,7 @@ function test_breakpoint_running()
4343
gThreadClient.setBreakpoint(location, function(aResponse) {
4444
// Eval scripts don't stick around long enough for the breakpoint to be set,
4545
// so just make sure we got the expected response from the actor.
46-
do_check_eq(aResponse.error, "noScript");
46+
do_check_neq(aResponse.error, "noScript");
4747

4848
do_execute_soon(function() {
4949
finishClient(gClient);

0 commit comments

Comments
 (0)