merge autoland to mozilla-central. r=merge a=merge

MozReview-Commit-ID: 5UT11zZbl2e
This commit is contained in:
Sebastian Hengst 2017-10-25 13:01:33 +02:00
Родитель 7bcf901c3b c57fe362b8
Коммит 74800ca743
23 изменённых файлов: 226 добавлений и 144 удалений

Просмотреть файл

@ -234,7 +234,7 @@ async function clickDoorhangerButton(button, index) {
} else if (button == MENU_BUTTON) { } else if (button == MENU_BUTTON) {
// Click the dropmarker arrow and wait for the menu to show up. // Click the dropmarker arrow and wait for the menu to show up.
await BrowserTestUtils.waitForCondition(() => getNotification().menubutton); await BrowserTestUtils.waitForCondition(() => getNotification().menubutton);
await sleep(); // menubutton needs extra time for binding await sleep(2000); // menubutton needs extra time for binding
let notification = getNotification(); let notification = getNotification();
ok(notification.menubutton, "notification menupopup displayed"); ok(notification.menubutton, "notification menupopup displayed");
let dropdownPromise = let dropdownPromise =

Просмотреть файл

@ -164,7 +164,7 @@ const HeadersPanel = createClass({
); );
let summaryUrl = urlDetails.unicodeUrl ? let summaryUrl = urlDetails.unicodeUrl ?
this.renderSummary(SUMMARY_URL, urlDetails.unicodeUrl) : null; this.renderSummary(SUMMARY_URL, new URL(urlDetails.unicodeUrl).origin) : null;
let summaryMethod = method ? let summaryMethod = method ?
this.renderSummary(SUMMARY_METHOD, method) : null; this.renderSummary(SUMMARY_METHOD, method) : null;

Просмотреть файл

@ -163,7 +163,8 @@ add_task(function* () {
let summaryValues = panel.querySelectorAll(".tabpanel-summary-value.textbox-input"); let summaryValues = panel.querySelectorAll(".tabpanel-summary-value.textbox-input");
let { method, uri, details: { status, statusText } } = data; let { method, uri, details: { status, statusText } } = data;
is(summaryValues[0].value, uri, "The url summary value is incorrect."); is(summaryValues[0].value, new URL(uri).origin,
"The url summary value is incorrect.");
is(summaryValues[1].value, method, "The method summary value is incorrect."); is(summaryValues[1].value, method, "The method summary value is incorrect.");
is(panel.querySelector(".requests-list-status-icon").dataset.code, status, is(panel.querySelector(".requests-list-status-icon").dataset.code, status,
"The status summary code is incorrect."); "The status summary code is incorrect.");

Просмотреть файл

@ -442,9 +442,10 @@ Moof::Moof(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, Sinf&
int64_t presentationDuration = int64_t presentationDuration =
ctsOrder.LastElement()->mCompositionRange.end ctsOrder.LastElement()->mCompositionRange.end
- ctsOrder[0]->mCompositionRange.start; - ctsOrder[0]->mCompositionRange.start;
int64_t endDecodeTime = auto decodeOffset = aMdhd.ToMicroseconds((int64_t)*aDecodeTime - aEdts.mMediaStart);
aMdhd.ToMicroseconds((int64_t)*aDecodeTime - aEdts.mMediaStart) auto offsetOffset = aMvhd.ToMicroseconds(aEdts.mEmptyOffset);
+ aMvhd.ToMicroseconds(aEdts.mEmptyOffset); int64_t endDecodeTime = decodeOffset.isOk() & offsetOffset.isOk() ?
decodeOffset.unwrap() + offsetOffset.unwrap() : 0;
int64_t decodeDuration = endDecodeTime - mIndex[0].mDecodeTime; int64_t decodeDuration = endDecodeTime - mIndex[0].mDecodeTime;
double adjust = (double)decodeDuration / presentationDuration; double adjust = (double)decodeDuration / presentationDuration;
int64_t dtsOffset = mIndex[0].mDecodeTime; int64_t dtsOffset = mIndex[0].mDecodeTime;
@ -680,12 +681,13 @@ Moof::ParseTrun(Box& aBox, Tfhd& aTfhd, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, u
sample.mByteRange = MediaByteRange(offset, offset + sampleSize); sample.mByteRange = MediaByteRange(offset, offset + sampleSize);
offset += sampleSize; offset += sampleSize;
sample.mDecodeTime = Microseconds decodeOffset, emptyOffset, startCts, endCts;
aMdhd.ToMicroseconds((int64_t)decodeTime - aEdts.mMediaStart) + aMvhd.ToMicroseconds(aEdts.mEmptyOffset); MOZ_TRY_VAR(decodeOffset, aMdhd.ToMicroseconds((int64_t)decodeTime - aEdts.mMediaStart));
sample.mCompositionRange = Interval<Microseconds>( MOZ_TRY_VAR(emptyOffset, aMvhd.ToMicroseconds(aEdts.mEmptyOffset));
aMdhd.ToMicroseconds((int64_t)decodeTime + ctsOffset - aEdts.mMediaStart) + aMvhd.ToMicroseconds(aEdts.mEmptyOffset), sample.mDecodeTime = decodeOffset + emptyOffset;
aMdhd.ToMicroseconds((int64_t)decodeTime + ctsOffset + sampleDuration - aEdts.mMediaStart) + aMvhd.ToMicroseconds(aEdts.mEmptyOffset)); MOZ_TRY_VAR(startCts, aMdhd.ToMicroseconds((int64_t)decodeTime + ctsOffset - aEdts.mMediaStart));
MOZ_TRY_VAR(endCts, aMdhd.ToMicroseconds((int64_t)decodeTime + ctsOffset + sampleDuration - aEdts.mMediaStart));
sample.mCompositionRange = Interval<Microseconds>(startCts + emptyOffset, endCts + emptyOffset);
// Sometimes audio streams don't properly mark their samples as keyframes, // Sometimes audio streams don't properly mark their samples as keyframes,
// because every audio sample is a keyframe. // because every audio sample is a keyframe.
sample.mSync = !(sampleFlags & 0x1010000) || aIsAudio; sample.mSync = !(sampleFlags & 0x1010000) || aIsAudio;
@ -697,7 +699,9 @@ Moof::ParseTrun(Box& aBox, Tfhd& aTfhd, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, u
} }
decodeTime += sampleDuration; decodeTime += sampleDuration;
} }
mMaxRoundingError += aMdhd.ToMicroseconds(sampleCount); Microseconds roundTime;
MOZ_TRY_VAR(roundTime, aMdhd.ToMicroseconds(sampleCount));
mMaxRoundingError += roundTime;
*aDecodeTime = decodeTime; *aDecodeTime = decodeTime;

Просмотреть файл

@ -33,8 +33,12 @@ public:
} }
explicit Mvhd(Box& aBox); explicit Mvhd(Box& aBox);
Microseconds ToMicroseconds(int64_t aTimescaleUnits) Result<Microseconds, nsresult> ToMicroseconds(int64_t aTimescaleUnits)
{ {
if (!mTimescale) {
NS_WARNING("invalid mTimescale");
return Err(NS_ERROR_FAILURE);
}
int64_t major = aTimescaleUnits / mTimescale; int64_t major = aTimescaleUnits / mTimescale;
int64_t remainder = aTimescaleUnits % mTimescale; int64_t remainder = aTimescaleUnits % mTimescale;
return major * 1000000ll + remainder * 1000000ll / mTimescale; return major * 1000000ll + remainder * 1000000ll / mTimescale;

Просмотреть файл

@ -267,6 +267,8 @@ static const TestFileData rustTestFiles[] = {
320, 240, 1,477460, false,0, false, false, 2 }, 320, 240, 1,477460, false,0, false, false, 2 },
{ "test_case_1388991.mp4", 0, false, -1, 0, 0, 1, 30000181, false, 0, false, false, 2 }, { "test_case_1388991.mp4", 0, false, -1, 0, 0, 1, 30000181, false, 0, false, false, 2 },
{ "test_case_1380468.mp4", 0, false, 0, 0, 0, 0, 0, false, 0, false, false, 0 }, { "test_case_1380468.mp4", 0, false, 0, 0, 0, 0, 0, false, 0, false, false, 0 },
{ "test_case_1410565.mp4", 1, true, 0,
320, 180, 1, 0, false, 955100, true, true, 2 },
}; };
TEST(stagefright_MPEG4Metadata, test_case_mp4) TEST(stagefright_MPEG4Metadata, test_case_mp4)
{ {

Просмотреть файл

@ -41,6 +41,7 @@ TEST_HARNESS_FILES.gtest += [
'test_case_1389299.mp4', 'test_case_1389299.mp4',
'test_case_1389527.mp4', 'test_case_1389527.mp4',
'test_case_1395244.mp4', 'test_case_1395244.mp4',
'test_case_1410565.mp4',
] ]
UNIFIED_SOURCES += ['TestMP4Rust.cpp',] UNIFIED_SOURCES += ['TestMP4Rust.cpp',]

Двоичные данные
media/libstagefright/gtest/test_case_1410565.mp4 Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -78,10 +78,6 @@
android:key="android.not_a_preference.category_experimental" android:key="android.not_a_preference.category_experimental"
android:title="@string/pref_category_experimental"> android:title="@string/pref_category_experimental">
<SwitchPreference android:key="android.not_a_preference.pwa"
android:title="@string/pref_pwa"
android:summary="@string/pref_pwa_summary"
android:defaultValue="false" />
</PreferenceCategory> </PreferenceCategory>

Просмотреть файл

@ -150,7 +150,6 @@ public class GeckoPreferences
public static final String PREFS_READ_PARTNER_CUSTOMIZATIONS_PROVIDER = NON_PREF_PREFIX + "distribution.read_partner_customizations_provider"; public static final String PREFS_READ_PARTNER_CUSTOMIZATIONS_PROVIDER = NON_PREF_PREFIX + "distribution.read_partner_customizations_provider";
public static final String PREFS_READ_PARTNER_BOOKMARKS_PROVIDER = NON_PREF_PREFIX + "distribution.read_partner_bookmarks_provider"; public static final String PREFS_READ_PARTNER_BOOKMARKS_PROVIDER = NON_PREF_PREFIX + "distribution.read_partner_bookmarks_provider";
public static final String PREFS_CUSTOM_TABS = NON_PREF_PREFIX + "customtabs_58"; public static final String PREFS_CUSTOM_TABS = NON_PREF_PREFIX + "customtabs_58";
public static final String PREFS_PWA = NON_PREF_PREFIX + "pwa";
public static final String PREFS_CATEGORY_EXPERIMENTAL_FEATURES = NON_PREF_PREFIX + "category_experimental"; public static final String PREFS_CATEGORY_EXPERIMENTAL_FEATURES = NON_PREF_PREFIX + "category_experimental";
public static final String PREFS_COMPACT_TABS = NON_PREF_PREFIX + "compact_tabs"; public static final String PREFS_COMPACT_TABS = NON_PREF_PREFIX + "compact_tabs";
public static final String PREFS_SHOW_QUIT_MENU = NON_PREF_PREFIX + "distribution.show_quit_menu"; public static final String PREFS_SHOW_QUIT_MENU = NON_PREF_PREFIX + "distribution.show_quit_menu";
@ -809,10 +808,6 @@ public class GeckoPreferences
i--; i--;
continue; continue;
} }
} else if (PREFS_PWA.equals(key) && !AppConstants.MOZ_ANDROID_PWA) {
preferences.removePreference(pref);
i--;
continue;
} else if (PREFS_COMPACT_TABS.equals(key)) { } else if (PREFS_COMPACT_TABS.equals(key)) {
if (HardwareUtils.isTablet()) { if (HardwareUtils.isTablet()) {
preferences.removePreference(pref); preferences.removePreference(pref);

Просмотреть файл

@ -236,9 +236,6 @@
<string name="custom_tabs_menu_footer">&custom_tabs_menu_footer;</string> <string name="custom_tabs_menu_footer">&custom_tabs_menu_footer;</string>
<string name="custom_tabs_hint_url_copy">&custom_tabs_hint_url_copy;</string> <string name="custom_tabs_hint_url_copy">&custom_tabs_hint_url_copy;</string>
<string name="pref_pwa">&pref_pwa;</string>
<string name="pref_pwa_summary">&pref_pwa_summary;</string>
<string name="pref_char_encoding">&pref_char_encoding;</string> <string name="pref_char_encoding">&pref_char_encoding;</string>
<string name="pref_char_encoding_on">&pref_char_encoding_on;</string> <string name="pref_char_encoding_on">&pref_char_encoding_on;</string>
<string name="pref_char_encoding_off">&pref_char_encoding_off;</string> <string name="pref_char_encoding_off">&pref_char_encoding_off;</string>

Просмотреть файл

@ -4206,8 +4206,7 @@ Tab.prototype = {
} else if (list.indexOf("[search]") != -1 && aEvent.type == "DOMLinkAdded") { } else if (list.indexOf("[search]") != -1 && aEvent.type == "DOMLinkAdded") {
this.sendOpenSearchMessage(target); this.sendOpenSearchMessage(target);
} else if (list.indexOf("[manifest]") != -1 && } else if (list.indexOf("[manifest]") != -1 &&
aEvent.type == "DOMLinkAdded" && aEvent.type == "DOMLinkAdded"){
SharedPreferences.forApp().getBoolPref("android.not_a_preference.pwa")){
this.makeManifestMessage(target); this.makeManifestMessage(target);
return; return;
} }

Просмотреть файл

@ -4003,6 +4003,12 @@ pref("mousewheel.enable_pixel_scrolling", true);
// set this to true. Then, gecko processes them as mouse wheel messages. // set this to true. Then, gecko processes them as mouse wheel messages.
pref("mousewheel.emulate_at_wm_scroll", false); pref("mousewheel.emulate_at_wm_scroll", false);
// Some odd touchpad utils give focus to window under cursor when user tries
// to scroll. If this is true, Gecko tries to emulate such odd behavior.
// Don't make this true unless you want to debug. Enabling this pref causes
// making damage to the performance.
pref("mousewheel.debug.make_window_under_cursor_foreground", false);
// Enables or disabled the TrackPoint hack, -1 is autodetect, 0 is off, // Enables or disabled the TrackPoint hack, -1 is autodetect, 0 is off,
// and 1 is on. Set this to 1 if TrackPoint scrolling is not working. // and 1 is on. Set this to 1 if TrackPoint scrolling is not working.
pref("ui.trackpoint_hack.enabled", -1); pref("ui.trackpoint_hack.enabled", -1);

2
servo/Cargo.lock сгенерированный
Просмотреть файл

@ -289,7 +289,7 @@ dependencies = [
[[package]] [[package]]
name = "browserhtml" name = "browserhtml"
version = "0.1.17" version = "0.1.17"
source = "git+https://github.com/browserhtml/browserhtml?branch=crate#7c66ae9a3e29d35230d5b9f16d19a562b1312c87" source = "git+https://github.com/browserhtml/browserhtml?branch=crate#70ad96070f86a8f76b7309ca3cf3b34b88a9da2a"
[[package]] [[package]]
name = "byteorder" name = "byteorder"

Просмотреть файл

@ -422,22 +422,23 @@ class Session(object):
:param body: Optional body of the HTTP request. :param body: Optional body of the HTTP request.
:return: `None` if the HTTP response body was empty, otherwise :return: `None` if the HTTP response body was empty, otherwise
the result of parsing the body as JSON. the `value` field returned after parsing the response
body as JSON.
:raises error.WebDriverException: If the remote end returns :raises error.WebDriverException: If the remote end returns
an error. an error.
""" """
response = self.transport.send(method, url, body) response = self.transport.send(method, url, body)
if response.status != 200:
raise error.from_response(response)
if "value" in response.body: if "value" in response.body:
value = response.body["value"] value = response.body["value"]
else: else:
raise error.UnknownErrorException("No 'value' key in response body:\n%s" % raise error.UnknownErrorException(
json.dumps(response.body)) "Expected 'value' key in response body:\n"
"%s" % json.dumps(response.body))
if response.status != 200:
cls = error.get(value.get("error"))
raise cls(value.get("message"))
return value return value

Просмотреть файл

@ -1,10 +1,25 @@
import collections import collections
import json
class WebDriverException(Exception): class WebDriverException(Exception):
http_status = None http_status = None
status_code = None status_code = None
def __init__(self, message, stacktrace=None):
super(WebDriverException, self)
self.stacktrace = stacktrace
def __repr__(self):
return "<%s http_status=%d>" % (self.__class__.__name__, self.http_status)
def __str__(self):
return ("%s (%d)\n"
"\n"
"Remote-end stacktrace:\n"
"\n"
"%s" % (self.status_code, self.http_status, self.stacktrace))
class ElementNotSelectableException(WebDriverException): class ElementNotSelectableException(WebDriverException):
http_status = 400 http_status = 400
@ -131,11 +146,40 @@ class UnsupportedOperationException(WebDriverException):
status_code = "unsupported operation" status_code = "unsupported operation"
def get(status_code): def from_response(response):
"""Gets exception from `status_code`, falling back to """
Unmarshals an error from a ``Response``'s `body`, failing
if not all three required `error`, `message`, and `stacktrace`
fields are given. Defaults to ``WebDriverException`` if `error`
is unknown.
"""
if response.status == 200:
raise UnknownErrorException(
"Response is not an error:\n"
"%s" % json.dumps(response.body))
if "value" in response.body:
value = response.body["value"]
else:
raise UnknownErrorException(
"Expected 'value' key in response body:\n"
"%s" % json.dumps(response.body))
# all fields must exist, but stacktrace can be an empty string
code = value["error"]
message = value["message"]
stack = value["stacktrace"] or None
cls = get(code)
return cls(message, stacktrace=stack)
def get(error_code):
"""
Gets exception from `error_code`, falling back to
``WebDriverException`` if it is not found. ``WebDriverException`` if it is not found.
""" """
return _errors.get(status_code, WebDriverException) return _errors.get(error_code, WebDriverException)
_errors = collections.defaultdict() _errors = collections.defaultdict()

Просмотреть файл

@ -4,16 +4,28 @@ import urlparse
import error import error
class Response(object): class Response(object):
"""Describes an HTTP response received from a remote en"Describes an HTTP """
response received from a remote end whose body has been read and parsed as Describes an HTTP response received from a remote end whose
appropriate.""" body has been read and parsed as appropriate.
"""
def __init__(self, status, body): def __init__(self, status, body):
self.status = status self.status = status
self.body = body self.body = body
def __repr__(self): def __repr__(self):
return "wdclient.Response(status=%d, body=%s)" % (self.status, self.body) cls_name = self.__class__.__name__
if self.error:
return "<%s status=%s error=%s>" % (cls_name, self.status, repr(self.error))
return "<% status=%s body=%s>" % (cls_name, self.status, self.body)
@property
def error(self):
if self.status != 200:
return error.from_response(self)
return None
@classmethod @classmethod
def from_http_response(cls, http_response): def from_http_response(cls, http_response):
@ -45,17 +57,18 @@ class ToJsonEncoder(json.JSONEncoder):
class HTTPWireProtocol(object): class HTTPWireProtocol(object):
"""Transports messages (commands and responses) over the WebDriver """
Transports messages (commands and responses) over the WebDriver
wire protocol. wire protocol.
""" """
def __init__(self, host, port, url_prefix="/", timeout=None): def __init__(self, host, port, url_prefix="/", timeout=None):
"""Construct interface for communicating with the remote server. """
Construct interface for communicating with the remote server.
:param url: URL of remote WebDriver server. :param url: URL of remote WebDriver server.
:param wait: Duration to wait for remote to appear. :param wait: Duration to wait for remote to appear.
""" """
self.host = host self.host = host
self.port = port self.port = port
self.url_prefix = url_prefix self.url_prefix = url_prefix
@ -66,7 +79,8 @@ class HTTPWireProtocol(object):
return urlparse.urljoin(self.url_prefix, suffix) return urlparse.urljoin(self.url_prefix, suffix)
def send(self, method, uri, body=None, headers=None): def send(self, method, uri, body=None, headers=None):
"""Send a command to the remote. """
Send a command to the remote.
:param method: `GET`, `POST`, or `DELETE`. :param method: `GET`, `POST`, or `DELETE`.
:param uri: Relative endpoint of the requests URL path. :param uri: Relative endpoint of the requests URL path.
@ -76,7 +90,6 @@ class HTTPWireProtocol(object):
:return: Instance of ``wdclient.Response`` describing the :return: Instance of ``wdclient.Response`` describing the
HTTP response received from the remote end. HTTP response received from the remote end.
""" """
if body is None and method == "POST": if body is None and method == "POST":
body = {} body = {}

Просмотреть файл

@ -56,6 +56,7 @@ def run(path, server_config, session_config, timeout=0):
"--verbose", # show each individual subtest "--verbose", # show each individual subtest
"--capture", "no", # enable stdout/stderr from tests "--capture", "no", # enable stdout/stderr from tests
"--basetemp", cache, # temporary directory "--basetemp", cache, # temporary directory
"--showlocals", # display contents of variables in local scope
"-p", "no:mozlog", # use the WPT result recorder "-p", "no:mozlog", # use the WPT result recorder
"-p", "no:cacheprovider", # disable state preservation across invocations "-p", "no:cacheprovider", # disable state preservation across invocations
path], path],

Просмотреть файл

@ -1,22 +1,29 @@
import pytest from tests.support.asserts import assert_error, assert_dialog_handled, assert_same_element
from tests.support.asserts import assert_error, assert_success, assert_dialog_handled, assert_same_element
from tests.support.fixtures import create_dialog from tests.support.fixtures import create_dialog
from tests.support.inline import inline from tests.support.inline import inline
def assert_result_is_active_element(session, result):
"""Ensure that the provided object is a successful WebDriver response
describing an element reference and that the referenced element matches the
element returned by the `activeElement` attribute of the current browsing
context's active document."""
assert result.status == 200
from_js = session.execute_script("return document.activeElement;") def get_active_element(session):
return session.transport.send("GET", "session/%s/element/active" % session.session_id)
if result.body["value"] is None:
assert from_js == None def assert_is_active_element(session, response):
"""Ensure that the provided object is a successful WebDriver
response describing an element reference and that the referenced
element matches the element returned by the `activeElement`
attribute of the current browsing context's active document.
"""
assert response.status == 200
assert "value" in response.body
from_js = session.execute_script("return document.activeElement")
if response.body["value"] is None:
assert from_js is None
else: else:
assert_same_element(session, result.body["value"], from_js) assert_same_element(session, response.body["value"], from_js)
# > 1. If the current browsing context is no longer open, return error with # > 1. If the current browsing context is no longer open, return error with
# > error code no such window. # > error code no such window.
@ -25,10 +32,9 @@ def test_closed_context(session, create_window):
session.window_handle = new_window session.window_handle = new_window
session.close() session.close()
result = session.transport.send("GET", response = get_active_element(session)
"session/%s/element/active" % session.session_id) assert_error(response, "no such window")
assert_error(result, "no such window")
# [...] # [...]
# 2. Handle any user prompts and return its value if it is an error. # 2. Handle any user prompts and return its value if it is an error.
@ -49,30 +55,25 @@ def test_handle_prompt_dismiss(new_session):
create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1") create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1")
result = session.transport.send("GET", response = get_active_element(session)
"session/%s/element/active" % session.session_id) assert_is_active_element(session, response)
assert_result_is_active_element(session, result)
assert_dialog_handled(session, "dismiss #1") assert_dialog_handled(session, "dismiss #1")
assert session.execute_script("return dismiss1;") == None assert session.execute_script("return dismiss1") is None
create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2") create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2")
result = session.transport.send("GET", response = get_active_element(session)
"session/%s/element/active" % session.session_id) assert_is_active_element(session, response)
assert_result_is_active_element(session, result)
assert_dialog_handled(session, "dismiss #2") assert_dialog_handled(session, "dismiss #2")
assert read_global(session, "dismiss2") == None assert read_global(session, "dismiss2") is None
create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3") create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3")
result = session.transport.send("GET", response = get_active_element(session)
"session/%s/element/active" % session.session_id) assert_is_active_element(session, response)
assert_result_is_active_element(session, result)
assert_dialog_handled(session, "dismiss #3") assert_dialog_handled(session, "dismiss #3")
assert read_global(session, "dismiss3") == None assert read_global(session, "dismiss3") is None
# [...] # [...]
# 2. Handle any user prompts and return its value if it is an error. # 2. Handle any user prompts and return its value if it is an error.
@ -92,31 +93,26 @@ def test_handle_prompt_accept(new_session):
session.url = inline("<body><p>Hello, World!</p></body>") session.url = inline("<body><p>Hello, World!</p></body>")
create_dialog(session)("alert", text="accept #1", result_var="accept1") create_dialog(session)("alert", text="accept #1", result_var="accept1")
result = session.transport.send("GET", response = get_active_element(session)
"session/%s/element/active" % session.session_id) assert_is_active_element(session, response)
assert_result_is_active_element(session, result)
assert_dialog_handled(session, "accept #1") assert_dialog_handled(session, "accept #1")
assert read_global(session, "accept1") == None assert read_global(session, "accept1") is None
create_dialog(session)("confirm", text="accept #2", result_var="accept2") create_dialog(session)("confirm", text="accept #2", result_var="accept2")
result = session.transport.send("GET", response = get_active_element(session)
"session/%s/element/active" % session.session_id) assert_is_active_element(session, response)
assert_result_is_active_element(session, result)
assert_dialog_handled(session, "accept #2") assert_dialog_handled(session, "accept #2")
assert read_global(session, "accept2"), True assert read_global(session, "accept2") is True
create_dialog(session)("prompt", text="accept #3", result_var="accept3") create_dialog(session)("prompt", text="accept #3", result_var="accept3")
result = session.transport.send("GET", response = get_active_element(session)
"session/%s/element/active" % session.session_id) assert_is_active_element(session, response)
assert_result_is_active_element(session, result)
assert_dialog_handled(session, "accept #3") assert_dialog_handled(session, "accept #3")
assert read_global(session, "accept3") == "" assert read_global(session, "accept3") == ""
# [...] # [...]
# 2. Handle any user prompts and return its value if it is an error. # 2. Handle any user prompts and return its value if it is an error.
# [...] # [...]
@ -134,30 +130,25 @@ def test_handle_prompt_missing_value(session, create_dialog):
create_dialog("alert", text="dismiss #1", result_var="dismiss1") create_dialog("alert", text="dismiss #1", result_var="dismiss1")
result = session.transport.send("GET", response = get_active_element(session)
"session/%s/element/active" % session.session_id) assert_error(response, "unexpected alert open")
assert_error(result, "unexpected alert open")
assert_dialog_handled(session, "dismiss #1") assert_dialog_handled(session, "dismiss #1")
assert session.execute_script("return accept1;") == None assert session.execute_script("return accept1") is None
create_dialog("confirm", text="dismiss #2", result_var="dismiss2") create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
result = session.transport.send("GET", response = get_active_element(session)
"session/%s/element/active" % session.session_id) assert_error(response, "unexpected alert open")
assert_error(result, "unexpected alert open")
assert_dialog_handled(session, "dismiss #2") assert_dialog_handled(session, "dismiss #2")
assert session.execute_script("return dismiss2;") == False assert session.execute_script("return dismiss2") is False
create_dialog("prompt", text="dismiss #3", result_var="dismiss3") create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
result = session.transport.send("GET", response = get_active_element(session)
"session/%s/element/active" % session.session_id) assert_error(response, "unexpected alert open")
assert_error(result, "unexpected alert open")
assert_dialog_handled(session, "dismiss #3") assert_dialog_handled(session, "dismiss #3")
assert session.execute_script("return dismiss3;") == None assert session.execute_script("return dismiss3") is None
# > [...] # > [...]
# > 3. Let active element be the active element of the current browsing # > 3. Let active element be the active element of the current browsing
@ -170,36 +161,36 @@ def test_success_document(session):
<h1>Heading</h1> <h1>Heading</h1>
<input /> <input />
<input /> <input />
<input style="opacity: 0;" /> <input style="opacity: 0" />
<p>Another element</p> <p>Another element</p>
</body>""") </body>""")
result = session.transport.send("GET", "session/%s/element/active" % session.session_id) response = get_active_element(session)
assert_is_active_element(session, response)
assert_result_is_active_element(session, result)
def test_sucess_input(session): def test_sucess_input(session):
session.url = inline(""" session.url = inline("""
<body> <body>
<h1>Heading</h1> <h1>Heading</h1>
<input autofocus /> <input autofocus />
<input style="opacity: 0;" /> <input style="opacity: 0" />
<p>Another element</p> <p>Another element</p>
</body>""") </body>""")
result = session.transport.send("GET", "session/%s/element/active" % session.session_id) response = get_active_element(session)
assert_is_active_element(session, response)
assert_result_is_active_element(session, result)
def test_sucess_input_non_interactable(session): def test_sucess_input_non_interactable(session):
session.url = inline(""" session.url = inline("""
<body> <body>
<h1>Heading</h1> <h1>Heading</h1>
<input /> <input />
<input style="opacity: 0;" autofocus /> <input style="opacity: 0" autofocus />
<p>Another element</p> <p>Another element</p>
</body>""") </body>""")
result = session.transport.send("GET", "session/%s/element/active" % session.session_id) response = get_active_element(session)
assert_is_active_element(session, response)
assert_result_is_active_element(session, result)
def test_success_explicit_focus(session): def test_success_explicit_focus(session):
session.url = inline(""" session.url = inline("""
@ -209,44 +200,45 @@ def test_success_explicit_focus(session):
<iframe></iframe> <iframe></iframe>
</body>""") </body>""")
session.execute_script("document.body.getElementsByTagName('h1')[0].focus();") session.execute_script("document.body.getElementsByTagName('h1')[0].focus()")
result = session.transport.send("GET", "session/%s/element/active" % session.session_id) response = get_active_element(session)
assert_result_is_active_element(session, result) assert_is_active_element(session, response)
session.execute_script("document.body.getElementsByTagName('input')[0].focus();") session.execute_script("document.body.getElementsByTagName('input')[0].focus()")
result = session.transport.send("GET", "session/%s/element/active" % session.session_id) response = get_active_element(session)
assert_result_is_active_element(session, result) assert_is_active_element(session, response)
session.execute_script("document.body.getElementsByTagName('iframe')[0].focus();") session.execute_script("document.body.getElementsByTagName('iframe')[0].focus()")
result = session.transport.send("GET", "session/%s/element/active" % session.session_id) response = get_active_element(session)
assert_result_is_active_element(session, result) assert_is_active_element(session, response)
session.execute_script("document.body.getElementsByTagName('iframe')[0].focus();") session.execute_script("document.body.getElementsByTagName('iframe')[0].focus()")
session.execute_script("document.body.getElementsByTagName('iframe')[0].remove();") session.execute_script("document.body.getElementsByTagName('iframe')[0].remove()")
result = session.transport.send("GET", "session/%s/element/active" % session.session_id) response = get_active_element(session)
assert_result_is_active_element(session, result) assert_is_active_element(session, response)
session.execute_script("document.body.appendChild(document.createElement('textarea'))")
response = get_active_element(session)
assert_is_active_element(session, response)
session.execute_script("document.body.appendChild(document.createElement('textarea'));")
result = session.transport.send("GET", "session/%s/element/active" % session.session_id)
assert_result_is_active_element(session, result)
def test_success_iframe_content(session): def test_success_iframe_content(session):
session.url = inline("<body></body>") session.url = inline("<body></body>")
session.execute_script(""" session.execute_script("""
var iframe = document.createElement('iframe'); let iframe = document.createElement('iframe');
document.body.appendChild(iframe); document.body.appendChild(iframe);
var input = iframe.contentDocument.createElement('input'); let input = iframe.contentDocument.createElement('input');
iframe.contentDocument.body.appendChild(input); iframe.contentDocument.body.appendChild(input);
input.focus();""") input.focus();
""")
result = session.transport.send("GET", "session/%s/element/active" % session.session_id) response = get_active_element(session)
assert_is_active_element(session, response)
assert_result_is_active_element(session, result)
def test_sucess_without_body(session): def test_sucess_without_body(session):
session.url = inline("<body></body>") session.url = inline("<body></body>")
session.execute_script("document.body.remove();") session.execute_script("document.body.remove()")
result = session.transport.send("GET", "session/%s/element/active"% session.session_id) response = get_active_element(session)
assert_is_active_element(session, response)
assert_result_is_active_element(session, result)

