Skip to content

Commit

Permalink
Merge mozilla-central to mozilla-inbound
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Morley committed Dec 19, 2012
2 parents e00cf54 + 3c3fbb6 commit 3640ed9
Show file tree
Hide file tree
Showing 61 changed files with 1,204 additions and 637 deletions.
4 changes: 1 addition & 3 deletions accessible/src/base/TextAttrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,7 @@ TextAttrsMgr::FontFamilyTextAttr::
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));

gfxFontGroup* fontGroup = fm->GetThebesFontGroup();
gfxFont* font = fontGroup->GetFontAt(0);
gfxFontEntry* fontEntry = font->GetFontEntry();
aFamily = fontEntry->FamilyName();
aFamily = fontGroup->GetFamilyNameAt(0);
return true;
}

Expand Down
84 changes: 23 additions & 61 deletions b2g/chrome/content/dbg-browser-actors.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,64 +103,26 @@ function DeviceTabActor(connection, browser) {

DeviceTabActor.prototype = new BrowserTabActor();

DeviceTabActor.prototype.grip = function DTA_grip() {
dbg_assert(!this.exited,
'grip() should not be called on exited browser actor.');
dbg_assert(this.actorID,
'tab should have an actorID.');

let response = {
'actor': this.actorID,
'title': this.browser.title,
'url': this.browser.document.documentURI
};

// Walk over tab actors added by extensions and add them to a new ActorPool.
let actorPool = new ActorPool(this.conn);
this._createExtraActors(DebuggerServer.tabActorFactories, actorPool);
if (!actorPool.isEmpty()) {
this._tabActorPool = actorPool;
this.conn.addActorPool(this._tabActorPool);
}

this._appendExtraActors(response);
return response;
};

/**
* Creates a thread actor and a pool for context-lifetime actors. It then sets
* up the content window for debugging.
*/
DeviceTabActor.prototype._pushContext = function DTA_pushContext() {
dbg_assert(!this._contextPool, "Can't push multiple contexts");

this._contextPool = new ActorPool(this.conn);
this.conn.addActorPool(this._contextPool);

this.threadActor = new ThreadActor(this, this.browser.wrappedJSObject);
this._contextPool.addActor(this.threadActor);
};

// Protocol Request Handlers

/**
* Prepare to enter a nested event loop by disabling debuggee events.
*/
DeviceTabActor.prototype.preNest = function DTA_preNest() {
let windowUtils = this.browser
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
windowUtils.suppressEventHandling(true);
windowUtils.suspendTimeouts();
};

/**
* Prepare to exit a nested event loop by enabling debuggee events.
*/
DeviceTabActor.prototype.postNest = function DTA_postNest(aNestData) {
let windowUtils = this.browser
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
windowUtils.resumeTimeouts();
windowUtils.suppressEventHandling(false);
};
Object.defineProperty(DeviceTabActor.prototype, "title", {
get: function() {
return this.browser.title;
},
enumerable: true,
configurable: false
});

Object.defineProperty(DeviceTabActor.prototype, "url", {
get: function() {
return this.browser.document.documentURI;
},
enumerable: true,
configurable: false
});

Object.defineProperty(DeviceTabActor.prototype, "contentWindow", {
get: function() {
return this.browser;
},
enumerable: true,
configurable: false
});
2 changes: 1 addition & 1 deletion browser/devtools/debugger/DebuggerPanel.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function DebuggerPanel(iframeWindow, toolbox) {
this._controller._target = this.target;
this._bkp = this._controller.Breakpoints;

new EventEmitter(this);
EventEmitter.decorate(this);
}

DebuggerPanel.prototype = {
Expand Down
13 changes: 11 additions & 2 deletions browser/devtools/debugger/debugger-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,18 @@ let DebuggerController = {

/**
* Called for each location change in the debugged tab.
*
* @param string aType
* Packet type.
* @param object aPacket
* Packet received from the server.
*/
_onTabNavigated: function DC__onTabNavigated() {
DebuggerView._handleTabNavigation();
_onTabNavigated: function DC__onTabNavigated(aType, aPacket) {
if (aPacket.state == "start") {
DebuggerView._handleTabNavigation();
return;
}

this.ThreadState._handleTabNavigation();
this.StackFrames._handleTabNavigation();
this.SourceScripts._handleTabNavigation();
Expand Down
27 changes: 24 additions & 3 deletions browser/devtools/debugger/test/browser_dbg_bfcache.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ function testInitialLoad() {
function testLocationChange()
{
gDebugger.DebuggerController.activeThread.resume(function() {
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
dump("tabNavigated state " + aPacket.state + "\n");
if (aPacket.state == "start") {
return;
}

gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);

ok(true, "tabNavigated event was fired.");
info("Still attached to the tab.");

Expand All @@ -59,7 +66,14 @@ function testLocationChange()

function testBack()
{
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
dump("tabNavigated state " + aPacket.state + "\n");
if (aPacket.state == "start") {
return;
}

gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);

ok(true, "tabNavigated event was fired after going back.");
info("Still attached to the tab.");

Expand All @@ -79,7 +93,14 @@ function testBack()

function testForward()
{
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
dump("tabNavigated state " + aPacket.state + "\n");
if (aPacket.state == "start") {
return;
}

gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);

ok(true, "tabNavigated event was fired after going forward.");
info("Still attached to the tab.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ function testSimpleCall() {
function testLocationChange()
{
gDebugger.DebuggerController.activeThread.resume(function() {
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
dump("tabNavigated state " + aPacket.state + "\n");
if (aPacket.state == "start") {
return;
}
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);

ok(true, "tabNavigated event was fired.");
info("Still attached to the tab.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ function testSimpleCall() {
function testLocationChange()
{
gDebugger.DebuggerController.activeThread.resume(function() {
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
dump("tabNavigated state " + aPacket.state + "\n");
if (aPacket.state == "start") {
return;
}
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);

ok(true, "tabNavigated event was fired.");
info("Still attached to the tab.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ function testSimpleCall() {
function testLocationChange()
{
gDebugger.DebuggerController.activeThread.resume(function() {
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
dump("tabNavigated state " + aPacket.state + "\n");
if (aPacket.state == "start") {
return;
}
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);

ok(true, "tabNavigated event was fired.");
info("Still attached to the tab.");

Expand Down
8 changes: 7 additions & 1 deletion browser/devtools/debugger/test/browser_dbg_nav-01.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ function get_tab()
get_tab_actor_for_url(gClient, TAB1_URL, function(aGrip) {
gTab1Actor = aGrip.actor;
gClient.request({ to: aGrip.actor, type: "attach" }, function(aResponse) {
gClient.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
gClient.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
dump("onTabNavigated state " + aPacket.state + "\n");
if (aPacket.state == "start") {
return;
}
gClient.removeListener("tabNavigated", onTabNavigated);

is(aPacket.url, TAB2_URL, "Got a tab navigation notification.");
gClient.addOneTimeListener("tabDetached", function (aEvent, aPacket) {
ok(true, "Got a tab detach notification.");
Expand Down
2 changes: 1 addition & 1 deletion browser/devtools/framework/Sidebar.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
*/
this.ToolSidebar = function ToolSidebar(tabbox, panel, showTabstripe=true)
{
new EventEmitter(this);
EventEmitter.decorate(this);

this._tabbox = tabbox;
this._panelDoc = this._tabbox.ownerDocument;
Expand Down
28 changes: 21 additions & 7 deletions browser/devtools/framework/Target.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Object.defineProperty(Target.prototype, "version", {
* be web pages served over http(s), but they don't have to be.
*/
function TabTarget(tab) {
new EventEmitter(this);
EventEmitter.decorate(this);
this._tab = tab;
this._setupListeners();
}
Expand Down Expand Up @@ -201,6 +201,10 @@ TabTarget.prototype = {
return false;
},

get isLocalTab() {
return true;
},

/**
* Listen to the different tabs events.
*/
Expand Down Expand Up @@ -305,7 +309,7 @@ TabWebProgressListener.prototype = {
* these will have a chrome: URL
*/
function WindowTarget(window) {
new EventEmitter(this);
EventEmitter.decorate(this);
this._window = window;
}

Expand All @@ -329,6 +333,10 @@ WindowTarget.prototype = {
return false;
},

get isLocalTab() {
return false;
},

/**
* Target is not alive anymore.
*/
Expand All @@ -354,16 +362,20 @@ WindowTarget.prototype = {
* A RemoteTarget represents a page living in a remote Firefox instance.
*/
function RemoteTarget(form, client, chrome) {
new EventEmitter(this);
EventEmitter.decorate(this);
this._client = client;
this._form = form;
this._chrome = chrome;

this.destroy = this.destroy.bind(this);
this.client.addListener("tabDetached", this.destroy);

this._onTabNavigated = function onRemoteTabNavigated() {
this.emit("navigate");
this._onTabNavigated = function onRemoteTabNavigated(aType, aPacket) {
if (aPacket.state == "start") {
this.emit("will-navigate", aPacket);
} else {
this.emit("navigate", aPacket);
}
}.bind(this);
this.client.addListener("tabNavigated", this._onTabNavigated);
}
Expand All @@ -376,14 +388,16 @@ RemoteTarget.prototype = {

get chrome() this._chrome,

get name() this._form._title,
get name() this._form.title,

get url() this._form._url,
get url() this._form.url,

get client() this._client,

get form() this._form,

get isLocalTab() false,

/**
* Target is not alive anymore.
*/
Expand Down
10 changes: 9 additions & 1 deletion browser/devtools/framework/Toolbox.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ this.Toolbox = function Toolbox(target, selectedTool, hostType) {

this._host = this._createHost(hostType);

new EventEmitter(this);
EventEmitter.decorate(this);

gDevTools.on("tool-registered", this._toolRegistered);
gDevTools.on("tool-unregistered", this._toolUnregistered);
Expand Down Expand Up @@ -270,6 +270,10 @@ Toolbox.prototype = {
dockBox.removeChild(dockBox.firstChild);
}

if (!this._target.isLocalTab) {
return;
}

let sideEnabled = Services.prefs.getBoolPref(this._prefs.SIDE_ENABLED);

for each (let position in this.HostType) {
Expand Down Expand Up @@ -476,6 +480,10 @@ Toolbox.prototype = {
return;
}

if (!this._target.isLocalTab) {
return;
}

let newHost = this._createHost(hostType);
return newHost.open().then(function(iframe) {
// change toolbox document's parent to the new host
Expand Down
6 changes: 3 additions & 3 deletions browser/devtools/framework/ToolboxHosts.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ this.Hosts = {
function BottomHost(hostTab) {
this.hostTab = hostTab;

new EventEmitter(this);
EventEmitter.decorate(this);
}

BottomHost.prototype = {
Expand Down Expand Up @@ -101,7 +101,7 @@ BottomHost.prototype = {
function SidebarHost(hostTab) {
this.hostTab = hostTab;

new EventEmitter(this);
EventEmitter.decorate(this);
}

SidebarHost.prototype = {
Expand Down Expand Up @@ -166,7 +166,7 @@ SidebarHost.prototype = {
function WindowHost() {
this._boundUnload = this._boundUnload.bind(this);

new EventEmitter(this);
EventEmitter.decorate(this);
}

WindowHost.prototype = {
Expand Down
2 changes: 1 addition & 1 deletion browser/devtools/framework/gDevTools.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ this.DevTools = function DevTools() {
// destroy() is an observer's handler so we need to preserve context.
this.destroy = this.destroy.bind(this);

new EventEmitter(this);
EventEmitter.decorate(this);

Services.obs.addObserver(this.destroy, "quit-application", false);

Expand Down
Loading

0 comments on commit 3640ed9

Please sign in to comment.