зеркало из https://github.com/mozilla/gecko-dev.git
merge autoland to mozilla-central. r=merge a=merge
MozReview-Commit-ID: 5UT11zZbl2e
This commit is contained in:
Коммит
74800ca743
|
@ -234,7 +234,7 @@ async function clickDoorhangerButton(button, index) {
|
|||
} else if (button == MENU_BUTTON) {
|
||||
// Click the dropmarker arrow and wait for the menu to show up.
|
||||
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();
|
||||
ok(notification.menubutton, "notification menupopup displayed");
|
||||
let dropdownPromise =
|
||||
|
|
|
@ -164,7 +164,7 @@ const HeadersPanel = createClass({
|
|||
);
|
||||
|
||||
let summaryUrl = urlDetails.unicodeUrl ?
|
||||
this.renderSummary(SUMMARY_URL, urlDetails.unicodeUrl) : null;
|
||||
this.renderSummary(SUMMARY_URL, new URL(urlDetails.unicodeUrl).origin) : null;
|
||||
|
||||
let summaryMethod = method ?
|
||||
this.renderSummary(SUMMARY_METHOD, method) : null;
|
||||
|
|
|
@ -163,7 +163,8 @@ add_task(function* () {
|
|||
let summaryValues = panel.querySelectorAll(".tabpanel-summary-value.textbox-input");
|
||||
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(panel.querySelector(".requests-list-status-icon").dataset.code, status,
|
||||
"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 =
|
||||
ctsOrder.LastElement()->mCompositionRange.end
|
||||
- ctsOrder[0]->mCompositionRange.start;
|
||||
int64_t endDecodeTime =
|
||||
aMdhd.ToMicroseconds((int64_t)*aDecodeTime - aEdts.mMediaStart)
|
||||
+ aMvhd.ToMicroseconds(aEdts.mEmptyOffset);
|
||||
auto decodeOffset = aMdhd.ToMicroseconds((int64_t)*aDecodeTime - aEdts.mMediaStart);
|
||||
auto offsetOffset = aMvhd.ToMicroseconds(aEdts.mEmptyOffset);
|
||||
int64_t endDecodeTime = decodeOffset.isOk() & offsetOffset.isOk() ?
|
||||
decodeOffset.unwrap() + offsetOffset.unwrap() : 0;
|
||||
int64_t decodeDuration = endDecodeTime - mIndex[0].mDecodeTime;
|
||||
double adjust = (double)decodeDuration / presentationDuration;
|
||||
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);
|
||||
offset += sampleSize;
|
||||
|
||||
sample.mDecodeTime =
|
||||
aMdhd.ToMicroseconds((int64_t)decodeTime - aEdts.mMediaStart) + aMvhd.ToMicroseconds(aEdts.mEmptyOffset);
|
||||
sample.mCompositionRange = Interval<Microseconds>(
|
||||
aMdhd.ToMicroseconds((int64_t)decodeTime + ctsOffset - aEdts.mMediaStart) + aMvhd.ToMicroseconds(aEdts.mEmptyOffset),
|
||||
aMdhd.ToMicroseconds((int64_t)decodeTime + ctsOffset + sampleDuration - aEdts.mMediaStart) + aMvhd.ToMicroseconds(aEdts.mEmptyOffset));
|
||||
|
||||
Microseconds decodeOffset, emptyOffset, startCts, endCts;
|
||||
MOZ_TRY_VAR(decodeOffset, aMdhd.ToMicroseconds((int64_t)decodeTime - aEdts.mMediaStart));
|
||||
MOZ_TRY_VAR(emptyOffset, aMvhd.ToMicroseconds(aEdts.mEmptyOffset));
|
||||
sample.mDecodeTime = decodeOffset + emptyOffset;
|
||||
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,
|
||||
// because every audio sample is a keyframe.
|
||||
sample.mSync = !(sampleFlags & 0x1010000) || aIsAudio;
|
||||
|
@ -697,7 +699,9 @@ Moof::ParseTrun(Box& aBox, Tfhd& aTfhd, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, u
|
|||
}
|
||||
decodeTime += sampleDuration;
|
||||
}
|
||||
mMaxRoundingError += aMdhd.ToMicroseconds(sampleCount);
|
||||
Microseconds roundTime;
|
||||
MOZ_TRY_VAR(roundTime, aMdhd.ToMicroseconds(sampleCount));
|
||||
mMaxRoundingError += roundTime;
|
||||
|
||||
*aDecodeTime = decodeTime;
|
||||
|
||||
|
|
|
@ -33,8 +33,12 @@ public:
|
|||
}
|
||||
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 remainder = aTimescaleUnits % mTimescale;
|
||||
return major * 1000000ll + remainder * 1000000ll / mTimescale;
|
||||
|
|
|
@ -267,6 +267,8 @@ static const TestFileData rustTestFiles[] = {
|
|||
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_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)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ TEST_HARNESS_FILES.gtest += [
|
|||
'test_case_1389299.mp4',
|
||||
'test_case_1389527.mp4',
|
||||
'test_case_1395244.mp4',
|
||||
'test_case_1410565.mp4',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += ['TestMP4Rust.cpp',]
|
||||
|
|
Двоичный файл не отображается.
|
@ -78,10 +78,6 @@
|
|||
android:key="android.not_a_preference.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>
|
||||
|
||||
|
|
|
@ -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_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_PWA = NON_PREF_PREFIX + "pwa";
|
||||
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_SHOW_QUIT_MENU = NON_PREF_PREFIX + "distribution.show_quit_menu";
|
||||
|
@ -809,10 +808,6 @@ public class GeckoPreferences
|
|||
i--;
|
||||
continue;
|
||||
}
|
||||
} else if (PREFS_PWA.equals(key) && !AppConstants.MOZ_ANDROID_PWA) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
} else if (PREFS_COMPACT_TABS.equals(key)) {
|
||||
if (HardwareUtils.isTablet()) {
|
||||
preferences.removePreference(pref);
|
||||
|
|
|
@ -236,9 +236,6 @@
|
|||
<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="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_on">&pref_char_encoding_on;</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") {
|
||||
this.sendOpenSearchMessage(target);
|
||||
} else if (list.indexOf("[manifest]") != -1 &&
|
||||
aEvent.type == "DOMLinkAdded" &&
|
||||
SharedPreferences.forApp().getBoolPref("android.not_a_preference.pwa")){
|
||||
aEvent.type == "DOMLinkAdded"){
|
||||
this.makeManifestMessage(target);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -4003,6 +4003,12 @@ pref("mousewheel.enable_pixel_scrolling", true);
|
|||
// set this to true. Then, gecko processes them as mouse wheel messages.
|
||||
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,
|
||||
// and 1 is on. Set this to 1 if TrackPoint scrolling is not working.
|
||||
pref("ui.trackpoint_hack.enabled", -1);
|
||||
|
|
|
@ -289,7 +289,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "browserhtml"
|
||||
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]]
|
||||
name = "byteorder"
|
||||
|
|
|
@ -422,22 +422,23 @@ class Session(object):
|
|||
:param body: Optional body of the HTTP request.
|
||||
|
||||
: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
|
||||
an error.
|
||||
"""
|
||||
response = self.transport.send(method, url, body)
|
||||
|
||||
if response.status != 200:
|
||||
raise error.from_response(response)
|
||||
|
||||
if "value" in response.body:
|
||||
value = response.body["value"]
|
||||
else:
|
||||
raise error.UnknownErrorException("No '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"))
|
||||
raise error.UnknownErrorException(
|
||||
"Expected 'value' key in response body:\n"
|
||||
"%s" % json.dumps(response.body))
|
||||
|
||||
return value
|
||||
|
||||
|
|
|
@ -1,10 +1,25 @@
|
|||
import collections
|
||||
import json
|
||||
|
||||
|
||||
class WebDriverException(Exception):
|
||||
http_status = 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):
|
||||
http_status = 400
|
||||
|
@ -131,11 +146,40 @@ class UnsupportedOperationException(WebDriverException):
|
|||
status_code = "unsupported operation"
|
||||
|
||||
|
||||
def get(status_code):
|
||||
"""Gets exception from `status_code`, falling back to
|
||||
def from_response(response):
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
return _errors.get(status_code, WebDriverException)
|
||||
return _errors.get(error_code, WebDriverException)
|
||||
|
||||
|
||||
_errors = collections.defaultdict()
|
||||
|
|
|
@ -4,16 +4,28 @@ import urlparse
|
|||
|
||||
import error
|
||||
|
||||
|
||||
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
|
||||
appropriate."""
|
||||
"""
|
||||
Describes an HTTP response received from a remote end whose
|
||||
body has been read and parsed as appropriate.
|
||||
"""
|
||||
|
||||
def __init__(self, status, body):
|
||||
self.status = status
|
||||
self.body = body
|
||||
|
||||
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
|
||||
def from_http_response(cls, http_response):
|
||||
|
@ -45,17 +57,18 @@ class ToJsonEncoder(json.JSONEncoder):
|
|||
|
||||
|
||||
class HTTPWireProtocol(object):
|
||||
"""Transports messages (commands and responses) over the WebDriver
|
||||
"""
|
||||
Transports messages (commands and responses) over the WebDriver
|
||||
wire protocol.
|
||||
"""
|
||||
|
||||
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 wait: Duration to wait for remote to appear.
|
||||
"""
|
||||
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.url_prefix = url_prefix
|
||||
|
@ -66,7 +79,8 @@ class HTTPWireProtocol(object):
|
|||
return urlparse.urljoin(self.url_prefix, suffix)
|
||||
|
||||
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 uri: Relative endpoint of the requests URL path.
|
||||
|
@ -76,7 +90,6 @@ class HTTPWireProtocol(object):
|
|||
|
||||
:return: Instance of ``wdclient.Response`` describing the
|
||||
HTTP response received from the remote end.
|
||||
|
||||
"""
|
||||
if body is None and method == "POST":
|
||||
body = {}
|
||||
|
|
|
@ -56,6 +56,7 @@ def run(path, server_config, session_config, timeout=0):
|
|||
"--verbose", # show each individual subtest
|
||||
"--capture", "no", # enable stdout/stderr from tests
|
||||
"--basetemp", cache, # temporary directory
|
||||
"--showlocals", # display contents of variables in local scope
|
||||
"-p", "no:mozlog", # use the WPT result recorder
|
||||
"-p", "no:cacheprovider", # disable state preservation across invocations
|
||||
path],
|
||||
|
|
|
@ -1,22 +1,29 @@
|
|||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_error, assert_success, assert_dialog_handled, assert_same_element
|
||||
from tests.support.asserts import assert_error, assert_dialog_handled, assert_same_element
|
||||
from tests.support.fixtures import create_dialog
|
||||
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:
|
||||
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
|
||||
# > error code no such window.
|
||||
|
@ -25,10 +32,9 @@ def test_closed_context(session, create_window):
|
|||
session.window_handle = new_window
|
||||
session.close()
|
||||
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/element/active" % session.session_id)
|
||||
response = get_active_element(session)
|
||||
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.
|
||||
|
@ -49,30 +55,25 @@ def test_handle_prompt_dismiss(new_session):
|
|||
|
||||
create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1")
|
||||
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/element/active" % session.session_id)
|
||||
|
||||
assert_result_is_active_element(session, result)
|
||||
response = get_active_element(session)
|
||||
assert_is_active_element(session, response)
|
||||
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")
|
||||
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/element/active" % session.session_id)
|
||||
|
||||
assert_result_is_active_element(session, result)
|
||||
response = get_active_element(session)
|
||||
assert_is_active_element(session, response)
|
||||
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")
|
||||
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/element/active" % session.session_id)
|
||||
|
||||
assert_result_is_active_element(session, result)
|
||||
response = get_active_element(session)
|
||||
assert_is_active_element(session, response)
|
||||
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.
|
||||
|
@ -92,31 +93,26 @@ def test_handle_prompt_accept(new_session):
|
|||
session.url = inline("<body><p>Hello, World!</p></body>")
|
||||
create_dialog(session)("alert", text="accept #1", result_var="accept1")
|
||||
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/element/active" % session.session_id)
|
||||
|
||||
assert_result_is_active_element(session, result)
|
||||
response = get_active_element(session)
|
||||
assert_is_active_element(session, response)
|
||||
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")
|
||||
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/element/active" % session.session_id)
|
||||
|
||||
assert_result_is_active_element(session, result)
|
||||
response = get_active_element(session)
|
||||
assert_is_active_element(session, response)
|
||||
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")
|
||||
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/element/active" % session.session_id)
|
||||
|
||||
assert_result_is_active_element(session, result)
|
||||
response = get_active_element(session)
|
||||
assert_is_active_element(session, response)
|
||||
assert_dialog_handled(session, "accept #3")
|
||||
assert read_global(session, "accept3") == ""
|
||||
|
||||
|
||||
# [...]
|
||||
# 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")
|
||||
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/element/active" % session.session_id)
|
||||
|
||||
assert_error(result, "unexpected alert open")
|
||||
response = get_active_element(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
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")
|
||||
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/element/active" % session.session_id)
|
||||
|
||||
assert_error(result, "unexpected alert open")
|
||||
response = get_active_element(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
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")
|
||||
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/element/active" % session.session_id)
|
||||
|
||||
assert_error(result, "unexpected alert open")
|
||||
response = get_active_element(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
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
|
||||
|
@ -170,36 +161,36 @@ def test_success_document(session):
|
|||
<h1>Heading</h1>
|
||||
<input />
|
||||
<input />
|
||||
<input style="opacity: 0;" />
|
||||
<input style="opacity: 0" />
|
||||
<p>Another element</p>
|
||||
</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):
|
||||
session.url = inline("""
|
||||
<body>
|
||||
<h1>Heading</h1>
|
||||
<input autofocus />
|
||||
<input style="opacity: 0;" />
|
||||
<input style="opacity: 0" />
|
||||
<p>Another element</p>
|
||||
</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):
|
||||
session.url = inline("""
|
||||
<body>
|
||||
<h1>Heading</h1>
|
||||
<input />
|
||||
<input style="opacity: 0;" autofocus />
|
||||
<input style="opacity: 0" autofocus />
|
||||
<p>Another element</p>
|
||||
</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):
|
||||
session.url = inline("""
|
||||
|
@ -209,44 +200,45 @@ def test_success_explicit_focus(session):
|
|||
<iframe></iframe>
|
||||
</body>""")
|
||||
|
||||
session.execute_script("document.body.getElementsByTagName('h1')[0].focus();")
|
||||
result = session.transport.send("GET", "session/%s/element/active" % session.session_id)
|
||||
assert_result_is_active_element(session, result)
|
||||
session.execute_script("document.body.getElementsByTagName('h1')[0].focus()")
|
||||
response = get_active_element(session)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
session.execute_script("document.body.getElementsByTagName('input')[0].focus();")
|
||||
result = session.transport.send("GET", "session/%s/element/active" % session.session_id)
|
||||
assert_result_is_active_element(session, result)
|
||||
session.execute_script("document.body.getElementsByTagName('input')[0].focus()")
|
||||
response = get_active_element(session)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
session.execute_script("document.body.getElementsByTagName('iframe')[0].focus();")
|
||||
result = session.transport.send("GET", "session/%s/element/active" % session.session_id)
|
||||
assert_result_is_active_element(session, result)
|
||||
session.execute_script("document.body.getElementsByTagName('iframe')[0].focus()")
|
||||
response = get_active_element(session)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
session.execute_script("document.body.getElementsByTagName('iframe')[0].focus();")
|
||||
session.execute_script("document.body.getElementsByTagName('iframe')[0].remove();")
|
||||
result = session.transport.send("GET", "session/%s/element/active" % session.session_id)
|
||||
assert_result_is_active_element(session, result)
|
||||
session.execute_script("document.body.getElementsByTagName('iframe')[0].focus()")
|
||||
session.execute_script("document.body.getElementsByTagName('iframe')[0].remove()")
|
||||
response = get_active_element(session)
|
||||
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):
|
||||
session.url = inline("<body></body>")
|
||||
session.execute_script("""
|
||||
var iframe = document.createElement('iframe');
|
||||
let iframe = document.createElement('iframe');
|
||||
document.body.appendChild(iframe);
|
||||
var input = iframe.contentDocument.createElement('input');
|
||||
let input = iframe.contentDocument.createElement('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):
|
||||
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)
|
||||
|
||||
assert_result_is_active_element(session, result)
|
||||
response = get_active_element(session)
|
||||
assert_is_active_element(session, response)
|
||||
|
|
|
@ -68,6 +68,7 @@ def assert_error(response, error_code):
|
|||
assert isinstance(response.body["value"]["message"], basestring)
|
||||
assert isinstance(response.body["value"]["stacktrace"], basestring)
|
||||
|
||||
|
||||
def assert_success(response, value=None):
|
||||
"""Verify that the provided wdclient.Response instance described a valid
|
||||
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.
|
||||
|
||||
"""
|
||||
assert response.status == 200
|
||||
assert response.status == 200, str(response.error)
|
||||
|
||||
if value is not None:
|
||||
assert response.body["value"] == value
|
||||
return response.body.get("value")
|
||||
|
||||
|
||||
def assert_dialog_handled(session, expected_text):
|
||||
result = session.transport.send("GET",
|
||||
"session/%s/alert/text" % session.session_id)
|
||||
|
@ -97,6 +100,7 @@ def assert_dialog_handled(session, expected_text):
|
|||
result.body["value"] != expected_text), (
|
||||
"Dialog with text '%s' was not handled." % expected_text)
|
||||
|
||||
|
||||
def assert_same_element(session, a, b):
|
||||
"""Verify that two element references describe the same element."""
|
||||
assert isinstance(a, dict), "Actual value is not a dictionary"
|
||||
|
|
|
@ -263,7 +263,6 @@ if CONFIG['GNU_CXX']:
|
|||
'-Wno-unused-local-typedef',
|
||||
]
|
||||
elif CONFIG['_MSC_VER']:
|
||||
DEFINES['NOGDI'] = True # wingdi.h defines ERROR as 0 and conflicts with logging.h
|
||||
CXXFLAGS += [
|
||||
'-wd4005', # 'WIN32_LEAN_AND_MEAN' : macro redefinition
|
||||
'-wd4018', # '<' : signed/unsigned mismatch
|
||||
|
@ -273,6 +272,9 @@ elif CONFIG['_MSC_VER']:
|
|||
'-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']:
|
||||
DEFINES['HAVE_PTHREAD'] = True
|
||||
|
||||
|
|
|
@ -446,6 +446,14 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget,
|
|||
|
||||
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
|
||||
// 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
|
||||
|
@ -1121,6 +1129,9 @@ MouseScrollHandler::UserPrefs::Init()
|
|||
mForceEnableSystemSettingCache =
|
||||
Preferences::GetBool("mousewheel.system_settings_cache.force_enabled",
|
||||
false);
|
||||
mEmulateToMakeWindowUnderCursorForeground =
|
||||
Preferences::GetBool("mousewheel.debug.make_window_under_cursor_foreground",
|
||||
false);
|
||||
mOverriddenVerticalScrollAmount =
|
||||
Preferences::GetInt("mousewheel.windows.vertical_amount_override", -1);
|
||||
mOverriddenHorizontalScrollAmount =
|
||||
|
@ -1134,12 +1145,14 @@ MouseScrollHandler::UserPrefs::Init()
|
|||
"mScrollMessageHandledAsWheelMessage=%s, "
|
||||
"mEnableSystemSettingCache=%s, "
|
||||
"mForceEnableSystemSettingCache=%s, "
|
||||
"mEmulateToMakeWindowUnderCursorForeground=%s, "
|
||||
"mOverriddenVerticalScrollAmount=%d, "
|
||||
"mOverriddenHorizontalScrollAmount=%d, "
|
||||
"mMouseScrollTransactionTimeout=%d",
|
||||
GetBoolName(mScrollMessageHandledAsWheelMessage),
|
||||
GetBoolName(mEnableSystemSettingCache),
|
||||
GetBoolName(mForceEnableSystemSettingCache),
|
||||
GetBoolName(mEmulateToMakeWindowUnderCursorForeground),
|
||||
mOverriddenVerticalScrollAmount, mOverriddenHorizontalScrollAmount,
|
||||
mMouseScrollTransactionTimeout));
|
||||
}
|
||||
|
|
|
@ -353,6 +353,12 @@ private:
|
|||
return mForceEnableSystemSettingCache;
|
||||
}
|
||||
|
||||
bool ShouldEmulateToMakeWindowUnderCursorForeground()
|
||||
{
|
||||
Init();
|
||||
return mEmulateToMakeWindowUnderCursorForeground;
|
||||
}
|
||||
|
||||
int32_t GetOverriddenVerticalScrollAmout()
|
||||
{
|
||||
Init();
|
||||
|
@ -383,6 +389,7 @@ private:
|
|||
bool mScrollMessageHandledAsWheelMessage;
|
||||
bool mEnableSystemSettingCache;
|
||||
bool mForceEnableSystemSettingCache;
|
||||
bool mEmulateToMakeWindowUnderCursorForeground;
|
||||
int32_t mOverriddenVerticalScrollAmount;
|
||||
int32_t mOverriddenHorizontalScrollAmount;
|
||||
int32_t mMouseScrollTransactionTimeout;
|
||||
|
|
Загрузка…
Ссылка в новой задаче