Просмотреть файл

@ -68,6 +68,7 @@ def assert_error(response, error_code):
assert isinstance(response.body["value"]["message"], basestring) assert isinstance(response.body["value"]["message"], basestring)
assert isinstance(response.body["value"]["stacktrace"], basestring) assert isinstance(response.body["value"]["stacktrace"], basestring)
def assert_success(response, value=None): def assert_success(response, value=None):
"""Verify that the provided wdclient.Response instance described a valid """Verify that the provided wdclient.Response instance described a valid
error response as defined by `dfn-send-an-error` and the provided error error response as defined by `dfn-send-an-error` and the provided error
@ -77,11 +78,13 @@ def assert_success(response, value=None):
:param value: Expected value of the response body, if any. :param value: Expected value of the response body, if any.
""" """
assert response.status == 200 assert response.status == 200, str(response.error)
if value is not None: if value is not None:
assert response.body["value"] == value assert response.body["value"] == value
return response.body.get("value") return response.body.get("value")
def assert_dialog_handled(session, expected_text): def assert_dialog_handled(session, expected_text):
result = session.transport.send("GET", result = session.transport.send("GET",
"session/%s/alert/text" % session.session_id) "session/%s/alert/text" % session.session_id)
@ -97,6 +100,7 @@ def assert_dialog_handled(session, expected_text):
result.body["value"] != expected_text), ( result.body["value"] != expected_text), (
"Dialog with text '%s' was not handled." % expected_text) "Dialog with text '%s' was not handled." % expected_text)
def assert_same_element(session, a, b): def assert_same_element(session, a, b):
"""Verify that two element references describe the same element.""" """Verify that two element references describe the same element."""
assert isinstance(a, dict), "Actual value is not a dictionary" assert isinstance(a, dict), "Actual value is not a dictionary"

Просмотреть файл

@ -263,7 +263,6 @@ if CONFIG['GNU_CXX']:
'-Wno-unused-local-typedef', '-Wno-unused-local-typedef',
] ]
elif CONFIG['_MSC_VER']: elif CONFIG['_MSC_VER']:
DEFINES['NOGDI'] = True # wingdi.h defines ERROR as 0 and conflicts with logging.h
CXXFLAGS += [ CXXFLAGS += [
'-wd4005', # 'WIN32_LEAN_AND_MEAN' : macro redefinition '-wd4005', # 'WIN32_LEAN_AND_MEAN' : macro redefinition
'-wd4018', # '<' : signed/unsigned mismatch '-wd4018', # '<' : signed/unsigned mismatch
@ -273,6 +272,9 @@ elif CONFIG['_MSC_VER']:
'-wd4506', # no definition for inline function (protobuf issue #240) '-wd4506', # no definition for inline function (protobuf issue #240)
] ]
if CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['NOGDI'] = True # wingdi.h defines ERROR as 0 and conflicts with logging.h
if CONFIG['MOZ_USE_PTHREADS']: if CONFIG['MOZ_USE_PTHREADS']:
DEFINES['HAVE_PTHREAD'] = True DEFINES['HAVE_PTHREAD'] = True

