This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 712643 - land Marionette on m-c. r=mossop,robcee
- Loading branch information
Showing
25 changed files
with
3,053 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 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/. | ||
|
||
DEPTH = ../.. | ||
topsrcdir = @top_srcdir@ | ||
srcdir = @srcdir@ | ||
VPATH = @srcdir@ | ||
|
||
include $(DEPTH)/config/autoconf.mk | ||
|
||
ifdef ENABLE_MARIONETTE | ||
DIRS += components | ||
ifdef ENABLE_TESTS | ||
DIRS += tests | ||
endif | ||
endif | ||
|
||
include $(topsrcdir)/config/rules.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 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/. | ||
|
||
DEPTH = ../../.. | ||
topsrcdir = @top_srcdir@ | ||
srcdir = @srcdir@ | ||
VPATH = @srcdir@ | ||
|
||
include $(DEPTH)/config/autoconf.mk | ||
|
||
EXTRA_PP_COMPONENTS = \ | ||
MarionetteComponents.manifest \ | ||
marionettecomponent.js \ | ||
$(NULL) | ||
|
||
include $(topsrcdir)/config/rules.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Marionette | ||
component {786a1369-dca5-4adc-8486-33d23c88010a} marionettecomponent.js | ||
contract @mozilla.org/marionette;1 {786a1369-dca5-4adc-8486-33d23c88010a} | ||
category profile-after-change MarionetteComponent @mozilla.org/marionette;1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* 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/. */ | ||
|
||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components; | ||
|
||
const MARIONETTE_CONTRACTID = "@mozilla.org/marionette;1"; | ||
const MARIONETTE_CID = Components.ID("{786a1369-dca5-4adc-8486-33d23c88010a}"); | ||
|
||
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | ||
Cu.import("resource://gre/modules/Services.jsm"); | ||
|
||
function MarionetteComponent() { | ||
this._loaded = false; | ||
} | ||
|
||
MarionetteComponent.prototype = { | ||
classDescription: "Marionette component", | ||
classID: MARIONETTE_CID, | ||
contractID: MARIONETTE_CONTRACTID, | ||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), | ||
_xpcom_categories: [{category: "profile-after-change", service: true}], | ||
|
||
observe: function mc_observe(aSubject, aTopic, aData) { | ||
let observerService = Services.obs; | ||
switch (aTopic) { | ||
case "profile-after-change": | ||
if (Services.prefs.getBoolPref('marionette.defaultPrefs.enabled')) { | ||
// set up the logger | ||
Cu.import("resource://gre/modules/FileUtils.jsm"); | ||
Cu.import("resource://gre/modules/services-sync/log4moz.js"); | ||
|
||
let logger = Log4Moz.repository.getLogger("Marionette"); | ||
logger.level = Log4Moz.Level["All"]; | ||
let logf = FileUtils.getFile('ProfD', ['marionette.log']); | ||
|
||
let formatter = new Log4Moz.BasicFormatter(); | ||
logger.addAppender(new Log4Moz.FileAppender(logf, formatter)); | ||
logger.info("MarionetteComponent loaded"); | ||
|
||
//add observers | ||
observerService.addObserver(this, "final-ui-startup", false); | ||
observerService.addObserver(this, "xpcom-shutdown", false); | ||
} | ||
else { | ||
logger.info("marionette not enabled"); | ||
} | ||
break; | ||
case "final-ui-startup": | ||
observerService.removeObserver(this, "final-ui-startup"); | ||
this.init(); | ||
break; | ||
case "xpcom-shutdown": | ||
observerService.removeObserver(this, "xpcom-shutdown"); | ||
this.uninit(); | ||
break; | ||
} | ||
}, | ||
|
||
init: function mc_init() { | ||
if (!this._loaded) { | ||
this._loaded = true; | ||
let port; | ||
try { | ||
port = Services.prefs.getIntPref('marionette.defaultPrefs.port'); | ||
} | ||
catch(e) { | ||
port = 2828; | ||
} | ||
try { | ||
Cu.import('resource:///modules/devtools/dbg-server.jsm'); | ||
DebuggerServer.addActors('chrome://marionette/content/marionette-actors.js'); | ||
DebuggerServer.initTransport(); | ||
DebuggerServer.openListener(port, true); | ||
} | ||
catch(e) { | ||
logger.error('exception: ' + e.name + ', ' + e.message); | ||
} | ||
} | ||
}, | ||
|
||
uninit: function mc_uninit() { | ||
DebuggerServer.closeListener(); | ||
this._loaded = false; | ||
}, | ||
|
||
}; | ||
|
||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([MarionetteComponent]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
marionette.jar: | ||
% content marionette %content/ | ||
content/marionette-actors.js (marionette-actors.js) | ||
content/marionette-listener.js (marionette-listener.js) | ||
content/marionette-elements.js (marionette-elements.js) | ||
content/marionette-log-obj.js (marionette-log-obj.js) | ||
content/marionette-simpletest.js (marionette-simpletest.js) |
Oops, something went wrong.