Merge mozilla-central to inbound. a=merge CLOSED TREE

This commit is contained in:
shindli 2018-06-19 00:46:12 +03:00
Родитель b47f2957a9 47e680690d
Коммит 350fbcac6e
43 изменённых файлов: 298 добавлений и 365 удалений

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

@ -143,3 +143,4 @@ e33efdb3e1517d521deb949de3fcd6d9946ea440 FIREFOX_BETA_60_BASE
fdd1a0082c71673239fc2f3a6a93de889c07a1be FIREFOX_NIGHTLY_60_END
ccfd7b716a91241ddbc084cb7116ec561e56d5d1 FIREFOX_BETA_61_BASE
93443d36d4bd53dba004f7b73430879f96daa681 FIREFOX_NIGHTLY_61_END
9b74b9f2939a7ae3a0ea6e711dc32ed5203e03ff FIREFOX_BETA_62_BASE

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

@ -22,9 +22,8 @@ function test() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
let uriToWaitFor = URI.replace(/ /g, "%20");
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false,
uriToWaitFor).then(function() {
URI).then(function() {
var doc = gBrowser.contentDocumentAsCPOW;
var testImg = doc.getElementById("test-image");
var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec,

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

@ -62,7 +62,7 @@ add_task(async function test_formdata() {
* before doing so.
*/
add_task(async function test_url_check() {
const URL = "data:text/html;charset=utf-8,<input%20id=input>";
const URL = "data:text/html;charset=utf-8,<input id=input>";
const VALUE = "value-" + Math.random();
// Create a tab with an iframe containing an input field.
@ -104,7 +104,7 @@ add_task(async function test_nested() {
const FORM_DATA = {
children: [{
xpath: {"/xhtml:html/xhtml:body/xhtml:input": "m"},
url: "data:text/html;charset=utf-8,<input%20autofocus=true>"
url: "data:text/html;charset=utf-8,<input autofocus=true>"
}]
};

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

@ -17,7 +17,7 @@ const PREF_MESSAGE_TIMESTAMP = "devtools.webconsole.timestampMessages";
const TEST_URI = `data:text/html;charset=utf-8,<script>
window.logStuff = function () {
console.log("simple text message");
console.log("simple " + "text message");
function wrapper() {
console.trace();
}
@ -49,7 +49,7 @@ add_task(async function() {
info("Check copied text for simple log message");
let lines = clipboardText.split("\n");
ok(lines.length, 2, "There are 2 lines in the copied text");
is(lines.length, 2, "There are 2 lines in the copied text");
is(lines[1], "", "The last line is an empty new line");
ok(LOG_FORMAT_WITH_TIMESTAMP.test(lines[0]),
"Log line has the right format:\n" + lines[0]);
@ -61,7 +61,7 @@ add_task(async function() {
info("Check copied text for stack trace message");
lines = clipboardText.split("\n");
ok(lines.length, 4, "There are 4 lines in the copied text");
is(lines.length, 4, "There are 4 lines in the copied text");
is(lines[3], "", "The last line is an empty new line");
ok(LOG_FORMAT_WITH_TIMESTAMP.test(lines[0]),
"Log line has the right format:\n" + lines[0]);
@ -81,7 +81,7 @@ add_task(async function() {
info("Check copied text for simple log message");
lines = clipboardText.split("\n");
ok(lines.length, 2, "There are 2 lines in the copied text");
is(lines.length, 2, "There are 2 lines in the copied text");
is(lines[1], "", "The last line is an empty new line");
ok(LOG_FORMAT_WITHOUT_TIMESTAMP.test(lines[0]),
"Log line has the right format:\n" + lines[0]);
@ -93,7 +93,7 @@ add_task(async function() {
info("Check copied text for stack trace message");
lines = clipboardText.split("\n");
ok(lines.length, 4, "There are 4 lines in the copied text");
is(lines.length, 4, "There are 4 lines in the copied text");
is(lines[3], "", "The last line is an empty new line");
ok(LOG_FORMAT_WITHOUT_TIMESTAMP.test(lines[0]),
"Log line has the right format:\n" + lines[0]);

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

@ -60,9 +60,7 @@ skip-if = os == 'mac' || os == 'win' || toolkit == 'android' # Bug 1404995, no l
[test_getUserMedia_basicVideo.html]
[test_getUserMedia_basicVideo_playAfterLoadedmetadata.html]
[test_getUserMedia_basicScreenshare.html]
#skip-if = toolkit == 'android' # no screenshare on android
# When re-enabling this test, uncomment the line above.
disabled=bug 1405083
skip-if = toolkit == 'android' # no screenshare on android
[test_getUserMedia_basicTabshare.html]
skip-if = toolkit == 'android' # no windowshare on android
[test_getUserMedia_basicWindowshare.html]

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

@ -393,7 +393,7 @@ SpeechDispatcherService::Setup()
uri.AssignLiteral(URI_PREFIX);
nsAutoCString name;
NS_EscapeURL(list[i]->name, -1, esc_OnlyNonASCII | esc_AlwaysCopy, name);
NS_EscapeURL(list[i]->name, -1, esc_OnlyNonASCII | esc_Spaces | esc_AlwaysCopy, name);
uri.Append(NS_ConvertUTF8toUTF16(name));;
uri.AppendLiteral("?");

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

@ -479,7 +479,7 @@
// we don't implement a spec-compliant parser yet.
// make sure we are bug compatible with existing implementations.
url = new URL("data:text/html,<a href=\"http://example.org/?q\">Link</a>");
is(url.href, "data:text/html,<a%20href=\"http://example.org/?q\">Link</a>");
is(url.href, "data:text/html,<a href=\"http://example.org/?q\">Link</a>");
</script>
<script>

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

@ -43,7 +43,6 @@ class nsXBLSpecialDocInfo : public nsIObserver
{
public:
RefPtr<nsXBLDocumentInfo> mHTMLBindings;
RefPtr<nsXBLDocumentInfo> mUserHTMLBindings;
static const char sHTMLBindingStr[];
static const char sUserHTMLBindingStr[];
@ -55,12 +54,8 @@ public:
NS_DECL_NSIOBSERVER
void LoadDocInfo();
void GetAllHandlers(const char* aType,
nsXBLPrototypeHandler** handler,
nsXBLPrototypeHandler** userHandler);
void GetHandlers(nsXBLDocumentInfo* aInfo,
const nsACString& aRef,
nsXBLPrototypeHandler** aResult);
void GetHandlers(const nsACString& aRef,
nsXBLPrototypeHandler** handler);
nsXBLSpecialDocInfo() : mInitialized(false) {}
@ -83,7 +78,6 @@ nsXBLSpecialDocInfo::Observe(nsISupports* aSubject,
// On shutdown, clear our fields to avoid an extra cycle collection.
mHTMLBindings = nullptr;
mUserHTMLBindings = nullptr;
mInitialized = false;
nsContentUtils::UnregisterShutdownObserver(this);
@ -119,31 +113,17 @@ void nsXBLSpecialDocInfo::LoadDocInfo()
//
//
void
nsXBLSpecialDocInfo::GetHandlers(nsXBLDocumentInfo* aInfo,
const nsACString& aRef,
nsXBLPrototypeHandler** aResult)
nsXBLSpecialDocInfo::GetHandlers(const nsACString& aRef,
nsXBLPrototypeHandler** aHandler)
{
nsXBLPrototypeBinding* binding = aInfo->GetPrototypeBinding(aRef);
NS_ASSERTION(binding, "No binding found for the XBL window key handler.");
if (!binding)
return;
*aResult = binding->GetPrototypeHandlers();
}
void
nsXBLSpecialDocInfo::GetAllHandlers(const char* aType,
nsXBLPrototypeHandler** aHandler,
nsXBLPrototypeHandler** aUserHandler)
{
if (mUserHTMLBindings) {
nsAutoCString type(aType);
type.AppendLiteral("User");
GetHandlers(mUserHTMLBindings, type, aUserHandler);
}
if (mHTMLBindings) {
GetHandlers(mHTMLBindings, nsDependentCString(aType), aHandler);
nsXBLPrototypeBinding* binding = mHTMLBindings->GetPrototypeBinding(aRef);
NS_ASSERTION(binding, "No binding found for the XBL window key handler.");
if (!binding)
return;
*aHandler = binding->GetPrototypeHandlers();
}
}
@ -163,8 +143,7 @@ nsXBLWindowKeyHandler::EnsureSpecialDocInfo()
nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(Element* aElement,
EventTarget* aTarget)
: mTarget(aTarget),
mHandler(nullptr),
mUserHandler(nullptr)
mHandler(nullptr)
{
mWeakPtrForElement = do_GetWeakReference(aElement);
++sRefCnt;
@ -256,10 +235,10 @@ nsXBLWindowKeyHandler::EnsureHandlers()
// Now determine which handlers we should be using.
if (IsHTMLEditableFieldFocused()) {
sXBLSpecialDocInfo->GetAllHandlers("editor", &mHandler, &mUserHandler);
sXBLSpecialDocInfo->GetHandlers(NS_LITERAL_CSTRING("editor"), &mHandler);
}
else {
sXBLSpecialDocInfo->GetAllHandlers("browser", &mHandler, &mUserHandler);
sXBLSpecialDocInfo->GetHandlers(NS_LITERAL_CSTRING("browser"), &mHandler);
}
}
@ -283,21 +262,13 @@ nsXBLWindowKeyHandler::WalkHandlers(KeyboardEvent* aKeyEvent, nsAtom* aEventType
bool isDisabled;
nsCOMPtr<Element> el = GetElement(&isDisabled);
if (!el) {
if (mUserHandler) {
WalkHandlersInternal(aKeyEvent, aEventType, mUserHandler, true);
if (aKeyEvent->DefaultPrevented()) {
return NS_OK; // Handled by the user bindings. Our work here is done.
}
}
}
// skip keysets that are disabled
if (el && isDisabled) {
return NS_OK;
}
WalkHandlersInternal(aKeyEvent, aEventType, mHandler, true);
WalkHandlersInternal(aKeyEvent, aEventType, true);
return NS_OK;
}
@ -430,8 +401,7 @@ nsXBLWindowKeyHandler::CollectKeyboardShortcuts()
EnsureSpecialDocInfo();
nsXBLPrototypeHandler* handlers = nullptr;
nsXBLPrototypeHandler* userHandlers = nullptr;
sXBLSpecialDocInfo->GetAllHandlers("browser", &handlers, &userHandlers);
sXBLSpecialDocInfo->GetHandlers(NS_LITERAL_CSTRING("browser"), &handlers);
// Convert the handlers into keyboard shortcuts, using an AutoTArray with
// the maximum amount of shortcuts used on any platform to minimize allocations
@ -449,15 +419,6 @@ nsXBLWindowKeyHandler::CollectKeyboardShortcuts()
}
}
for (nsXBLPrototypeHandler* handler = userHandlers;
handler;
handler = handler->GetNextHandler()) {
KeyboardShortcut shortcut;
if (handler->TryConvertToKeyboardShortcut(&shortcut)) {
shortcuts.AppendElement(shortcut);
}
}
return KeyboardMap(std::move(shortcuts));
}
@ -643,7 +604,6 @@ nsXBLWindowKeyHandler::IsHTMLEditableFieldFocused()
bool
nsXBLWindowKeyHandler::WalkHandlersInternal(KeyboardEvent* aKeyEvent,
nsAtom* aEventType,
nsXBLPrototypeHandler* aHandler,
bool aExecute,
bool* aOutReservedForChrome)
{
@ -655,7 +615,7 @@ nsXBLWindowKeyHandler::WalkHandlersInternal(KeyboardEvent* aKeyEvent,
nativeKeyboardEvent->GetShortcutKeyCandidates(shortcutKeys);
if (shortcutKeys.IsEmpty()) {
return WalkHandlersAndExecute(aKeyEvent, aEventType, aHandler,
return WalkHandlersAndExecute(aKeyEvent, aEventType,
0, IgnoreModifierState(),
aExecute, aOutReservedForChrome);
}
@ -664,7 +624,7 @@ nsXBLWindowKeyHandler::WalkHandlersInternal(KeyboardEvent* aKeyEvent,
ShortcutKeyCandidate& key = shortcutKeys[i];
IgnoreModifierState ignoreModifierState;
ignoreModifierState.mShift = key.mIgnoreShift;
if (WalkHandlersAndExecute(aKeyEvent, aEventType, aHandler,
if (WalkHandlersAndExecute(aKeyEvent, aEventType,
key.mCharCode, ignoreModifierState,
aExecute, aOutReservedForChrome)) {
return true;
@ -677,7 +637,6 @@ bool
nsXBLWindowKeyHandler::WalkHandlersAndExecute(
KeyboardEvent* aKeyEvent,
nsAtom* aEventType,
nsXBLPrototypeHandler* aFirstHandler,
uint32_t aCharCode,
const IgnoreModifierState& aIgnoreModifierState,
bool aExecute,
@ -694,7 +653,7 @@ nsXBLWindowKeyHandler::WalkHandlersAndExecute(
}
// Try all of the handlers until we find one that matches the event.
for (nsXBLPrototypeHandler* handler = aFirstHandler;
for (nsXBLPrototypeHandler* handler = mHandler;
handler;
handler = handler->GetNextHandler()) {
bool stopped = aKeyEvent->IsDispatchStopped();
@ -815,7 +774,7 @@ nsXBLWindowKeyHandler::WalkHandlersAndExecute(
if (!aIgnoreModifierState.mOS && widgetKeyboardEvent->IsOS()) {
IgnoreModifierState ignoreModifierState(aIgnoreModifierState);
ignoreModifierState.mOS = true;
return WalkHandlersAndExecute(aKeyEvent, aEventType, aFirstHandler,
return WalkHandlersAndExecute(aKeyEvent, aEventType,
aCharCode, ignoreModifierState, aExecute);
}
#endif
@ -863,7 +822,7 @@ nsXBLWindowKeyHandler::HasHandlerForEvent(KeyboardEvent* aEvent,
RefPtr<nsAtom> eventTypeAtom =
ConvertEventToDOMEventType(*widgetKeyboardEvent);
return WalkHandlersInternal(aEvent, eventTypeAtom, mHandler, false,
return WalkHandlersInternal(aEvent, eventTypeAtom, false,
aOutReservedForChrome);
}

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

@ -55,14 +55,12 @@ protected:
// walk the handlers, looking for one to handle the event
bool WalkHandlersInternal(KeyboardEvent* aKeyEvent,
nsAtom* aEventType,
nsXBLPrototypeHandler* aHandler,
bool aExecute,
bool* aOutReservedForChrome = nullptr);
// walk the handlers for aEvent, aCharCode and aIgnoreModifierState. Execute
// it if aExecute = true.
bool WalkHandlersAndExecute(KeyboardEvent* aKeyEvent, nsAtom* aEventType,
nsXBLPrototypeHandler* aHandler,
uint32_t aCharCode,
const IgnoreModifierState& aIgnoreModifierState,
bool aExecute,
@ -131,7 +129,6 @@ protected:
// these are not owning references; the prototype handlers are owned
// by the prototype bindings which are owned by the docinfo.
nsXBLPrototypeHandler* mHandler; // platform bindings
nsXBLPrototypeHandler* mUserHandler; // user-specific bindings
// holds reference count to document info about bindings
static uint32_t sRefCnt;

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

@ -438,8 +438,8 @@ public:
~LayerManagerData() {
MOZ_COUNT_DTOR(LayerManagerData);
for (auto iter = mDisplayItems.Iter(); !iter.Done(); iter.Next()) {
iter.Get()->GetKey()->Disconnect();
for (auto& item : mDisplayItems) {
item->Disconnect();
}
}
@ -447,9 +447,7 @@ public:
void Dump(const char *aPrefix = "") {
printf_stderr("%sLayerManagerData %p\n", aPrefix, this);
for (auto iter = mDisplayItems.Iter(); !iter.Done(); iter.Next()) {
FrameLayerBuilder::DisplayItemData* data = iter.Get()->GetKey();
for (auto& data : mDisplayItems) {
nsAutoCString prefix;
prefix += aPrefix;
prefix += " ";
@ -507,7 +505,7 @@ public:
#ifdef DEBUG_DISPLAY_ITEM_DATA
LayerManagerData *mParent;
#endif
nsTHashtable<nsRefPtrHashKey<DisplayItemData> > mDisplayItems;
std::vector<RefPtr<DisplayItemData>> mDisplayItems;
bool mInvalidateAllLayers;
};
@ -2149,7 +2147,12 @@ FrameLayerBuilder::RemoveFrameFromLayerManager(const nsIFrame* aFrame,
}
data->Disconnect();
data->mParent->mDisplayItems.RemoveEntry(data);
auto it = std::find(data->mParent->mDisplayItems.begin(),
data->mParent->mDisplayItems.end(),
data);
MOZ_ASSERT(it != data->mParent->mDisplayItems.end());
std::iter_swap(it, data->mParent->mDisplayItems.end() - 1);
data->mParent->mDisplayItems.pop_back();
}
arrayCopy.Clear();
@ -2189,28 +2192,42 @@ FrameLayerBuilder::WillEndTransaction()
NS_ASSERTION(data, "Must have data!");
// Update all the frames that used to have layers.
for (auto iter = data->mDisplayItems.Iter(); !iter.Done(); iter.Next()) {
DisplayItemData* data = iter.Get()->GetKey();
if (!data->mUsed) {
auto iter = data->mDisplayItems.begin();
while (iter != data->mDisplayItems.end()) {
DisplayItemData* did = iter->get();
if (!did->mUsed) {
// This item was visible, but isn't anymore.
PaintedLayer* t = data->mLayer->AsPaintedLayer();
if (t && data->mGeometry) {
PaintedLayer* t = did->mLayer->AsPaintedLayer();
if (t && did->mGeometry) {
#ifdef MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
printf_stderr("Invalidating unused display item (%i) belonging to frame %p from layer %p\n", data->mDisplayItemKey, data->mFrameList[0], t);
printf_stderr("Invalidating unused display item (%i) belonging to frame %p from layer %p\n", did->mDisplayItemKey, did->mFrameList[0], t);
}
#endif
InvalidatePostTransformRegion(t,
data->mGeometry->ComputeInvalidationRegion(),
data->mClip,
did->mGeometry->ComputeInvalidationRegion(),
did->mClip,
GetLastPaintOffset(t));
}
data->ClearAnimationCompositorState();
data->Disconnect();
iter.Remove();
did->ClearAnimationCompositorState();
did->Disconnect();
// Remove this item. Swapping it with the last element first is
// quicker than erasing from the middle.
if (iter != data->mDisplayItems.end() - 1) {
std::iter_swap(iter, data->mDisplayItems.end() - 1);
data->mDisplayItems.pop_back();
} else {
data->mDisplayItems.pop_back();
break;
}
// Don't increment iter because we still need to process the item which was moved.
} else {
ComputeGeometryChangeForItem(data);
ComputeGeometryChangeForItem(did);
iter++;
}
}
@ -5121,7 +5138,7 @@ FrameLayerBuilder::StoreDataForFrame(nsDisplayItem* aItem, Layer* aLayer,
data->BeginUpdate(aLayer, aState, true, aItem);
lmd->mDisplayItems.PutEntry(data);
lmd->mDisplayItems.push_back(data);
return data;
}
@ -5145,7 +5162,7 @@ FrameLayerBuilder::StoreDataForFrame(nsIFrame* aFrame,
data->BeginUpdate(aLayer, aState, true);
lmd->mDisplayItems.PutEntry(data);
lmd->mDisplayItems.push_back(data);
}
AssignedDisplayItem::AssignedDisplayItem(nsDisplayItem* aItem,

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

@ -1186,7 +1186,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "0s", "0ms" ],
other_values: [ "1s", "250ms", "-100ms", "-1s", "1s, 250ms, 2.3s"],
other_values: [ "1s", "250ms", "-100ms", "-1s", "1s, 250ms, 2.3s", "calc(1s + 2ms)" ],
invalid_values: [ "0", "0px" ]
},
"animation-direction": {
@ -1202,7 +1202,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "0s", "0ms" ],
other_values: [ "1s", "250ms", "1s, 250ms, 2.3s"],
other_values: [ "1s", "250ms", "1s, 250ms, 2.3s", "calc(1s + 2ms)" ],
invalid_values: [ "0", "0px", "-1ms", "-2s" ]
},
"animation-fill-mode": {
@ -1218,7 +1218,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "1" ],
other_values: [ "infinite", "0", "0.5", "7.75", "-0.0", "1, 2, 3", "infinite, 2", "1, infinite" ],
other_values: [ "infinite", "0", "0.5", "7.75", "-0.0", "1, 2, 3", "infinite, 2", "1, infinite", "calc(1 + 2.0)" ],
// negatives forbidden per
// http://lists.w3.org/Archives/Public/www-style/2011Mar/0355.html
invalid_values: [ "none", "-1", "-0.5", "-1, infinite", "infinite, -3" ]
@ -1244,7 +1244,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "ease" ],
other_values: [ "cubic-bezier(0.25, 0.1, 0.25, 1.0)", "linear", "ease-in", "ease-out", "ease-in-out", "linear, ease-in, cubic-bezier(0.1, 0.2, 0.8, 0.9)", "cubic-bezier(0.5, 0.5, 0.5, 0.5)", "cubic-bezier(0.25, 1.5, 0.75, -0.5)", "step-start", "step-end", "steps(1)", "steps(2, start)", "steps(386)", "steps(3, end)" ],
other_values: [ "cubic-bezier(0.25, 0.1, 0.25, 1.0)", "linear", "ease-in", "ease-out", "ease-in-out", "linear, ease-in, cubic-bezier(0.1, 0.2, 0.8, 0.9)", "cubic-bezier(0.5, 0.5, 0.5, 0.5)", "cubic-bezier(0.25, 1.5, 0.75, -0.5)", "step-start", "step-end", "steps(1)", "steps(2, start)", "steps(386)", "steps(3, end)", "steps(calc(2 + 1))" ],
invalid_values: [ "none", "auto", "cubic-bezier(0.25, 0.1, 0.25)", "cubic-bezier(0.25, 0.1, 0.25, 0.25, 1.0)", "cubic-bezier(-0.5, 0.5, 0.5, 0.5)", "cubic-bezier(1.5, 0.5, 0.5, 0.5)", "cubic-bezier(0.5, 0.5, -0.5, 0.5)", "cubic-bezier(0.5, 0.5, 1.5, 0.5)", "steps(2, step-end)", "steps(0)", "steps(-2)", "steps(0, step-end, 1)" ]
},
"-moz-appearance": {

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

@ -667,9 +667,9 @@ function AddTestItem(aTest, aFilter) {
var globalFilter = aFilter[0];
var manifestFilter = aFilter[1];
var invertManifest = aFilter[2];
if ((globalFilter && !globalFilter.test(url1.spec)) ||
(manifestFilter &&
!(invertManifest ^ manifestFilter.test(url1.spec))))
if (globalFilter && !globalFilter.test(url1.spec))
return;
if (manifestFilter && !(invertManifest ^ manifestFilter.test(url1.spec)))
return;
if (g.focusFilterMode == FOCUS_FILTER_NEEDS_FOCUS_TESTS &&
!aTest.needsFocus)

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

@ -197,7 +197,7 @@ class ReftestResolver(object):
break
if found:
rv = [(os.path.join(dirname, default_manifest),
r".*(?:/|\\)%s(?:[#?].*)?$" % pathname)]
r".*(?:/|\\)%s(?:[#?].*)?$" % pathname.replace('?', '\?'))]
return rv

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

@ -31,11 +31,6 @@
#ifdef WEBRTC_MAC
#include <AvailabilityMacros.h>
#endif
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
// XXX not available in Mac 10.7 SDK
#include "webrtc/common_video/include/corevideo_frame_buffer.h"
#endif
@ -1907,16 +1902,12 @@ WebrtcVideoConduit::SendVideoFrame(const webrtc::VideoFrame& frame)
buffer = frame.video_frame_buffer();
// XXX Bug 1367651 - Use nativehandles where possible instead of software scaling
#ifdef WEBRTC_MAC
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
// XXX not available in Mac 10.7 SDK
// code adapted from objvideotracksource.mm
} else if (frame.video_frame_buffer()->native_handle()) {
// Adapted CVPixelBuffer frame.
buffer = new rtc::RefCountedObject<webrtc::CoreVideoFrameBuffer>(
static_cast<CVPixelBufferRef>(frame.video_frame_buffer()->native_handle()), adapted_width, adapted_height,
crop_width, crop_height, crop_x, crop_y);
#endif
#elif WEBRTC_WIN
// XX FIX
#elif WEBRTC_LINUX

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

@ -16,16 +16,6 @@
#include "webrtc/system_wrappers/include/logging.h"
#if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
@interface NSScreen (LionAPI)
- (CGFloat)backingScaleFactor;
- (NSRect)convertRectToBacking:(NSRect)aRect;
@end
#endif // MAC_OS_X_VERSION_10_7
namespace webrtc {
namespace {

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

@ -16,11 +16,7 @@
#include <ApplicationServices/ApplicationServices.h>
#include <Cocoa/Cocoa.h>
#if defined(MAC_OS_X_VERSION_10_8) && \
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8
// 10.8 and above
#include <CoreGraphics/CoreGraphics.h>
#endif
#include <dlfcn.h>
#include <IOKit/pwr_mgt/IOPMLib.h>
#include <OpenGL/CGLMacro.h>
@ -48,8 +44,6 @@
// preprocessor block can be removed. https://crbug.com/579255
#if !defined(MAC_OS_X_VERSION_10_9) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
#if defined(MAC_OS_X_VERSION_10_8) && \
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8
CG_EXTERN const CGRect* CGDisplayStreamUpdateGetRects(
CGDisplayStreamUpdateRef updateRef,
CGDisplayStreamUpdateRectType rectType,
@ -66,14 +60,11 @@ CGDisplayStreamCreate(CGDirectDisplayID display,
CFDictionaryRef properties,
CGDisplayStreamFrameAvailableHandler handler);
#endif
#endif
namespace webrtc {
namespace {
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
// CGDisplayStreamRefs need to be destroyed asynchronously after receiving a
// kCGDisplayStreamFrameStatusStopped callback from CoreGraphics. This may
// happen after the ScreenCapturerMac has been destroyed. DisplayStreamManager
@ -140,7 +131,6 @@ class DisplayStreamManager {
int unique_id_generator_ = 0;
bool ready_for_self_destruction_ = false;
};
#endif
// Definitions used to dynamic-link to deprecated OS 10.6 functions.
const char* kApplicationServicesLibraryName =
@ -320,28 +310,6 @@ class ScreenCapturerMac : public DesktopCapturer {
void ScreenRefresh(CGRectCount count, const CGRect *rect_array);
void ReleaseBuffers();
#if !defined(MAC_OS_X_VERSION_10_8) || \
(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8)
void ScreenUpdateMove(CGScreenUpdateMoveDelta delta,
size_t count,
const CGRect *rect_array);
static void ScreenRefreshCallback(CGRectCount count,
const CGRect *rect_array,
void *user_parameter);
static void ScreenUpdateMoveCallback(CGScreenUpdateMoveDelta delta,
size_t count,
const CGRect *rect_array,
void *user_parameter);
struct ScreenCallbackData {
explicit ScreenCallbackData(ScreenCapturerMac* capturer)
: capturer(capturer) {}
rtc::CriticalSection crit_sect_;
ScreenCapturerMac* capturer;
};
ScreenCallbackData* screen_callback_data_;
#endif
std::unique_ptr<DesktopFrame> CreateFrame();
Callback* callback_ = nullptr;
@ -391,12 +359,16 @@ class ScreenCapturerMac : public DesktopCapturer {
CGWindowID excluded_window_ = 0;
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
// A self-owned object that will destroy itself after ScreenCapturerMac and
// all display streams have been destroyed..
DisplayStreamManager* display_stream_manager_;
#endif
// Used to force CaptureFrame to update it's screen configuration
// and reregister event handlers. This ensure that this
// occurs on the ScreenCapture thread. Read and written from
// both the VideoCapture thread and ScreenCapture thread.
// Protected by desktop_config_monitor_.
bool update_screen_configuration_ = false;
RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerMac);
};
@ -427,30 +399,22 @@ class InvertedDesktopFrame : public DesktopFrame {
ScreenCapturerMac::ScreenCapturerMac(
rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor)
: desktop_config_monitor_(desktop_config_monitor) {
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
display_stream_manager_ = new DisplayStreamManager;
#else
screen_callback_data_ = new ScreenCallbackData(this);
#endif
}
ScreenCapturerMac::~ScreenCapturerMac() {
ReleaseBuffers();
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
display_stream_manager_->PrepareForSelfDestruction();
#else
{
rtc::CritScope lock(&screen_callback_data_->crit_sect_);
screen_callback_data_->capturer = nullptr;
}
#endif
dlclose(app_services_library_);
dlclose(opengl_library_);
}
bool ScreenCapturerMac::Init() {
// MOZILLA: Calling RegisterRefreshAndMoveHandlers here causes us
// to register on the VideoCapture thread rather than the ScreenCapture
// thread which will result in us never receiving any notifications.
// See Bug 1468509.
/*
desktop_config_monitor_->Lock();
desktop_config_ = desktop_config_monitor_->desktop_configuration();
desktop_config_monitor_->Unlock();
@ -458,6 +422,10 @@ bool ScreenCapturerMac::Init() {
return false;
}
ScreenConfigurationChanged();
*/
desktop_config_monitor_->Lock();
update_screen_configuration_ = true;
desktop_config_monitor_->Unlock();
return true;
}
@ -478,6 +446,9 @@ void ScreenCapturerMac::Start(Callback* callback) {
assert(callback);
callback_ = callback;
desktop_config_monitor_->Lock();
update_screen_configuration_ = true;
desktop_config_monitor_->Unlock();
}
void ScreenCapturerMac::Stop() {
@ -496,13 +467,17 @@ void ScreenCapturerMac::Stop() {
void ScreenCapturerMac::CaptureFrame() {
int64_t capture_start_time_nanos = rtc::TimeNanos();
// Spin RunLoop for 1/100th of a second, handling at most one source
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, true);
queue_.MoveToNextFrame();
RTC_DCHECK(!queue_.current_frame() || !queue_.current_frame()->IsShared());
desktop_config_monitor_->Lock();
MacDesktopConfiguration new_config =
desktop_config_monitor_->desktop_configuration();
if (!desktop_config_.Equals(new_config)) {
if (update_screen_configuration_ || !desktop_config_.Equals(new_config)) {
update_screen_configuration_ = false;
desktop_config_ = new_config;
// If the display configuraiton has changed then refresh capturer data
// structures. Occasionally, the refresh and move handlers are lost when
@ -997,8 +972,6 @@ void ScreenCapturerMac::ScreenConfigurationChanged() {
}
bool ScreenCapturerMac::RegisterRefreshAndMoveHandlers() {
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
desktop_config_ = desktop_config_monitor_->desktop_configuration();
for (const auto& config : desktop_config_.displays) {
size_t pixel_width = config.pixel_bounds.width();
@ -1047,35 +1020,12 @@ bool ScreenCapturerMac::RegisterRefreshAndMoveHandlers() {
display_stream_manager_->SaveStream(unique_id, display_stream);
}
}
#else
CGError err = CGRegisterScreenRefreshCallback(
ScreenCapturerMac::ScreenRefreshCallback, screen_callback_data_);
if (err != kCGErrorSuccess) {
LOG(LS_ERROR) << "CGRegisterScreenRefreshCallback " << err;
return false;
}
err = CGScreenRegisterMoveCallback(
ScreenCapturerMac::ScreenUpdateMoveCallback, screen_callback_data_);
if (err != kCGErrorSuccess) {
LOG(LS_ERROR) << "CGScreenRegisterMoveCallback " << err;
return false;
}
#endif
return true;
}
void ScreenCapturerMac::UnregisterRefreshAndMoveHandlers() {
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
display_stream_manager_->UnregisterActiveStreams();
#else
CGUnregisterScreenRefreshCallback(
ScreenCapturerMac::ScreenRefreshCallback, this);
CGScreenUnregisterMoveCallback(
ScreenCapturerMac::ScreenUpdateMoveCallback, this);
#endif
}
void ScreenCapturerMac::ScreenRefresh(CGRectCount count,
@ -1084,8 +1034,6 @@ void ScreenCapturerMac::ScreenRefresh(CGRectCount count,
ScreenConfigurationChanged();
DesktopRegion region;
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
for (CGRectCount i = 0; i < count; ++i) {
// All rects are already in physical pixel coordinates.
DesktopRect rect = DesktopRect::MakeXYWH(
@ -1093,82 +1041,9 @@ void ScreenCapturerMac::ScreenRefresh(CGRectCount count,
rect_array[i].size.width, rect_array[i].size.height);
region.AddRect(rect);
}
#else
DesktopVector translate_vector =
DesktopVector().subtract(screen_pixel_bounds_.top_left());
for (CGRectCount i = 0; i < count; ++i) {
// Convert from Density-Independent Pixel to physical pixel coordinates.
DesktopRect rect = ScaleAndRoundCGRect(rect_array[i], dip_to_pixel_scale_);
// Translate from local desktop to capturer framebuffer coordinates.
rect.Translate(translate_vector);
region.AddRect(rect);
}
#endif
helper_.InvalidateRegion(region);
}
#if !defined(MAC_OS_X_VERSION_10_8) || \
(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8)
void ScreenCapturerMac::ScreenUpdateMove(CGScreenUpdateMoveDelta delta,
size_t count,
const CGRect* rect_array) {
// Translate |rect_array| to identify the move's destination.
CGRect refresh_rects[count];
for (CGRectCount i = 0; i < count; ++i) {
refresh_rects[i] = CGRectOffset(rect_array[i], delta.dX, delta.dY);
}
// Currently we just treat move events the same as refreshes.
ScreenRefresh(count, refresh_rects);
}
void ScreenCapturerMac::ScreenRefreshCallback(CGRectCount count,
const CGRect* rect_array,
void* user_parameter) {
ScreenCallbackData* screen_callback_data =
reinterpret_cast<ScreenCallbackData*>(user_parameter);
screen_callback_data->crit_sect_.Enter();
if (!screen_callback_data->capturer) {
CGUnregisterScreenRefreshCallback(
ScreenCapturerMac::ScreenRefreshCallback, screen_callback_data);
CGScreenUnregisterMoveCallback(
ScreenCapturerMac::ScreenUpdateMoveCallback, screen_callback_data);
screen_callback_data->crit_sect_.Leave();
delete screen_callback_data;
return;
}
if (screen_callback_data->capturer->screen_pixel_bounds_.is_empty())
screen_callback_data->capturer->ScreenConfigurationChanged();
screen_callback_data->capturer->ScreenRefresh(count, rect_array);
screen_callback_data->crit_sect_.Leave();
}
void ScreenCapturerMac::ScreenUpdateMoveCallback(
CGScreenUpdateMoveDelta delta,
size_t count,
const CGRect* rect_array,
void* user_parameter) {
ScreenCallbackData* screen_callback_data =
reinterpret_cast<ScreenCallbackData*>(user_parameter);
screen_callback_data->crit_sect_.Enter();
if (!screen_callback_data->capturer) {
CGUnregisterScreenRefreshCallback(
ScreenCapturerMac::ScreenRefreshCallback, screen_callback_data);
CGScreenUnregisterMoveCallback(
ScreenCapturerMac::ScreenUpdateMoveCallback, screen_callback_data);
screen_callback_data->crit_sect_.Leave();
delete screen_callback_data;
return;
}
screen_callback_data->capturer->ScreenUpdateMove(delta, count, rect_array);
screen_callback_data->crit_sect_.Leave();
}
#endif
std::unique_ptr<DesktopFrame> ScreenCapturerMac::CreateFrame() {
std::unique_ptr<DesktopFrame> frame(
new BasicDesktopFrame(screen_pixel_bounds_.size()));

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

@ -512,7 +512,7 @@ nsresult
nsSimpleURI::SetRef(const nsACString &aRef)
{
nsAutoCString ref;
nsresult rv = NS_EscapeURL(aRef, esc_OnlyNonASCII, ref, fallible);
nsresult rv = NS_EscapeURL(aRef, esc_OnlyNonASCII | esc_Spaces, ref, fallible);
if (NS_FAILED(rv)) {
return rv;
}

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

@ -185,7 +185,7 @@ InterceptedHttpChannel::FollowSyntheticRedirect()
// make sure non-ASCII characters in the location header are escaped.
nsAutoCString locationBuf;
if (NS_EscapeURL(location.get(), -1, esc_OnlyNonASCII, locationBuf)) {
if (NS_EscapeURL(location.get(), -1, esc_OnlyNonASCII | esc_Spaces, locationBuf)) {
location = locationBuf;
}

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

@ -992,7 +992,7 @@ nsHttpChannel::SetupTransaction()
}
// path may contain UTF-8 characters, so ensure that they're escaped.
if (NS_EscapeURL(path.get(), path.Length(), esc_OnlyNonASCII, buf)) {
if (NS_EscapeURL(path.get(), path.Length(), esc_OnlyNonASCII | esc_Spaces, buf)) {
requestURI = &buf;
} else {
requestURI = &path;
@ -5503,7 +5503,7 @@ nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType)
// make sure non-ASCII characters in the location header are escaped.
nsAutoCString locationBuf;
if (NS_EscapeURL(location.get(), -1, esc_OnlyNonASCII, locationBuf))
if (NS_EscapeURL(location.get(), -1, esc_OnlyNonASCII | esc_Spaces, locationBuf))
location = locationBuf;
mRedirectType = redirectType;

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

@ -112,7 +112,7 @@ nsHttpDigestAuth::GetMethodAndPath(nsIHttpAuthenticableChannel *authChannel,
// instead of regenerating it here.
//
nsAutoCString buf;
rv = NS_EscapeURL(path, esc_OnlyNonASCII, buf, mozilla::fallible);
rv = NS_EscapeURL(path, esc_OnlyNonASCII | esc_Spaces, buf, mozilla::fallible);
if (NS_SUCCEEDED(rv)) {
path = buf;
}

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

@ -53,12 +53,18 @@ var gTests = [
pathQueryRef: "text/html;charset=utf-8,<html></html>",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "data:text/plain,hello world",
{ spec: "data:text/plain,hello%20world",
scheme: "data",
prePath: "data:",
pathQueryRef: "text/plain,hello%20world",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "data:text/plain,hello world",
scheme: "data",
prePath: "data:",
pathQueryRef: "text/plain,hello world",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "file:///dir/afile",
scheme: "data",
prePath: "data:",
@ -194,7 +200,7 @@ var gTests = [
{ spec: "javascript:new Date()",
scheme: "javascript",
prePath: "javascript:",
pathQueryRef: "new%20Date()",
pathQueryRef: "new Date()",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "blob:123456",
@ -588,11 +594,26 @@ function check_nested_mutations()
do_check_uri_eq(uri3, uri1);
}
function check_space_escaping()
{
let uri = gIoService.newURI("data:text/plain,hello%20world#space hash");
Assert.equal(uri.spec, "data:text/plain,hello%20world#space%20hash");
uri = gIoService.newURI("data:text/plain,hello%20world#space%20hash");
Assert.equal(uri.spec, "data:text/plain,hello%20world#space%20hash");
uri = gIoService.newURI("data:text/plain,hello world#space%20hash");
Assert.equal(uri.spec, "data:text/plain,hello world#space%20hash");
uri = gIoService.newURI("data:text/plain,hello world#space hash");
Assert.equal(uri.spec, "data:text/plain,hello world#space%20hash");
uri = gIoService.newURI("http://example.com/test path#test path");
uri = gIoService.newURI("http://example.com/test%20path#test%20path");
}
// TEST MAIN FUNCTION
// ------------------
function run_test()
{
check_nested_mutations();
check_space_escaping();
// UTF-8 check - From bug 622981
// ASCII

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

@ -72,4 +72,5 @@ jobs:
bouncer-products: ['complete-mar-candidates', 'partial-mar-candidates']
shipping-product: firefox
treeherder:
symbol: Rel(BncSub-RC)
platform: firefox-release/opt

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

@ -6,12 +6,11 @@
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Log.jsm");
const logger = Log.repository.getLogger("Marionette");
const {ElementNotAccessibleError} = ChromeUtils.import("chrome://marionette/content/error.js", {});
const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {});
const {ElementNotAccessibleError} =
ChromeUtils.import("chrome://marionette/content/error.js", {});
XPCOMUtils.defineLazyGetter(this, "logger", Log.get);
XPCOMUtils.defineLazyGetter(this, "service", () => {
try {

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

@ -13,16 +13,12 @@ const {
} = ChromeUtils.import("chrome://marionette/content/prefs.js", {});
XPCOMUtils.defineLazyModuleGetters(this, {
Log: "resource://gre/modules/Log.jsm",
Log: "chrome://marionette/content/log.js",
Preferences: "resource://gre/modules/Preferences.jsm",
TCPListener: "chrome://marionette/content/server.js",
});
XPCOMUtils.defineLazyGetter(this, "log", () => {
let log = Log.repository.getLogger("Marionette");
log.addAppender(new Log.DumpAppender());
return log;
});
XPCOMUtils.defineLazyGetter(this, "log", Log.get);
XPCOMUtils.defineLazyServiceGetter(
this, "env", "@mozilla.org/process/environment;1", "nsIEnvironment");
@ -284,9 +280,6 @@ class MarionetteParentProcess {
// and that we are ready to start the Marionette server
this.finalUIStartup = false;
log.level = MarionettePrefs.logLevel;
Services.ppmm.initialProcessData["Marionette:Log"] = {level: log.level};
this.enabled = env.exists(ENV_ENABLED);
this.alteredPrefs = new Set();

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

@ -0,0 +1,4 @@
log module
==========
.. js:autoclass:: Log
:members:

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

@ -5,7 +5,6 @@
"use strict";
/* global XPCNativeWrapper */
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -47,6 +46,7 @@ const {pprint} = ChromeUtils.import("chrome://marionette/content/format.js", {})
ChromeUtils.import("chrome://marionette/content/interaction.js");
ChromeUtils.import("chrome://marionette/content/l10n.js");
ChromeUtils.import("chrome://marionette/content/legacyaction.js");
const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {});
ChromeUtils.import("chrome://marionette/content/modal.js");
const {MarionettePrefs} = ChromeUtils.import("chrome://marionette/content/prefs.js", {});
ChromeUtils.import("chrome://marionette/content/proxy.js");
@ -57,6 +57,7 @@ const {
TimedPromise,
} = ChromeUtils.import("chrome://marionette/content/sync.js", {});
XPCOMUtils.defineLazyGetter(this, "logger", Log.get);
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);
this.EXPORTED_SYMBOLS = ["GeckoDriver"];
@ -76,7 +77,6 @@ const SUPPORTED_STRATEGIES = new Set([
element.Strategy.AnonAttribute,
]);
const logger = Log.repository.getLogger("Marionette");
const globalMessageManager = Services.mm;
/**

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

@ -4,7 +4,6 @@
"use strict";
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
ChromeUtils.import("resource://gre/modules/Timer.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -18,8 +17,9 @@ const {
JavaScriptError,
ScriptTimeoutError,
} = ChromeUtils.import("chrome://marionette/content/error.js", {});
const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {});
const log = Log.repository.getLogger("Marionette");
XPCOMUtils.defineLazyGetter(this, "log", Log.get);
this.EXPORTED_SYMBOLS = ["evaluate", "sandbox", "Sandboxes"];

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

@ -4,12 +4,14 @@
"use strict";
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {});
XPCOMUtils.defineLazyGetter(this, "log", Log.get);
this.EXPORTED_SYMBOLS = ["pprint", "truncate"];
const log = Log.repository.getLogger("Marionette");
const MAX_STRING_LENGTH = 250;
/**

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

@ -24,6 +24,7 @@ marionette.jar:
content/l10n.js (l10n.js)
content/legacyaction.js (legacyaction.js)
content/listener.js (listener.js)
content/log.js (log.js)
content/message.js (message.js)
content/modal.js (modal.js)
content/navigate.js (navigate.js)

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

@ -2,8 +2,8 @@
* 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/. */
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/Preferences.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {
element,
@ -11,14 +11,15 @@ const {
} = ChromeUtils.import("chrome://marionette/content/element.js", {});
ChromeUtils.import("chrome://marionette/content/evaluate.js");
ChromeUtils.import("chrome://marionette/content/event.js");
const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {});
XPCOMUtils.defineLazyGetter(this, "logger", Log.get);
const CONTEXT_MENU_DELAY_PREF = "ui.click_hold_context_menus.delay";
const DEFAULT_CONTEXT_MENU_DELAY = 750; // ms
this.EXPORTED_SYMBOLS = ["legacyaction"];
const logger = Log.repository.getLogger("Marionette");
/** @namespace */
this.legacyaction = this.action = {};

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

@ -11,7 +11,6 @@ const winUtil = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -39,12 +38,15 @@ const {ContentEventObserverService} = ChromeUtils.import("chrome://marionette/co
const {pprint, truncate} = ChromeUtils.import("chrome://marionette/content/format.js", {});
ChromeUtils.import("chrome://marionette/content/interaction.js");
ChromeUtils.import("chrome://marionette/content/legacyaction.js");
const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {});
ChromeUtils.import("chrome://marionette/content/navigate.js");
ChromeUtils.import("chrome://marionette/content/proxy.js");
ChromeUtils.import("chrome://marionette/content/session.js");
XPCOMUtils.defineLazyGetter(this, "logger", () => Log.getWithPrefix(outerWindowID));
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);
let {outerWindowID} = winUtil;
let curContainer = {frame: content, shadowRoot: null};
// Listen for click event to indicate one click has happened, so actions
@ -78,15 +80,6 @@ let legacyactions = new legacyaction.Chain();
// last touch for each fingerId
let multiLast = {};
// TODO: Log.jsm is not e10s compatible (see https://bugzil.la/1411513),
// query the parent process for the current log level
const logger = Log.repository.getLogger("Marionette");
if (logger.ownAppenders.length == 0) {
let log = Services.cpmm.initialProcessData["Marionette:Log"];
logger.level = log.level;
logger.addAppender(new Log.DumpAppender());
}
// sandbox storage and name of the current sandbox
const sandboxes = new Sandboxes(() => curContainer.frame);
@ -445,8 +438,7 @@ const loadListener = {
* an ID, we start the listeners. Otherwise, nothing happens.
*/
function registerSelf() {
let {outerWindowID} = winUtil;
logger.debug(`Register listener.js for window ${outerWindowID}`);
logger.debug("Frame script loaded");
sandboxes.clear();
curContainer = {
@ -463,6 +455,7 @@ function registerSelf() {
}
if (reply[0].outerWindowID === outerWindowID) {
logger.debug("Frame script registered");
startListeners();
sendAsyncMessage("Marionette:ListenersAttached", {outerWindowID});
}
@ -1589,7 +1582,7 @@ function flushRendering() {
// Flush pending restyles and reflows for this window
root.getBoundingClientRect();
} catch (e) {
logger.warning(`flushWindow failed: ${e}`);
logger.error("flushWindow failed", e);
}
}
@ -1605,7 +1598,8 @@ function flushRendering() {
if (anyPendingPaintsGeneratedInDescendants &&
!windowUtils.isMozAfterPaintPending) {
logger.error("Internal error: descendant frame generated a MozAfterPaint event, but the root document doesn't have one!");
logger.error("Descendant frame generated a MozAfterPaint event, " +
"but the root document doesn't have one!");
}
logger.debug(`flushRendering ${windowUtils.isMozAfterPaintPending}`);
@ -1619,7 +1613,6 @@ async function reftestWait(url, remote) {
let windowUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let reftestWait = false;
if (document.location.href !== url || document.readyState != "complete") {

94
testing/marionette/log.js Normal file
Просмотреть файл

@ -0,0 +1,94 @@
/* 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/. */
"use strict";
ChromeUtils.import("resource://gre/modules/Services.jsm");
const StdLog = ChromeUtils.import("resource://gre/modules/Log.jsm", {}).Log;
const {MarionettePrefs} = ChromeUtils.import("chrome://marionette/content/prefs.js", {});
this.EXPORTED_SYMBOLS = ["Log"];
const isChildProcess = Services.appinfo.processType ==
Services.appinfo.PROCESS_TYPE_CONTENT;
/**
* Shorthand for accessing the Marionette logging repository.
*
* Using this class to retrieve the `Log.jsm` repository for
* Marionette will ensure the logger is set up correctly with the
* appropriate stdout dumper and with the correct log level.
*
* Unlike `Log.jsm` this logger is E10s safe, meaning repository
* configuration for appenders and logging levels are communicated
* across processes.
*
* @name Log
*/
class MarionetteLog {
/**
* Obtain the `Marionette` logger.
*
* The returned {@link Logger} instance is shared among all
* callers in the same process.
*
* @return {Logger}
*/
static get() {
let logger = StdLog.repository.getLogger("Marionette");
if (logger.ownAppenders.length == 0) {
logger.addAppender(new StdLog.DumpAppender());
}
logger.level = MarionettePrefs.logLevel;
return logger;
}
/**
* Obtain a logger that logs all messages with a prefix.
*
* Unlike {@link LoggerRepository.getLoggerWithMessagePrefix()}
* this function will ensure invoke {@link #get()} first to ensure
* the logger has been properly set up first.
*
* This returns a new object with a prototype chain that chains
* up the original {@link Logger} instance. The new prototype has
* log functions that prefix `prefix` to each message.
*
* @param {string} prefix
* String to prefix each logged message with.
*
* @return {Proxy.<Logger>}
*/
static getWithPrefix(prefix) {
this.get();
return StdLog.repository.getLoggerWithMessagePrefix("Marionette", `[${prefix}] `);
}
}
class ParentProcessLog extends MarionetteLog {
static get() {
let logger = super.get();
Services.ppmm.initialProcessData["Marionette:Log"] = {level: logger.level};
return logger;
}
}
class ChildProcessLog extends MarionetteLog {
static get() {
let logger = super.get();
// Log.jsm is not e10s compatible (see https://bugzil.la/1411513)
// so loading it in a new child process will reset the repository config
logger.level = Services.cpmm.initialProcessData["Marionette:Log"] || StdLog.Level.Info;
return logger;
}
}
if (isChildProcess) {
this.Log = ChildProcessLog;
} else {
this.Log = ParentProcessLog;
}

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

@ -126,14 +126,6 @@ class Branch {
* A further complication is that we cannot rely on `Preferences.jsm`
* in Marionette. See https://bugzilla.mozilla.org/show_bug.cgi?id=1357517
* for further details.
*
* Usage::
*
* ChromeUtils.import("resource://gre/modules/Log.jsm");
* const {MarionettePrefs} = ChromeUtils.import("chrome://marionette/content/prefs.js", {});
*
* const log = Log.repository.getLogger("Marionette");
* log.level = MarionettePrefs.log.level;
*/
class MarionetteBranch extends Branch {
constructor(branch = "marionette.") {

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

@ -4,7 +4,6 @@
"use strict";
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -13,6 +12,7 @@ const {
WebDriverError,
} = ChromeUtils.import("chrome://marionette/content/error.js", {});
ChromeUtils.import("chrome://marionette/content/evaluate.js");
const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {});
ChromeUtils.import("chrome://marionette/content/modal.js");
const {
MessageManagerDestroyedPromise,
@ -20,11 +20,10 @@ const {
this.EXPORTED_SYMBOLS = ["proxy"];
XPCOMUtils.defineLazyGetter(this, "log", Log.get);
XPCOMUtils.defineLazyServiceGetter(
this, "uuidgen", "@mozilla.org/uuid-generator;1", "nsIUUIDGenerator");
const log = Log.repository.getLogger("Marionette");
// Proxy handler that traps requests to get a property. Will prioritise
// properties that exist on the object's own prototype.
const ownPriorityGetterTrap = {

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

@ -4,21 +4,21 @@
"use strict";
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/Preferences.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("chrome://marionette/content/assert.js");
ChromeUtils.import("chrome://marionette/content/capture.js");
const {InvalidArgumentError} =
ChromeUtils.import("chrome://marionette/content/error.js", {});
const {InvalidArgumentError} = ChromeUtils.import("chrome://marionette/content/error.js", {});
const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {});
XPCOMUtils.defineLazyGetter(this, "logger", Log.get);
this.EXPORTED_SYMBOLS = ["reftest"];
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const PREF_E10S = "browser.tabs.remote.autostart";
const logger = Log.repository.getLogger("Marionette");
const SCREENSHOT_MODE = {
unexpected: 0,
fail: 1,

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

@ -11,8 +11,8 @@ const ServerSocket = CC(
"nsIServerSocket",
"initSpecialConnection");
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("chrome://marionette/content/assert.js");
const {GeckoDriver} = ChromeUtils.import("chrome://marionette/content/driver.js", {});
@ -26,10 +26,11 @@ const {
Message,
Response,
} = ChromeUtils.import("chrome://marionette/content/message.js", {});
const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {});
const {MarionettePrefs} = ChromeUtils.import("chrome://marionette/content/prefs.js", {});
const {DebuggerTransport} = ChromeUtils.import("chrome://marionette/content/transport.js", {});
const logger = Log.repository.getLogger("Marionette");
XPCOMUtils.defineLazyGetter(this, "logger", Log.get);
const {KeepWhenOffline, LoopbackOnly} = Ci.nsIServerSocket;

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

@ -4,13 +4,16 @@
"use strict";
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {
error,
TimeoutError,
} = ChromeUtils.import("chrome://marionette/content/error.js", {});
const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {});
XPCOMUtils.defineLazyGetter(this, "logger", Log.get);
this.EXPORTED_SYMBOLS = [
/* exported PollPromise, TimedPromise */
@ -21,8 +24,6 @@ this.EXPORTED_SYMBOLS = [
"MessageManagerDestroyedPromise",
];
const logger = Log.repository.getLogger("Marionette");
const {TYPE_ONE_SHOT, TYPE_REPEATING_SLACK} = Ci.nsITimer;
/**

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

@ -25,10 +25,14 @@ var ContentTaskUtils = {
* @param condition
* A condition function that must return true or false. If the
* condition ever throws, this is also treated as a false.
* @param msg
* The message to use when the returned promise is rejected.
* This message will be extended with additional information
* about the number of tries or the thrown exception.
* @param interval
* The time interval to poll the condition function. Defaults
* to 100ms.
* @param attempts
* @param maxTries
* The number of times to poll before giving up and rejecting
* if the condition has not yet returned true. Defaults to 50
* (~5 seconds for 100ms intervals)

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

@ -5,9 +5,6 @@
["data://test:test/,X"]
expected: FAIL
["data:text/plain ,X"]
expected: FAIL
["data:;x=x;charset=x,X"]
expected: FAIL
@ -29,9 +26,6 @@
["data:%00,%FF"]
expected: FAIL
["data:text/html ,X"]
expected: FAIL
["data:text / html,X"]
expected: FAIL
@ -115,9 +109,6 @@
["data://test:test/,X"]
expected: FAIL
["data:text/plain ,X"]
expected: FAIL
["data:;x=x;charset=x,X"]
expected: FAIL
@ -139,9 +130,6 @@
["data:%00,%FF"]
expected: FAIL
["data:text/html ,X"]
expected: FAIL
["data:text / html,X"]
expected: FAIL

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

@ -1,7 +1,4 @@
[url-constructor.html]
[Parsing: <a:\t foo.com> against <http://example.org/foo/bar>]
expected: FAIL
[Parsing: <foo://> against <http://example.org/foo/bar>]
expected: FAIL
@ -215,9 +212,6 @@
[Parsing: <..> against <file:///C:/>]
expected: FAIL
[Parsing: <lolscheme:x x#x x> against <about:blank>]
expected: FAIL
[Parsing: <file://example:1/> against <about:blank>]
expected: FAIL

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

@ -319,6 +319,7 @@ T_EscapeURL(const typename T::char_type* aPart, size_t aPartLen,
bool ignoreAscii = !!(aFlags & esc_OnlyNonASCII);
bool writing = !!(aFlags & esc_AlwaysCopy);
bool colon = !!(aFlags & esc_Colon);
bool spaces = !!(aFlags & esc_Spaces);
auto src = reinterpret_cast<const unsigned_char_type*>(aPart);
@ -356,12 +357,12 @@ T_EscapeURL(const typename T::char_type* aPart, size_t aPartLen,
// And, we should escape the '|' character when it occurs after any
// non-ASCII character as it may be aPart of a multi-byte character.
//
// 0x20..0x7e are the valid ASCII characters. We also escape spaces
// (0x20) since they are not legal in URLs.
// 0x20..0x7e are the valid ASCII characters.
if ((dontNeedEscape(c, aFlags) || (c == HEX_ESCAPE && !forced)
|| (c > 0x7f && ignoreNonAscii)
|| (c > 0x20 && c < 0x7f && ignoreAscii))
|| (c >= 0x20 && c < 0x7f && ignoreAscii))
&& !(c == ':' && colon)
&& !(c == ' ' && spaces)
&& !(previousIsNonASCII && c == '|' && !ignoreNonAscii)) {
if (writing) {
tempBuffer[tempBufferPos++] = c;

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

@ -93,7 +93,8 @@ enum EscapeMask {
* ascii octets (<= 0x7F) to be skipped when unescaping */
esc_AlwaysCopy = 1u << 13, /* copy input to result buf even if escaping is unnecessary */
esc_Colon = 1u << 14, /* forces escape of colon */
esc_SkipControl = 1u << 15 /* skips C0 and DEL from unescaping */
esc_SkipControl = 1u << 15, /* skips C0 and DEL from unescaping */
esc_Spaces = 1u << 16 /* forces escape of spaces */
};
/**

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

@ -133,3 +133,19 @@ TEST(Escape, nsAppendEscapedHTML)
}
}
TEST(Escape, EscapeSpaces)
{
// Tests the fallible version of NS_EscapeURL works as expected when no
// escaping is necessary.
nsCString toEscape("data:\x0D\x0A spa ces\xC4\x9F");
nsCString escaped;
nsresult rv = NS_EscapeURL(toEscape, esc_OnlyNonASCII, escaped, fallible);
EXPECT_EQ(rv, NS_OK);
// Only non-ASCII and C0
EXPECT_STREQ(escaped.BeginReading(), "data:%0D%0A spa ces%C4%9F");
escaped.Truncate();
rv = NS_EscapeURL(toEscape, esc_OnlyNonASCII | esc_Spaces, escaped, fallible);
EXPECT_EQ(rv, NS_OK);
EXPECT_STREQ(escaped.BeginReading(), "data:%0D%0A%20spa%20ces%C4%9F");
}