Просмотреть файл

@ -446,6 +446,14 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget,
MOZ_ASSERT(destWindow, "destWindow must not be NULL"); MOZ_ASSERT(destWindow, "destWindow must not be NULL");
// Some odd touchpad utils sets focus to window under the mouse cursor.
// this emulates the odd behavior for debug.
if (mUserPrefs.ShouldEmulateToMakeWindowUnderCursorForeground() &&
(aMessage == WM_MOUSEWHEEL || aMessage == WM_MOUSEHWHEEL) &&
::GetForegroundWindow() != destWindow->GetWindowHandle()) {
::SetForegroundWindow(destWindow->GetWindowHandle());
}
// If the found window is our plugin window, it means that the message // If the found window is our plugin window, it means that the message
// has been handled by the plugin but not consumed. We should handle the // has been handled by the plugin but not consumed. We should handle the
// message on its parent window. However, note that the DOM event may // message on its parent window. However, note that the DOM event may
@ -1121,6 +1129,9 @@ MouseScrollHandler::UserPrefs::Init()
mForceEnableSystemSettingCache = mForceEnableSystemSettingCache =
Preferences::GetBool("mousewheel.system_settings_cache.force_enabled", Preferences::GetBool("mousewheel.system_settings_cache.force_enabled",
false); false);
mEmulateToMakeWindowUnderCursorForeground =
Preferences::GetBool("mousewheel.debug.make_window_under_cursor_foreground",
false);
mOverriddenVerticalScrollAmount = mOverriddenVerticalScrollAmount =
Preferences::GetInt("mousewheel.windows.vertical_amount_override", -1); Preferences::GetInt("mousewheel.windows.vertical_amount_override", -1);
mOverriddenHorizontalScrollAmount = mOverriddenHorizontalScrollAmount =
@ -1134,12 +1145,14 @@ MouseScrollHandler::UserPrefs::Init()
"mScrollMessageHandledAsWheelMessage=%s, " "mScrollMessageHandledAsWheelMessage=%s, "
"mEnableSystemSettingCache=%s, " "mEnableSystemSettingCache=%s, "
"mForceEnableSystemSettingCache=%s, " "mForceEnableSystemSettingCache=%s, "
"mEmulateToMakeWindowUnderCursorForeground=%s, "
"mOverriddenVerticalScrollAmount=%d, " "mOverriddenVerticalScrollAmount=%d, "
"mOverriddenHorizontalScrollAmount=%d, " "mOverriddenHorizontalScrollAmount=%d, "
"mMouseScrollTransactionTimeout=%d", "mMouseScrollTransactionTimeout=%d",
GetBoolName(mScrollMessageHandledAsWheelMessage), GetBoolName(mScrollMessageHandledAsWheelMessage),
GetBoolName(mEnableSystemSettingCache), GetBoolName(mEnableSystemSettingCache),
GetBoolName(mForceEnableSystemSettingCache), GetBoolName(mForceEnableSystemSettingCache),
GetBoolName(mEmulateToMakeWindowUnderCursorForeground),
mOverriddenVerticalScrollAmount, mOverriddenHorizontalScrollAmount, mOverriddenVerticalScrollAmount, mOverriddenHorizontalScrollAmount,
mMouseScrollTransactionTimeout)); mMouseScrollTransactionTimeout));
} }

Просмотреть файл

@ -353,6 +353,12 @@ private:
return mForceEnableSystemSettingCache; return mForceEnableSystemSettingCache;
} }
bool ShouldEmulateToMakeWindowUnderCursorForeground()
{
Init();
return mEmulateToMakeWindowUnderCursorForeground;
}
int32_t GetOverriddenVerticalScrollAmout() int32_t GetOverriddenVerticalScrollAmout()
{ {
Init(); Init();
@ -383,6 +389,7 @@ private:
bool mScrollMessageHandledAsWheelMessage; bool mScrollMessageHandledAsWheelMessage;
bool mEnableSystemSettingCache; bool mEnableSystemSettingCache;
bool mForceEnableSystemSettingCache; bool mForceEnableSystemSettingCache;
bool mEmulateToMakeWindowUnderCursorForeground;
int32_t mOverriddenVerticalScrollAmount; int32_t mOverriddenVerticalScrollAmount;
int32_t mOverriddenHorizontalScrollAmount; int32_t mOverriddenHorizontalScrollAmount;
int32_t mMouseScrollTransactionTimeout; int32_t mMouseScrollTransactionTimeout;