зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to mozilla-inbound
This commit is contained in:
Коммит
141da7cd35
1
.hgtags
1
.hgtags
|
@ -80,3 +80,4 @@ bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
|
|||
bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
|
||||
b6627f28b7ec17e1b46a594df0f780d3a40847e4 FIREFOX_AURORA_13_BASE
|
||||
357da346ceb705d196a46574804c7c4ec44ac186 FIREFOX_AURORA_14_BASE
|
||||
26dcd1b1a20893ad99341c61c6b1239ff1523858 FIREFOX_AURORA_15_BASE
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
#ac_add_options --enable-js-diagnostics
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux
|
||||
|
||||
# Avoid dependency on libstdc++ 4.5
|
||||
ac_add_options --enable-stdcxx-compat
|
||||
|
||||
# This will overwrite the default of stripping everything and keep the symbol table.
|
||||
# This is useful for profiling and debugging and only increases the package size
|
||||
# by 2 MBs.
|
||||
STRIP_FLAGS="--strip-debug"
|
||||
|
||||
# PGO
|
||||
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
export MOZ_TELEMETRY_REPORTING=1
|
||||
|
||||
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
|
||||
ac_add_options --enable-warnings-as-errors
|
||||
|
||||
# Enable parallel compiling
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j4"
|
||||
|
||||
# Use ccache
|
||||
ac_add_options --with-ccache=/usr/bin/ccache
|
||||
|
||||
#B2G options
|
||||
ac_add_options --enable-application=b2g
|
||||
ac_add_options --enable-marionette
|
||||
ac_add_options --disable-elf-hack
|
||||
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
|
|
@ -0,0 +1,40 @@
|
|||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux
|
||||
|
||||
# Avoid dependency on libstdc++ 4.5
|
||||
ac_add_options --enable-stdcxx-compat
|
||||
|
||||
# This will overwrite the default of stripping everything and keep the symbol table.
|
||||
# This is useful for profiling and debugging and only increases the package size
|
||||
# by 2 MBs.
|
||||
STRIP_FLAGS="--strip-debug"
|
||||
|
||||
# PGO
|
||||
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
export MOZ_TELEMETRY_REPORTING=1
|
||||
|
||||
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
|
||||
ac_add_options --enable-warnings-as-errors
|
||||
|
||||
# Enable parallel compiling
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j4"
|
||||
|
||||
# Use ccache
|
||||
ac_add_options --with-ccache=/usr/bin/ccache
|
||||
|
||||
#B2G options
|
||||
ac_add_options --enable-application=b2g
|
||||
ac_add_options --enable-marionette
|
||||
ac_add_options --disable-elf-hack
|
||||
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
|
|
@ -0,0 +1,27 @@
|
|||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
export MOZ_TELEMETRY_REPORTING=1
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j12"
|
||||
|
||||
#ac_add_options --with-macbundlename-prefix=Firefox
|
||||
|
||||
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
|
||||
ac_add_options --enable-warnings-as-errors
|
||||
ac_add_options --with-ccache
|
||||
|
||||
# B2G Stuff
|
||||
ac_add_options --enable-application=b2g
|
||||
ac_add_options --enable-debug-symbols
|
||||
ac_add_options --with-ccache
|
||||
ac_add_options --enable-marionette
|
||||
|
||||
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
|
|
@ -0,0 +1,35 @@
|
|||
# for pgo
|
||||
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) $(MOZ_OBJDIR)/_profile/pgo/profileserver.py'
|
||||
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-jemalloc
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
export MOZ_TELEMETRY_REPORTING=1
|
||||
|
||||
mk_add_options MOZ_MAKE_FLAGS=-j1
|
||||
|
||||
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010-win64
|
||||
else
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010
|
||||
fi
|
||||
|
||||
# For known full-clobber builds on Windows (like nightlies/try),
|
||||
# this speeds things up. IS_NIGHTLY is set by the build automation.
|
||||
if test "$IS_NIGHTLY" != ""; then
|
||||
ac_add_options --disable-auto-deps
|
||||
fi
|
||||
|
||||
# B2G Options
|
||||
ac_add_options --enable-application=b2g
|
||||
ac_add_options --enable-marionette
|
||||
|
||||
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
|
|
@ -5,7 +5,7 @@
|
|||
MOZ_APP_BASENAME=B2G
|
||||
MOZ_APP_VENDOR=Mozilla
|
||||
|
||||
MOZ_APP_VERSION=15.0a1
|
||||
MOZ_APP_VERSION=16.0a1
|
||||
MOZ_APP_UA_NAME=Firefox
|
||||
|
||||
MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial
|
||||
|
|
|
@ -1 +1 @@
|
|||
15.0a1
|
||||
16.0a1
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
# hardcoded milestones in the tree from these two files.
|
||||
#--------------------------------------------------------
|
||||
|
||||
15.0a1
|
||||
16.0a1
|
||||
|
|
|
@ -400,9 +400,6 @@ case "$target" in
|
|||
if test -z "$ANDROID_PACKAGE_NAME" ; then
|
||||
ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
|
||||
fi
|
||||
if test -z "$MOZ_MOBILE_COMPAT" ; then
|
||||
MOZ_MOBILE_COMPAT='All'
|
||||
fi
|
||||
|
||||
AC_DEFINE(ANDROID)
|
||||
AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
|
||||
|
@ -425,7 +422,6 @@ AC_SUBST(ANDROID_PLATFORM)
|
|||
AC_SUBST(ANDROID_SDK)
|
||||
AC_SUBST(ANDROID_PLATFORM_TOOLS)
|
||||
AC_SUBST(ANDROID_PACKAGE_NAME)
|
||||
AC_SUBST(MOZ_MOBILE_COMPAT)
|
||||
AC_SUBST(OBJCOPY)
|
||||
|
||||
dnl ========================================================
|
||||
|
|
|
@ -13,12 +13,13 @@
|
|||
<uses-sdk android:minSdkVersion="5"
|
||||
android:targetSdkVersion="11"/>
|
||||
|
||||
#ifdef MOZ_TABLETS_ONLY
|
||||
<supports-screens android:smallScreens="false"
|
||||
android:normalScreens="false"
|
||||
android:largeScreens="false"
|
||||
android:xlargeScreens="true" />
|
||||
#endif
|
||||
<compatible-screens>
|
||||
<!-- all xlarge size screens -->
|
||||
<screen android:screenSize="xlarge" android:screenDensity="ldpi" />
|
||||
<screen android:screenSize="xlarge" android:screenDensity="mdpi" />
|
||||
<screen android:screenSize="xlarge" android:screenDensity="hdpi" />
|
||||
<screen android:screenSize="xlarge" android:screenDensity="xhdpi" />
|
||||
</compatible-screens>
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
|
|
@ -63,11 +63,6 @@ DEFINES += \
|
|||
-DMOZILLA_OFFICIAL=$(MOZILLA_OFFICIAL) \
|
||||
$(NULL)
|
||||
|
||||
MOZ_MOBILE_COMPAT = @MOZ_MOBILE_COMPAT@
|
||||
ifeq (Tablets,$(MOZ_MOBILE_COMPAT))
|
||||
DEFINES += -DMOZ_TABLETS_ONLY=1
|
||||
endif
|
||||
|
||||
GARBAGE += \
|
||||
AndroidManifest.xml \
|
||||
classes.dex \
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
# hardcoded milestones in the tree from these two files.
|
||||
#--------------------------------------------------------
|
||||
|
||||
15.0a1
|
||||
16.0a1
|
||||
|
|
|
@ -85,6 +85,9 @@ span[id]:after {
|
|||
font-style: italic;
|
||||
}
|
||||
span:not(.error), a:not(.error) {
|
||||
unicode-bidi: embed;
|
||||
}
|
||||
span[id] {
|
||||
unicode-bidi: -moz-isolate;
|
||||
}
|
||||
.error,
|
||||
|
|
|
@ -42,7 +42,25 @@
|
|||
|
||||
<!-- App requires OpenGL ES 2.0 -->
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||
|
||||
|
||||
<compatible-screens>
|
||||
<!-- all small size screens -->
|
||||
<screen android:screenSize="small" android:screenDensity="ldpi" />
|
||||
<screen android:screenSize="small" android:screenDensity="mdpi" />
|
||||
<screen android:screenSize="small" android:screenDensity="hdpi" />
|
||||
<screen android:screenSize="small" android:screenDensity="xhdpi" />
|
||||
<!-- all normal size screens -->
|
||||
<screen android:screenSize="normal" android:screenDensity="ldpi" />
|
||||
<screen android:screenSize="normal" android:screenDensity="mdpi" />
|
||||
<screen android:screenSize="normal" android:screenDensity="hdpi" />
|
||||
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
|
||||
<!-- all large size screens -->
|
||||
<screen android:screenSize="large" android:screenDensity="ldpi" />
|
||||
<screen android:screenSize="large" android:screenDensity="mdpi" />
|
||||
<screen android:screenSize="large" android:screenDensity="hdpi" />
|
||||
<screen android:screenSize="large" android:screenDensity="xhdpi" />
|
||||
</compatible-screens>
|
||||
|
||||
<application android:label="@MOZ_APP_DISPLAYNAME@"
|
||||
android:icon="@drawable/icon"
|
||||
android:name="org.mozilla.gecko.GeckoApplication"
|
||||
|
|
|
@ -10,7 +10,7 @@ package org.mozilla.gecko.sync;
|
|||
*/
|
||||
public class GlobalConstants {
|
||||
public static final String PRODUCT_NAME = "@MOZ_APP_DISPLAYNAME@";
|
||||
public static final String SYNC_VERSION_STRING = "0.8";
|
||||
public static final String SYNC_VERSION_STRING = "0.9";
|
||||
|
||||
public static final String USER_AGENT = "Firefox AndroidSync " + SYNC_VERSION_STRING +
|
||||
" (" + PRODUCT_NAME + ")";
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
MOZ_APP_BASENAME=Fennec
|
||||
MOZ_APP_VENDOR=Mozilla
|
||||
|
||||
MOZ_APP_VERSION=15.0a1
|
||||
MOZ_APP_VERSION=16.0a1
|
||||
MOZ_APP_UA_NAME=Firefox
|
||||
|
||||
MOZ_BRANDING_DIRECTORY=mobile/android/branding/unofficial
|
||||
|
|
|
@ -16,7 +16,6 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
|||
|
||||
export JAVA_HOME=/tools/jdk6
|
||||
export MOZILLA_OFFICIAL=1
|
||||
export MOZ_MOBILE_COMPAT=Tablets
|
||||
|
||||
ac_add_options --enable-official-branding
|
||||
ac_add_options --with-branding=mobile/xul/branding/beta
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
MOZ_APP_BASENAME=Fennec
|
||||
MOZ_APP_VENDOR=Mozilla
|
||||
|
||||
MOZ_APP_VERSION=15.0a1
|
||||
MOZ_APP_VERSION=16.0a1
|
||||
|
||||
MOZ_BRANDING_DIRECTORY=mobile/xul/branding/unofficial
|
||||
MOZ_OFFICIAL_BRANDING_DIRECTORY=mobile/xul/branding/official
|
||||
|
|
|
@ -1 +1 @@
|
|||
1.17.0
|
||||
1.18.0
|
||||
|
|
|
@ -380,3 +380,8 @@ class Marionette(object):
|
|||
|
||||
def get_logs(self):
|
||||
return self._send_message('getLogs', 'value')
|
||||
|
||||
def import_script(self, file):
|
||||
f = open(file, "r")
|
||||
js = f.read()
|
||||
return self._send_message('importScript', 'ok', script=js)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
let testFunc = function() { return "i'm a test function!";};
|
|
@ -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/.
|
||||
|
||||
import os
|
||||
from marionette_test import MarionetteTestCase
|
||||
|
||||
class TestImportScript(MarionetteTestCase):
|
||||
def test_import_script(self):
|
||||
js = os.path.abspath(os.path.join(__file__, os.path.pardir, "importscript.js"))
|
||||
self.marionette.import_script(js)
|
||||
self.assertEqual("i'm a test function!", self.marionette.execute_script("return testFunc();"))
|
||||
self.assertEqual("i'm a test function!", self.marionette.execute_async_script("marionetteScriptFinished(testFunc());"))
|
||||
|
||||
class TestImportScriptChrome(TestImportScript):
|
||||
def setUp(self):
|
||||
MarionetteTestCase.setUp(self)
|
||||
self.marionette.set_context("chrome")
|
|
@ -1,3 +1,4 @@
|
|||
[test_import_script.py]
|
||||
[test_click.py]
|
||||
b2g = false
|
||||
[test_selected.py]
|
||||
|
|
|
@ -70,6 +70,9 @@ MarionetteComponent.prototype = {
|
|||
try {
|
||||
Cu.import('resource:///modules/devtools/dbg-server.jsm');
|
||||
DebuggerServer.addActors('chrome://marionette/content/marionette-actors.js');
|
||||
// This pref is required for the remote debugger to open a socket,
|
||||
// so force it to true. See bug 761252.
|
||||
Services.prefs.setBoolPref('devtools.debugger.remote-enabled', true);
|
||||
// Always allow remote connections.
|
||||
DebuggerServer.initTransport(function () { return true; });
|
||||
DebuggerServer.openListener(port, true);
|
||||
|
|
|
@ -27,6 +27,8 @@ specialpowers.specialPowersObserver = new specialpowers.SpecialPowersObserver();
|
|||
specialpowers.specialPowersObserver.init();
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
Services.prefs.setBoolPref("marionette.contentListener", false);
|
||||
let appName = Services.appinfo.name;
|
||||
|
@ -122,7 +124,8 @@ function MarionetteDriverActor(aConnection)
|
|||
this.command_id = null;
|
||||
this.mainFrame = null; //topmost chrome frame
|
||||
this.curFrame = null; //subframe that currently has focus
|
||||
|
||||
this.importedScripts = FileUtils.getFile('TmpD', ['marionettescriptchrome']);
|
||||
|
||||
//register all message listeners
|
||||
this.messageManager.addMessageListener("Marionette:ok", this);
|
||||
this.messageManager.addMessageListener("Marionette:done", this);
|
||||
|
@ -470,6 +473,14 @@ MarionetteDriverActor.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.importedScripts.exists()) {
|
||||
let stream = Cc["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Ci.nsIFileInputStream);
|
||||
stream.init(this.importedScripts, -1, 0, 0);
|
||||
let data = NetUtil.readInputStreamToString(stream, stream.available());
|
||||
script = data + script;
|
||||
}
|
||||
|
||||
let res = Cu.evalInSandbox(script, sandbox, "1.8");
|
||||
|
||||
if (directInject && !async &&
|
||||
|
@ -499,7 +510,6 @@ MarionetteDriverActor.prototype = {
|
|||
* function body
|
||||
*/
|
||||
execute: function MDA_execute(aRequest, directInject) {
|
||||
logger.info("newSandbox: " + aRequest.newSandbox);
|
||||
if (aRequest.newSandbox == undefined) {
|
||||
//if client does not send a value in newSandbox,
|
||||
//then they expect the same behaviour as webdriver
|
||||
|
@ -770,7 +780,7 @@ MarionetteDriverActor.prototype = {
|
|||
let winEn = this.getWinEnumerator();
|
||||
while(winEn.hasMoreElements()) {
|
||||
let foundWin = winEn.getNext();
|
||||
let winId = foundWin.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).outerWindowID;
|
||||
let winId = foundWin.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
||||
winId = winId + ((appName == "B2G") ? '-b2g' : '');
|
||||
res.push(winId)
|
||||
}
|
||||
|
@ -788,7 +798,7 @@ MarionetteDriverActor.prototype = {
|
|||
let winEn = this.getWinEnumerator();
|
||||
while(winEn.hasMoreElements()) {
|
||||
let foundWin = winEn.getNext();
|
||||
let winId = foundWin.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).outerWindowID;
|
||||
let winId = foundWin.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
||||
winId = winId + ((appName == "B2G") ? '-b2g' : '');
|
||||
if (aRequest.value == foundWin.name || aRequest.value == winId) {
|
||||
if (this.browsers[winId] == undefined) {
|
||||
|
@ -1196,6 +1206,11 @@ MarionetteDriverActor.prototype = {
|
|||
this.messageManager.removeMessageListener("Marionette:goUrl", this);
|
||||
this.messageManager.removeMessageListener("Marionette:runEmulatorCmd", this);
|
||||
this.curBrowser = null;
|
||||
try {
|
||||
this.importedScripts.remove(false);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
},
|
||||
|
||||
_emu_cb_id: 0,
|
||||
|
@ -1234,6 +1249,24 @@ MarionetteDriverActor.prototype = {
|
|||
return;
|
||||
}
|
||||
},
|
||||
|
||||
importScript: function MDA_importScript(aRequest) {
|
||||
if (this.context == "chrome") {
|
||||
let file;
|
||||
if (this.importedScripts.exists()) {
|
||||
file = FileUtils.openFileOutputStream(this.importedScripts, FileUtils.MODE_APPEND);
|
||||
}
|
||||
else {
|
||||
file = FileUtils.openFileOutputStream(this.importedScripts, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE);
|
||||
}
|
||||
file.write(aRequest.script, aRequest.script.length);
|
||||
file.close();
|
||||
this.sendOk();
|
||||
}
|
||||
else {
|
||||
this.sendAsync("importScript", {script: aRequest.script});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Receives all messages from content messageManager
|
||||
|
@ -1269,7 +1302,7 @@ MarionetteDriverActor.prototype = {
|
|||
// and either accepts the listener, or ignores it
|
||||
let nullPrevious = (this.curBrowser.curFrameId == null);
|
||||
let curWin = this.getCurrentWindow();
|
||||
let frameObject = curWin.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).getOuterWindowWithId(message.json.value);
|
||||
let frameObject = curWin.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).getOuterWindowWithId(message.json.value);
|
||||
let reg = this.curBrowser.register(message.json.value, message.json.href);
|
||||
if (reg) {
|
||||
this.curBrowser.elementManager.seenItems[reg] = frameObject; //add to seenItems
|
||||
|
@ -1324,7 +1357,8 @@ MarionetteDriverActor.prototype.requestTypes = {
|
|||
"switchToFrame": MarionetteDriverActor.prototype.switchToFrame,
|
||||
"switchToWindow": MarionetteDriverActor.prototype.switchToWindow,
|
||||
"deleteSession": MarionetteDriverActor.prototype.deleteSession,
|
||||
"emulatorCmdResult": MarionetteDriverActor.prototype.emulatorCmdResult
|
||||
"emulatorCmdResult": MarionetteDriverActor.prototype.emulatorCmdResult,
|
||||
"importScript": MarionetteDriverActor.prototype.importScript
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,6 +14,8 @@ let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
|||
loader.loadSubScript("chrome://marionette/content/marionette-simpletest.js");
|
||||
loader.loadSubScript("chrome://marionette/content/marionette-log-obj.js");
|
||||
Cu.import("chrome://marionette/content/marionette-elements.js");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
let utils = {};
|
||||
utils.window = content;
|
||||
// Load Event/ChromeUtils for use with JS scripts:
|
||||
|
@ -35,6 +37,7 @@ let listenerId = null; //unique ID of this listener
|
|||
let activeFrame = null;
|
||||
let curWindow = content;
|
||||
let elementManager = new ElementManager([]);
|
||||
let importedScripts = FileUtils.getFile('TmpD', ['marionettescript']);
|
||||
|
||||
// The sandbox we execute test scripts in. Gets lazily created in
|
||||
// createExecuteContentSandbox().
|
||||
|
@ -102,6 +105,7 @@ function startListeners() {
|
|||
addMessageListenerId("Marionette:deleteSession", deleteSession);
|
||||
addMessageListenerId("Marionette:sleepSession", sleepSession);
|
||||
addMessageListenerId("Marionette:emulatorCmdResult", emulatorCmdResult);
|
||||
addMessageListenerId("Marionette:importScript", importScript);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,7 +164,13 @@ function deleteSession(msg) {
|
|||
removeMessageListenerId("Marionette:deleteSession", deleteSession);
|
||||
removeMessageListenerId("Marionette:sleepSession", sleepSession);
|
||||
removeMessageListenerId("Marionette:emulatorCmdResult", emulatorCmdResult);
|
||||
removeMessageListenerId("Marionette:importScript", importScript);
|
||||
this.elementManager.reset();
|
||||
try {
|
||||
importedScripts.remove(false);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -222,7 +232,6 @@ function errUnload() {
|
|||
sendError("unload was called", 17, null);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Marionette Methods
|
||||
*/
|
||||
|
@ -306,6 +315,13 @@ function executeScript(msg, directInject) {
|
|||
|
||||
try {
|
||||
if (directInject) {
|
||||
if (importedScripts.exists()) {
|
||||
let stream = Components.classes["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Components.interfaces.nsIFileInputStream);
|
||||
stream.init(importedScripts, -1, 0, 0);
|
||||
let data = NetUtil.readInputStreamToString(stream, stream.available());
|
||||
script = data + script;
|
||||
}
|
||||
let res = Cu.evalInSandbox(script, sandbox, "1.8");
|
||||
sendSyncMessage("Marionette:testLog", {value: elementManager.wrapValue(marionetteLogObj.getLogs())});
|
||||
marionetteLogObj.clearLogs();
|
||||
|
@ -328,6 +344,13 @@ function executeScript(msg, directInject) {
|
|||
|
||||
let scriptSrc = "let __marionetteFunc = function(){" + script + "};" +
|
||||
"__marionetteFunc.apply(null, __marionetteParams);";
|
||||
if (importedScripts.exists()) {
|
||||
let stream = Components.classes["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Components.interfaces.nsIFileInputStream);
|
||||
stream.init(importedScripts, -1, 0, 0);
|
||||
let data = NetUtil.readInputStreamToString(stream, stream.available());
|
||||
scriptSrc = data + scriptSrc;
|
||||
}
|
||||
let res = Cu.evalInSandbox(scriptSrc, sandbox, "1.8");
|
||||
sendSyncMessage("Marionette:testLog", {value: elementManager.wrapValue(marionetteLogObj.getLogs())});
|
||||
marionetteLogObj.clearLogs();
|
||||
|
@ -427,6 +450,13 @@ function executeWithCallback(msg, timeout) {
|
|||
|
||||
try {
|
||||
asyncTestRunning = true;
|
||||
if (importedScripts.exists()) {
|
||||
let stream = Components.classes["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Components.interfaces.nsIFileInputStream);
|
||||
stream.init(importedScripts, -1, 0, 0);
|
||||
let data = NetUtil.readInputStreamToString(stream, stream.available());
|
||||
scriptSrc = data + scriptSrc;
|
||||
}
|
||||
Cu.evalInSandbox(scriptSrc, sandbox, "1.8");
|
||||
} catch (e) {
|
||||
// 17 = JavascriptException
|
||||
|
@ -727,6 +757,19 @@ function emulatorCmdResult(msg) {
|
|||
}
|
||||
}
|
||||
|
||||
function importScript(msg) {
|
||||
let file;
|
||||
if (importedScripts.exists()) {
|
||||
file = FileUtils.openFileOutputStream(importedScripts, FielUtils.MODE_APPEND);
|
||||
}
|
||||
else {
|
||||
file = FileUtils.openFileOutputStream(importedScripts, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE);
|
||||
}
|
||||
file.write(msg.json.script, msg.json.script.length);
|
||||
file.close();
|
||||
sendOk();
|
||||
}
|
||||
|
||||
//call register self when we get loaded
|
||||
registerSelf();
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace mozilla {
|
|||
*/
|
||||
struct Module
|
||||
{
|
||||
static const unsigned int kVersion = 15;
|
||||
static const unsigned int kVersion = 16;
|
||||
|
||||
struct CIDEntry;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче