merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-02-16 11:51:26 +01:00
commit c0a8e566e1
164 changed files with 811 additions and 491 deletions

View File

@ -79,6 +79,10 @@ const MOUSE_ID = 'mouse';
const EDGE = 0.1;
// Multiply timeouts by this constant, x2 works great too for slower users.
const TIMEOUT_MULTIPLIER = 1;
// A single pointer down/up sequence periodically precedes the tripple swipe
// gesture on Android. This delay acounts for that.
const IS_ANDROID = Utils.MozBuildApp === 'mobile/android' &&
Utils.AndroidSdkVersion >= 14;
/**
* A point object containing distance travelled data.
@ -202,13 +206,13 @@ this.GestureTracker = { // jshint ignore:line
* @param {Number} aTimeStamp A new pointer event timeStamp.
* @param {Function} aGesture A gesture constructor (default: Tap).
*/
_init: function GestureTracker__init(aDetail, aTimeStamp, aGesture = Tap) {
_init: function GestureTracker__init(aDetail, aTimeStamp, aGesture) {
// Only create a new gesture on |pointerdown| event.
if (aDetail.type !== 'pointerdown') {
return;
}
let points = aDetail.points;
let GestureConstructor = aGesture;
let GestureConstructor = aGesture || (IS_ANDROID ? DoubleTap : Tap);
this._create(GestureConstructor);
this._update(aDetail, aTimeStamp);
},

View File

@ -121,8 +121,8 @@ function remove(path, recursive) {
/**
* Utility function to convert either an octal number or string
* into an octal number
* 0777 => 0777
* "0644" => 0644
* 0777 => 0o777
* "0644" => 0o644
*/
function Mode(mode, fallback) {
return isString(mode) ? parseInt(mode, 8) : mode || fallback;

View File

@ -89,7 +89,7 @@ HelperAppLauncherDialog.prototype = {
aLocalFile.leafName = aLocalFile.leafName.replace(/^(.*\()\d+\)/, "$1" + (collisionCount+1) + ")");
}
}
aLocalFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
aLocalFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
}
catch (e) {
dump("*** exception in makeFileUnique: " + e + "\n");
@ -100,7 +100,7 @@ HelperAppLauncherDialog.prototype = {
if (aLocalFile.leafName == "" || aLocalFile.isDirectory()) {
aLocalFile.append("unnamed");
if (aLocalFile.exists())
aLocalFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
aLocalFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
}
}
},

View File

@ -324,9 +324,7 @@
@RESPATH@/components/toolkit_formautofill.xpt
@RESPATH@/components/toolkit_osfile.xpt
@RESPATH@/components/toolkit_securityreporter.xpt
#ifdef NIGHTLY_BUILD
@RESPATH@/components/toolkit_perfmonitoring.xpt
#endif
@RESPATH@/components/toolkit_xulstore.xpt
@RESPATH@/components/toolkitprofile.xpt
#ifdef MOZ_ENABLE_XREMOTE

View File

@ -61,6 +61,8 @@ XPCOMUtils.defineLazyServiceGetter(this, "gAboutNewTabService",
XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
return Services.strings.createBundle('chrome://browser/locale/browser.properties');
});
XPCOMUtils.defineLazyModuleGetter(this, "AddonWatcher",
"resource://gre/modules/AddonWatcher.jsm");
const nsIWebNavigation = Ci.nsIWebNavigation;
@ -1348,6 +1350,9 @@ var gBrowserInit = {
SocialUI.init();
// Start monitoring slow add-ons
AddonWatcher.init();
// Telemetry for master-password - we do this after 5 seconds as it
// can cause IO if NSS/PSM has not already initialized.
setTimeout(() => {
@ -3980,7 +3985,7 @@ function updateEditUIVisibility()
function openNewUserContextTab(event)
{
openUILinkIn(BROWSER_NEW_TAB_URL, "tab", {
userContextId: event.target.getAttribute('usercontextid'),
userContextId: parseInt(event.target.getAttribute('usercontextid')),
});
}

View File

@ -983,7 +983,7 @@ nsContextMenu.prototype = {
let params = this._openLinkInParameters({
allowMixedContent: persistAllowMixedContentInChildTab,
userContextId: event.target.getAttribute('usercontextid'),
userContextId: parseInt(event.target.getAttribute('usercontextid')),
});
openLinkIn(this.linkURL, "tab", params);
},

View File

@ -2,7 +2,7 @@
* 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/. */
// Equivalent to 0600 permissions; used for saved Sync Recovery Key.
// Equivalent to 0o600 permissions; used for saved Sync Recovery Key.
// This constant can be replaced when the equivalent values are available to
// chrome JS; see Bug 433295 and Bug 757351.
const PERMISSIONS_RWUSR = 0x180;

View File

@ -1726,8 +1726,9 @@
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
if (userContextId)
if (userContextId) {
b.setAttribute("usercontextid", userContextId);
}
if (remote)
b.setAttribute("remote", "true");
@ -6272,8 +6273,13 @@
<parameter name="aUserContextId"/>
<body>
<![CDATA[
this.linkedBrowser.setAttribute("usercontextid", aUserContextId);
this.setAttribute("usercontextid", aUserContextId);
if (aUserContextId) {
this.linkedBrowser.setAttribute("usercontextid", aUserContextId);
this.setAttribute("usercontextid", aUserContextId);
} else {
this.linkedBrowser.removeAttribute("usercontextid");
this.removeAttribute("usercontextid");
}
]]>
</body>
</method>

View File

@ -200,7 +200,7 @@ function createTemporarySaveDirectory() {
saveDir.append("testsavedir");
if (!saveDir.exists()) {
info("create testsavedir!");
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
}
info("return from createTempSaveDir: " + saveDir.path);
return saveDir;

View File

@ -20,7 +20,7 @@ function createTemporarySaveDirectory() {
saveDir.append("testsavedir");
if (!saveDir.exists()) {
info("create testsavedir!");
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
}
info("return from createTempSaveDir: " + saveDir.path);
return saveDir;

View File

@ -53,7 +53,7 @@ function test() {
.get("TmpD", Ci.nsIFile);
saveDir.append("testsavedir");
if (!saveDir.exists())
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
return saveDir;
}

View File

@ -82,6 +82,6 @@ function createTemporarySaveDirectory() {
.get("TmpD", Ci.nsIFile);
saveDir.append("testsavedir");
if (!saveDir.exists())
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
return saveDir;
}

View File

@ -24,7 +24,7 @@ function createTemporarySaveDirectory() {
.get("TmpD", Ci.nsIFile);
saveDir.append("testsavedir");
if (!saveDir.exists())
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
return saveDir;
}
/**

View File

@ -543,7 +543,6 @@ BrowserGlue.prototype = {
os.addObserver(this, "autocomplete-did-enter-text", false);
if (AppConstants.NIGHTLY_BUILD) {
AddonWatcher.init();
os.addObserver(this, AddonWatcher.TOPIC_SLOW_ADDON_DETECTED, false);
}

View File

@ -30,7 +30,7 @@ function test() {
let dir2 = ds.get("TmpD", Ci.nsIFile);
let file = dir2.clone();
file.append("pbtest.file");
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
const kPrefName = "browser.open.lastDir";

View File

@ -141,7 +141,7 @@ add_task(function* test_recovery_inaccessible() {
yield File.setPermissions(Paths.recovery, { unixMode: 0 });
is((yield SessionFile.read()).source, SOURCE, "Recovered the correct source from the recovery file");
yield File.setPermissions(Paths.recovery, { unixMode: 0644 });
yield File.setPermissions(Paths.recovery, { unixMode: 0o644 });
});
add_task(function* test_clean() {

View File

@ -318,9 +318,7 @@
@RESPATH@/components/toolkit_formautofill.xpt
@RESPATH@/components/toolkit_osfile.xpt
@RESPATH@/components/toolkit_securityreporter.xpt
#ifdef NIGHTLY_BUILD
@RESPATH@/components/toolkit_perfmonitoring.xpt
#endif
@RESPATH@/components/toolkit_xulstore.xpt
@RESPATH@/components/toolkitprofile.xpt
#ifdef MOZ_ENABLE_XREMOTE

View File

@ -30,10 +30,6 @@ endif
-include $(DEPTH)/.mozconfig.mk
ifndef EXTERNALLY_MANAGED_MAKE_FILE
# Using $(firstword) may not be perfect. But it should be good enough for most
# scenarios.
_current_makefile = $(CURDIR)/$(firstword $(MAKEFILE_LIST))
# Import the automatically generated backend file. If this file doesn't exist,
# the backend hasn't been properly configured. We want this to be a fatal
# error, hence not using "-include".

View File

@ -29,6 +29,13 @@ if CONFIG['OS_ARCH'] == 'Linux':
SOURCES += ['/nsprpub/pr/src/md/unix/os_Linux_x86.s']
elif CONFIG['CPU_ARCH'] == 'ppc':
SOURCES += ['/nsprpub/pr/src/md/unix/os_Linux_ppc.s']
elif CONFIG['OS_TARGET'] in ('FreeBSD', 'OpenBSD', 'NetBSD'):
DEFINES.update(
HAVE_BSD_FLOCK=True,
HAVE_SOCKLEN_T=True,
)
DEFINES[CONFIG['OS_TARGET'].upper()] = True
SOURCES += ['/nsprpub/pr/src/md/unix/%s.c' % CONFIG['OS_TARGET'].lower()]
elif CONFIG['OS_TARGET'] == 'Darwin':
DEFINES.update(
DARWIN=True,
@ -210,7 +217,10 @@ EXPORTS.nspr += [
EXPORTS.nspr.md += [
'/nsprpub/pr/include/md/_darwin.cfg',
'/nsprpub/pr/include/md/_freebsd.cfg',
'/nsprpub/pr/include/md/_linux.cfg',
'/nsprpub/pr/include/md/_netbsd.cfg',
'/nsprpub/pr/include/md/_openbsd.cfg',
'/nsprpub/pr/include/md/_win95.cfg',
]

View File

@ -14,6 +14,12 @@
#include "md/_darwin.cfg"
#elif defined(XP_WIN) || defined(_WINDOWS)
#include "md/_win95.cfg"
#elif defined(__FreeBSD__)
#include "md/_freebsd.cfg"
#elif defined(__NetBSD__)
#include "md/_netbsd.cfg"
#elif defined(__OpenBSD__)
#include "md/_openbsd.cfg"
#elif defined(__linux__)
#include "md/_linux.cfg"
#else

View File

@ -76,6 +76,7 @@ GCONF_VERSION=1.2.1
STARTUP_NOTIFICATION_VERSION=0.8
DBUS_VERSION=0.60
SQLITE_VERSION=3.10.2
FONTCONFIG_VERSION=2.7.0
MSMANIFEST_TOOL=
@ -8078,7 +8079,7 @@ if test "$USE_FC_FREETYPE"; then
AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
fi
PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
PKG_CHECK_MODULES(_FONTCONFIG, fontconfig >= $FONTCONFIG_VERSION,
[
if test "$MOZ_PANGO"; then
MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"

View File

@ -234,7 +234,7 @@ function writeToFileSync(file, data) {
createInstance(Components.interfaces.nsIFileOutputStream);
// use 0x02 | 0x10 to open file for appending.
foStream.init(file, 0x02 | 0x08 | 0x20, 0666, 0);
foStream.init(file, 0x02 | 0x08 | 0x20, 0o666, 0);
// write, create, truncate
// In a c file operation, we have no need to set file mode with or operation,
// directly using "r" or "w" usually.

View File

@ -192,7 +192,7 @@ function cleanup()
function createTempFile(name)
{
let file = FileUtils.getFile("TmpD", [name]);
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
file.QueryInterface(Ci.nsILocalFile)
return file;
}
@ -202,7 +202,7 @@ function writeFile(file, content, callback)
let fout = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
fout.init(file.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
0644, fout.DEFER_OPEN);
0o644, fout.DEFER_OPEN);
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);

View File

@ -210,6 +210,9 @@ RootActor.prototype = {
if (this._parameters.workerList) {
this._parameters.workerList.onListChanged = null;
}
if (this._parameters.serviceWorkerRegistrationList) {
this._parameters.serviceWorkerRegistrationList.onListChanged = null;
}
if (typeof this._parameters.onShutdown === 'function') {
this._parameters.onShutdown();
}

View File

@ -96,7 +96,7 @@ function downloadURL(url, file) {
let ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
ostream.init(file, 0x04 | 0x08 | 0x20, 0600, 0);
ostream.init(file, 0x04 | 0x08 | 0x20, 0o600, 0);
ostream.write(data, data.length);
ostream.QueryInterface(Ci.nsISafeOutputStream).finish();
}

View File

@ -95,12 +95,10 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT
},
#ifdef NIGHTLY_BUILD
{
"performance", "chrome://global/content/aboutPerformance.xhtml",
nsIAboutModule::ALLOW_SCRIPT
},
#endif
{
"plugins", "chrome://global/content/plugins.html",
nsIAboutModule::URI_MUST_LOAD_IN_CHILD

View File

@ -36,6 +36,12 @@ CSSPseudoElement::~CSSPseudoElement()
}
}
ParentObject
CSSPseudoElement::GetParentObject() const
{
return mParentElement->GetParentObject();
}
JSObject*
CSSPseudoElement::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{

View File

@ -32,10 +32,7 @@ protected:
virtual ~CSSPseudoElement();
public:
ParentObject GetParentObject() const
{
return mParentElement->GetParentObject();
}
ParentObject GetParentObject() const;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;

View File

@ -159,7 +159,7 @@ PostMessageEvent::Run()
presContext = shell->GetPresContext();
event->SetTrusted(mTrustedCaller);
WidgetEvent* internalEvent = event->GetInternalNSEvent();
WidgetEvent* internalEvent = event->WidgetEventPtr();
nsEventStatus status = nsEventStatus_eIgnore;
EventDispatcher::Dispatch(window,

View File

@ -344,7 +344,7 @@ TextInputProcessor::PrepareKeyboardEventForComposition(
aKeyboardEvent =
aOptionalArgc && aDOMKeyEvent ?
aDOMKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent() : nullptr;
aDOMKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent() : nullptr;
if (!aKeyboardEvent || aOptionalArgc < 2) {
aKeyFlags = 0;
}
@ -769,7 +769,7 @@ TextInputProcessor::Keydown(nsIDOMKeyEvent* aDOMKeyEvent,
return NS_ERROR_INVALID_ARG;
}
WidgetKeyboardEvent* originalKeyEvent =
aDOMKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
aDOMKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
if (NS_WARN_IF(!originalKeyEvent)) {
return NS_ERROR_INVALID_ARG;
}
@ -875,7 +875,7 @@ TextInputProcessor::Keyup(nsIDOMKeyEvent* aDOMKeyEvent,
return NS_ERROR_INVALID_ARG;
}
WidgetKeyboardEvent* originalKeyEvent =
aDOMKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
aDOMKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
if (NS_WARN_IF(!originalKeyEvent)) {
return NS_ERROR_INVALID_ARG;
}

View File

@ -3783,7 +3783,7 @@ nsContentUtils::DispatchEvent(nsIDocument* aDoc, nsISupports* aTarget,
aCancelable, aTrusted, getter_AddRefs(event),
getter_AddRefs(target));
NS_ENSURE_SUCCESS(rv, rv);
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = aOnlyChromeDispatch;
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = aOnlyChromeDispatch;
bool dummy;
return target->DispatchEvent(event, aDefaultAction ? aDefaultAction : &dummy);
@ -4947,7 +4947,7 @@ nsContentUtils::GetAccelKeyCandidates(nsIDOMKeyEvent* aDOMKeyEvent,
return;
WidgetKeyboardEvent* nativeKeyEvent =
aDOMKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
aDOMKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
if (nativeKeyEvent) {
NS_ASSERTION(nativeKeyEvent->mClass == eKeyboardEventClass,
"wrong type of native event");

View File

@ -1773,7 +1773,7 @@ nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsIDOMNode* aTarget,
{
NS_ENSURE_STATE(aEvent);
aEvent->SetTrusted(aTrusted);
WidgetEvent* internalEvent = aEvent->GetInternalNSEvent();
WidgetEvent* internalEvent = aEvent->WidgetEventPtr();
NS_ENSURE_STATE(internalEvent);
nsCOMPtr<nsIContent> content = do_QueryInterface(aTarget);
NS_ENSURE_STATE(content);
@ -3456,7 +3456,7 @@ nsDOMWindowUtils::DispatchEventToChromeOnly(nsIDOMEventTarget* aTarget,
{
*aRetVal = false;
NS_ENSURE_STATE(aTarget && aEvent);
aEvent->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
aEvent->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
aTarget->DispatchEvent(aEvent, aRetVal);
return NS_OK;
}

View File

@ -5095,7 +5095,7 @@ nsDocument::DispatchContentLoadedEvents()
// the ancestor document if we used the normal event
// dispatching code.
WidgetEvent* innerEvent = event->GetInternalNSEvent();
WidgetEvent* innerEvent = event->WidgetEventPtr();
if (innerEvent) {
nsEventStatus status = nsEventStatus_eIgnore;
@ -8113,7 +8113,7 @@ nsIDocument::CreateEvent(const nsAString& aEventType, ErrorResult& rv) const
rv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
WidgetEvent* e = ev->GetInternalNSEvent();
WidgetEvent* e = ev->WidgetEventPtr();
e->mFlags.mBubbles = false;
e->mFlags.mCancelable = false;
return ev.forget();
@ -9200,7 +9200,7 @@ DispatchCustomEventWithFlush(nsINode* aTarget, const nsAString& aEventType,
event->InitEvent(aEventType, aBubbles, false);
event->SetTrusted(true);
if (aOnlyChromeDispatch) {
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
}
if (nsIPresShell* shell = aTarget->OwnerDoc()->GetShell()) {
shell->GetPresContext()->

View File

@ -5065,9 +5065,7 @@ nsGlobalWindow::GetScreenXY(ErrorResult& aError)
LayoutDeviceRect screenRectDev =
LayoutDevicePixel::FromAppUnits(screenRect, dc->AppUnitsPerDevPixel());
nsCOMPtr<nsIWidget> widget = GetMainWidget();
DesktopToLayoutDeviceScale scale = widget ? widget->GetDesktopToDeviceScale()
: DesktopToLayoutDeviceScale(1.0);
DesktopToLayoutDeviceScale scale = dc->GetDesktopToDeviceScale();
DesktopRect screenRectDesk = screenRectDev / scale;
CSSPoint cssPt =
@ -5703,7 +5701,7 @@ nsGlobalWindow::DispatchResizeEvent(const CSSIntSize& aSize)
}
domEvent->SetTrusted(true);
domEvent->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
domEvent->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
nsCOMPtr<EventTarget> target = do_QueryInterface(GetOuterWindow());
domEvent->SetTarget(target);
@ -8498,7 +8496,7 @@ nsGlobalWindow::LeaveModalState()
RefPtr<Event> event = NS_NewDOMEvent(inner, nullptr, nullptr);
event->InitEvent(NS_LITERAL_STRING("endmodalstate"), true, false);
event->SetTrusted(true);
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
bool dummy;
topWin->DispatchEvent(event, &dummy);
}
@ -11112,7 +11110,7 @@ nsGlobalWindow::Observe(nsISupports* aSubject, const char* aTopic,
newEvent->SetTrusted(true);
if (fireMozStorageChanged) {
WidgetEvent* internalEvent = newEvent->GetInternalNSEvent();
WidgetEvent* internalEvent = newEvent->WidgetEventPtr();
internalEvent->mFlags.mOnlyChromeDispatch = true;
}
@ -13245,7 +13243,7 @@ nsGlobalWindow::BeginWindowMove(Event& aMouseDownEvent, Element* aPanel,
}
WidgetMouseEvent* mouseEvent =
aMouseDownEvent.GetInternalNSEvent()->AsMouseEvent();
aMouseDownEvent.WidgetEventPtr()->AsMouseEvent();
if (!mouseEvent || mouseEvent->mClass != eMouseEventClass) {
aError.Throw(NS_ERROR_FAILURE);
return;

View File

@ -353,7 +353,7 @@ nsPluginCrashedEvent::Run()
PluginCrashedEvent::Constructor(doc, NS_LITERAL_STRING("PluginCrashed"), init);
event->SetTrusted(true);
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
EventDispatcher::DispatchDOMEvent(mContent, nullptr, event, nullptr, nullptr);
return NS_OK;

View File

@ -6,7 +6,7 @@ addMessageListener("file.create", function (message) {
.getService(Components.interfaces.nsIProperties)
.get("TmpD", Components.interfaces.nsIFile);
file.append("foo.txt");
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0600);
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o600);
sendAsyncMessage("file.created", new File(file));
});

View File

@ -8,7 +8,7 @@ function createFileWithData(message) {
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);
0o666, 0);
outStream.write(message, message.length);
outStream.close();

View File

@ -11,7 +11,7 @@ function createFileWithData(fileData) {
fileNum++;
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);
0o666, 0);
if (willDelete) {
fileData = "some irrelevant test data\n";
}

View File

@ -46,7 +46,7 @@ function ParseFile(file) {
var fileStr = C["@mozilla.org/network/file-input-stream;1"]
.createInstance(nsIFileInputStream);
// Init for readonly reading
fileStr.init(file, 0x01, 0400, nsIFileInputStream.CLOSE_ON_EOF);
fileStr.init(file, 0x01, 0o400, nsIFileInputStream.CLOSE_ON_EOF);
return ParseXML(fileStr);
}

View File

@ -45,7 +45,7 @@ AsyncEventDispatcher::Run()
}
if (mOnlyChromeDispatch) {
MOZ_ASSERT(event->IsTrusted());
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
}
bool dummy;
mTarget->DispatchEvent(event, &dummy);

View File

@ -629,7 +629,7 @@ Event::IsDispatchStopped()
}
NS_IMETHODIMP_(WidgetEvent*)
Event::GetInternalNSEvent()
Event::WidgetEventPtr()
{
return mEvent;
}

View File

@ -359,7 +359,7 @@ private:
NS_IMETHOD GetIsTrusted(bool* aIsTrusted) override { return _to GetIsTrusted(aIsTrusted); } \
NS_IMETHOD SetTarget(nsIDOMEventTarget* aTarget) override { return _to SetTarget(aTarget); } \
NS_IMETHOD_(bool) IsDispatchStopped(void) override { return _to IsDispatchStopped(); } \
NS_IMETHOD_(WidgetEvent*) GetInternalNSEvent(void) override { return _to GetInternalNSEvent(); } \
NS_IMETHOD_(WidgetEvent*) WidgetEventPtr(void) override { return _to WidgetEventPtr(); } \
NS_IMETHOD_(void) SetTrusted(bool aTrusted) override { _to SetTrusted(aTrusted); } \
NS_IMETHOD_(void) SetOwner(EventTarget* aOwner) override { _to SetOwner(aOwner); } \
NS_IMETHOD_(Event*) InternalDOMEvent() override { return _to InternalDOMEvent(); }

View File

@ -509,7 +509,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
}
if (aDOMEvent) {
WidgetEvent* innerEvent = aDOMEvent->GetInternalNSEvent();
WidgetEvent* innerEvent = aDOMEvent->WidgetEventPtr();
NS_ASSERTION(innerEvent == aEvent,
"The inner event of aDOMEvent is not the same as aEvent!");
}
@ -698,7 +698,7 @@ EventDispatcher::DispatchDOMEvent(nsISupports* aTarget,
nsEventStatus* aEventStatus)
{
if (aDOMEvent) {
WidgetEvent* innerEvent = aDOMEvent->GetInternalNSEvent();
WidgetEvent* innerEvent = aDOMEvent->WidgetEventPtr();
NS_ENSURE_TRUE(innerEvent, NS_ERROR_ILLEGAL_VALUE);
bool dontResetTrusted = false;

View File

@ -584,7 +584,7 @@ IMEStateManager::OnMouseButtonEventInEditor(nsPresContext* aPresContext,
}
WidgetMouseEvent* internalEvent =
aMouseEvent->AsEvent()->GetInternalNSEvent()->AsMouseEvent();
aMouseEvent->AsEvent()->WidgetEventPtr()->AsMouseEvent();
if (NS_WARN_IF(!internalEvent)) {
MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "

View File

@ -872,7 +872,7 @@ nsTextInputListener::HandleEvent(nsIDOMEvent* aEvent)
}
WidgetKeyboardEvent* keyEvent =
aEvent->GetInternalNSEvent()->AsKeyboardEvent();
aEvent->WidgetEventPtr()->AsKeyboardEvent();
if (!keyEvent) {
return NS_ERROR_UNEXPECTED;
}

View File

@ -743,7 +743,7 @@ DispatchErrorEvent(IDBRequest* aRequest,
MOZ_ASSERT(!transaction || transaction->IsOpen() || transaction->IsAborted());
if (transaction && transaction->IsOpen()) {
WidgetEvent* internalEvent = aEvent->GetInternalNSEvent();
WidgetEvent* internalEvent = aEvent->WidgetEventPtr();
MOZ_ASSERT(internalEvent);
if (internalEvent->mFlags.mExceptionHasBeenRisen) {
@ -816,7 +816,7 @@ DispatchSuccessEvent(ResultHelper* aResultHelper,
MOZ_ASSERT_IF(transaction,
transaction->IsOpen() || transaction->IsAborted());
WidgetEvent* internalEvent = aEvent->GetInternalNSEvent();
WidgetEvent* internalEvent = aEvent->WidgetEventPtr();
MOZ_ASSERT(internalEvent);
if (transaction &&

View File

@ -12,7 +12,7 @@ function testSteps()
const fileIOFlags = 0x02 | // PR_WRONLY
0x08 | // PR_CREATEFILE
0x20; // PR_TRUNCATE
const filePerms = 0664;
const filePerms = 0o664;
const fileData = "abcdefghijklmnopqrstuvwxyz";
const fileType = "text/plain";

View File

@ -7,7 +7,7 @@
interface nsIDOMEventTarget;
[ptr] native WidgetEventPtr(mozilla::WidgetEvent);
[ptr] native WidgetEvent(mozilla::WidgetEvent);
[ptr] native DOMEventPtr(mozilla::dom::Event);
[ptr] native IPCMessagePtr(IPC::Message);
[ptr] native ConstIPCMessagePtr(const IPC::Message);
@ -207,7 +207,7 @@ interface nsIDOMEvent : nsISupports
[noscript] void duplicatePrivateData();
[noscript] void setTarget(in nsIDOMEventTarget aTarget);
[notxpcom] boolean IsDispatchStopped();
[notxpcom] WidgetEventPtr GetInternalNSEvent();
[notxpcom] WidgetEvent WidgetEventPtr();
[noscript,notxpcom] void SetTrusted(in boolean aTrusted);
[notxpcom] void Serialize(in IPCMessagePtr aMsg,
in boolean aSerializeInterfaceType);

View File

@ -3101,7 +3101,7 @@ TabParent::LayerTreeUpdate(bool aActive)
event->InitEvent(NS_LITERAL_STRING("MozLayerTreeCleared"), true, false);
}
event->SetTrusted(true);
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
bool dummy;
mFrameElement->DispatchEvent(event, &dummy);
return true;
@ -3136,7 +3136,7 @@ TabParent::RecvRemotePaintIsReady()
RefPtr<Event> event = NS_NewDOMEvent(mFrameElement, nullptr, nullptr);
event->InitEvent(NS_LITERAL_STRING("MozAfterRemotePaint"), false, false);
event->SetTrusted(true);
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
bool dummy;
mFrameElement->DispatchEvent(event, &dummy);
return true;

View File

@ -12,7 +12,7 @@ outputDir.initWithFile(workingDir);
outputDir.append(outputName);
if (!outputDir.exists()) {
outputDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0777);
outputDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o777);
} else if (!outputDir.isDirectory()) {
do_throw(outputName + " is not a directory?")
}
@ -83,10 +83,10 @@ function testOutputStreams() {
var jsonFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
jsonFile.initWithFile(outputDir);
jsonFile.append("test.json");
jsonFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
jsonFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
var stream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
try {
stream.init(jsonFile, 0x04 | 0x08 | 0x20, 0600, 0); // write, create, truncate
stream.init(jsonFile, 0x04 | 0x08 | 0x20, 0o600, 0); // write, create, truncate
nativeJSON.encodeToStream(stream, charset, writeBOM, obj);
} finally {
stream.close();

View File

@ -205,7 +205,7 @@ GeckoMediaPluginService::GMPCrashCallback::Run(const nsACString& aPluginName)
RefPtr<dom::PluginCrashedEvent> event =
dom::PluginCrashedEvent::Constructor(document, NS_LITERAL_STRING("PluginCrashed"), init);
event->SetTrusted(true);
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
EventDispatcher::DispatchDOMEvent(parentWindow, nullptr, event, nullptr, nullptr);
}

View File

@ -19,6 +19,15 @@
namespace mozilla {
/*
* A container class to make it easier to pass the playback info all the
* way to DecodedStreamGraphListener from DecodedStream.
*/
struct PlaybackInfoInit {
int64_t mStartTime;
MediaInfo mInfo;
};
class DecodedStreamGraphListener : public MediaStreamListener {
typedef MediaStreamListener::MediaStreamGraphEvent MediaStreamGraphEvent;
public:
@ -107,7 +116,8 @@ UpdateStreamSuspended(MediaStream* aStream, bool aBlocking)
*/
class DecodedStreamData {
public:
DecodedStreamData(SourceMediaStream* aStream,
DecodedStreamData(OutputStreamManager* aOutputStreamManager,
PlaybackInfoInit&& aInit,
MozPromiseHolder<GenericPromise>&& aPromise);
~DecodedStreamData();
int64_t GetPosition() const;
@ -127,45 +137,56 @@ public:
// the image.
RefPtr<layers::Image> mLastVideoImage;
gfx::IntSize mLastVideoImageDisplaySize;
// This is set to true when the stream is initialized (audio and
// video tracks added).
bool mStreamInitialized;
bool mHaveSentFinish;
bool mHaveSentFinishAudio;
bool mHaveSentFinishVideo;
// The decoder is responsible for calling Destroy() on this stream.
const RefPtr<SourceMediaStream> mStream;
RefPtr<DecodedStreamGraphListener> mListener;
const RefPtr<DecodedStreamGraphListener> mListener;
bool mPlaying;
// True if we need to send a compensation video frame to ensure the
// StreamTime going forward.
bool mEOSVideoCompensation;
const RefPtr<OutputStreamManager> mOutputStreamManager;
};
DecodedStreamData::DecodedStreamData(SourceMediaStream* aStream,
DecodedStreamData::DecodedStreamData(OutputStreamManager* aOutputStreamManager,
PlaybackInfoInit&& aInit,
MozPromiseHolder<GenericPromise>&& aPromise)
: mAudioFramesWritten(0)
, mNextVideoTime(-1)
, mNextAudioTime(-1)
, mStreamInitialized(false)
, mNextVideoTime(aInit.mStartTime)
, mNextAudioTime(aInit.mStartTime)
, mHaveSentFinish(false)
, mHaveSentFinishAudio(false)
, mHaveSentFinishVideo(false)
, mStream(aStream)
, mPlaying(true)
, mEOSVideoCompensation(false)
{
, mStream(aOutputStreamManager->Graph()->CreateSourceStream(nullptr))
// DecodedStreamGraphListener will resolve this promise.
mListener = new DecodedStreamGraphListener(mStream, Move(aPromise));
mStream->AddListener(mListener);
, mListener(new DecodedStreamGraphListener(mStream, Move(aPromise)))
// mPlaying is initially true because MDSM won't start playback until playing
// becomes true. This is consistent with the settings of AudioSink.
, mPlaying(true)
, mEOSVideoCompensation(false)
, mOutputStreamManager(aOutputStreamManager)
{
mStream->AddListener(mListener);
mOutputStreamManager->Connect(mStream);
// Initialize tracks.
if (aInit.mInfo.HasAudio()) {
mStream->AddAudioTrack(aInit.mInfo.mAudio.mTrackId,
aInit.mInfo.mAudio.mRate,
0, new AudioSegment());
}
if (aInit.mInfo.HasVideo()) {
mStream->AddTrack(aInit.mInfo.mVideo.mTrackId, 0, new VideoSegment());
}
}
DecodedStreamData::~DecodedStreamData()
{
mOutputStreamManager->Disconnect();
mListener->Forget();
mStream->Destroy();
}
@ -248,27 +269,31 @@ DecodedStream::Start(int64_t aStartTime, const MediaInfo& aInfo)
class R : public nsRunnable {
typedef MozPromiseHolder<GenericPromise> Promise;
typedef void(DecodedStream::*Method)(Promise&&);
typedef decltype(&DecodedStream::CreateData) Method;
public:
R(DecodedStream* aThis, Method aMethod, Promise&& aPromise)
: mThis(aThis), mMethod(aMethod)
R(DecodedStream* aThis, Method aMethod, PlaybackInfoInit&& aInit, Promise&& aPromise)
: mThis(aThis), mMethod(aMethod), mInit(Move(aInit))
{
mPromise = Move(aPromise);
}
NS_IMETHOD Run() override
{
(mThis->*mMethod)(Move(mPromise));
(mThis->*mMethod)(Move(mInit), Move(mPromise));
return NS_OK;
}
private:
RefPtr<DecodedStream> mThis;
Method mMethod;
PlaybackInfoInit mInit;
Promise mPromise;
};
MozPromiseHolder<GenericPromise> promise;
mFinishPromise = promise.Ensure(__func__);
nsCOMPtr<nsIRunnable> r = new R(this, &DecodedStream::CreateData, Move(promise));
PlaybackInfoInit init {
aStartTime, aInfo
};
nsCOMPtr<nsIRunnable> r = new R(this, &DecodedStream::CreateData, Move(init), Move(promise));
AbstractThread::MainThread()->Dispatch(r.forget());
}
@ -311,16 +336,14 @@ DecodedStream::DestroyData(UniquePtr<DecodedStreamData> aData)
}
DecodedStreamData* data = aData.release();
RefPtr<DecodedStream> self = this;
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
self->mOutputStreamManager->Disconnect();
delete data;
});
AbstractThread::MainThread()->Dispatch(r.forget());
}
void
DecodedStream::CreateData(MozPromiseHolder<GenericPromise>&& aPromise)
DecodedStream::CreateData(PlaybackInfoInit&& aInit, MozPromiseHolder<GenericPromise>&& aPromise)
{
MOZ_ASSERT(NS_IsMainThread());
@ -332,9 +355,7 @@ DecodedStream::CreateData(MozPromiseHolder<GenericPromise>&& aPromise)
return;
}
auto source = mOutputStreamManager->Graph()->CreateSourceStream(nullptr);
auto data = new DecodedStreamData(source, Move(aPromise));
mOutputStreamManager->Connect(data->mStream);
auto data = new DecodedStreamData(mOutputStreamManager, Move(aInit), Move(aPromise));
class R : public nsRunnable {
typedef void(DecodedStream::*Method)(UniquePtr<DecodedStreamData>);
@ -354,9 +375,7 @@ DecodedStream::CreateData(MozPromiseHolder<GenericPromise>&& aPromise)
// properly on the main thread.
if (mData) {
DecodedStreamData* data = mData.release();
RefPtr<DecodedStream> self = mThis.forget();
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
self->mOutputStreamManager->Disconnect();
delete data;
});
// We are in tail dispatching phase. Don't call
@ -431,37 +450,6 @@ DecodedStream::SetPreservesPitch(bool aPreservesPitch)
mParams.mPreservesPitch = aPreservesPitch;
}
void
DecodedStream::InitTracks()
{
AssertOwnerThread();
if (mData->mStreamInitialized) {
return;
}
SourceMediaStream* sourceStream = mData->mStream;
if (mInfo.HasAudio()) {
TrackID audioTrackId = mInfo.mAudio.mTrackId;
AudioSegment* audio = new AudioSegment();
sourceStream->AddAudioTrack(audioTrackId, mInfo.mAudio.mRate, 0, audio,
SourceMediaStream::ADDTRACK_QUEUED);
mData->mNextAudioTime = mStartTime.ref();
}
if (mInfo.HasVideo()) {
TrackID videoTrackId = mInfo.mVideo.mTrackId;
VideoSegment* video = new VideoSegment();
sourceStream->AddTrack(videoTrackId, 0, video,
SourceMediaStream::ADDTRACK_QUEUED);
mData->mNextVideoTime = mStartTime.ref();
}
sourceStream->FinishAddTracks();
mData->mStreamInitialized = true;
}
static void
SendStreamAudio(DecodedStreamData* aStream, int64_t aStartTime,
MediaData* aData, AudioSegment* aOutput,
@ -694,7 +682,6 @@ DecodedStream::SendData()
return;
}
InitTracks();
SendAudio(mParams.mVolume, mSameOrigin);
SendVideo(mSameOrigin);
AdvanceTracks();

View File

@ -23,6 +23,7 @@ class DecodedStreamData;
class MediaData;
class MediaStream;
class OutputStreamManager;
struct PlaybackInfoInit;
class ProcessedMediaStream;
class TimeStamp;
@ -65,10 +66,9 @@ protected:
virtual ~DecodedStream();
private:
void CreateData(MozPromiseHolder<GenericPromise>&& aPromise);
void CreateData(PlaybackInfoInit&& aInit, MozPromiseHolder<GenericPromise>&& aPromise);
void DestroyData(UniquePtr<DecodedStreamData> aData);
void OnDataCreated(UniquePtr<DecodedStreamData> aData);
void InitTracks();
void AdvanceTracks();
void SendAudio(double aVolume, bool aIsSameOrigin);
void SendVideo(bool aIsSameOrigin);

View File

@ -47,9 +47,11 @@ ChoosePixelFormat(AVCodecContext* aCodecContext, const AVPixelFormat* aFormats)
FFMPEG_LOG("Requesting pixel format YUV444P.");
return AV_PIX_FMT_YUV444P;
case AV_PIX_FMT_YUV420P:
case AV_PIX_FMT_YUVJ420P:
FFMPEG_LOG("Requesting pixel format YUV420P.");
return AV_PIX_FMT_YUV420P;
case AV_PIX_FMT_YUVJ420P:
FFMPEG_LOG("Requesting pixel format YUVJ420P.");
return AV_PIX_FMT_YUVJ420P;
default:
break;
}

View File

@ -6,7 +6,23 @@ external-media-tests
Setup
-----
Normally, you get this source by cloning a firefox repo such as mozilla-central. The path to these tests would be in <mozilla-central>/dom/media/test/external, and these instuctions refer to this path as '$PROJECT_HOME'.
Normally, you get this source by cloning a firefox repo such as mozilla-central. The path to these tests would be in <mozilla-central>/dom/media/test/external, and these instructions refer to this path as '$PROJECT_HOME'.
Running from a build
--------------------
If you have built Firefox using ./mach build from a source tree such as mozilla-central, you can run the following command:
'''sh
$ ./mach external-media-tests
'''
You can pass any of the test options on this command line. They are listed below.
Running with an installer and a tests payload
---------------------------------------------
If you are testing a version of Firefox that you have not built, you must setup a virtualenv to run tests from. You will need a path to the installer or binary of Firefox.
* Create a virtualenv called `foo`.
@ -27,30 +43,55 @@ Now `external-media-tests` should be a recognized command. Try `external-media-t
Running the Tests
-----------------
In the examples below, `$FF_PATH` is a path to a recent Firefox binary.
In the examples below, `$FF_PATH` is a path to a recent Firefox binary. If you are running from a source build, the commands below should be invoked with:
'''sh
./mach external-media-tests
'''
If you are running with a virtualenv, you will need to run like this:
'''sh
external-media-tests --binary $FF_PATH
'''
or
'''sh
external-media-tests --installer $FF_INSTALLER_PATH
'''
or
'''sh
external-media-tests --installer-url <url to installer package>
'''
The following examples assume that you will use of these command lines instead of $EXTERNAL-MEDIA-TESTS.
This runs all the tests listed in `$PROJECT_HOME/external_media_tests/manifest.ini`:
```sh
$ external-media-tests --binary $FF_PATH
$ $EXTERNAL-MEDIA-TESTS
```
You can also run all the tests at a particular path:
```sh
$ external-media-tests --binary $FF_PATH some/path/foo
$ $EXTERNAL-MEDIA-TESTS some/path/foo
```
Or you can run the tests that are listed in a manifest file of your choice.
```sh
$ external-media-tests --binary $FF_PATH some/other/path/manifest.ini
$ $EXTERNAL-MEDIA-TESTS some/other/path/manifest.ini
```
By default, the urls listed in `external_media_tests/urls/default.ini` are used for the tests, but you can also supply your own ini file of urls:
```sh
$ external-media-tests --binary $FF_PATH --urls some/other/path/my_urls.ini
$ $EXTERNAL-MEDIA-TESTS --urls some/other/path/my_urls.ini
```
### Running EME tests
@ -58,7 +99,7 @@ By default, the urls listed in `external_media_tests/urls/default.ini` are used
In order to run EME tests, you must use a Firefox profile that has a signed plugin-container.exe and voucher.bin. With Netflix, this will be created when you log in and save the credentials. You must also use a custom .ini file for urls to the provider's content and indicate which test to run, like above. Ex:
```sh
$ external-media-tests --binary $FF_PATH some/path/tests.ini --profile custom_profile --urls some/path/provider-urls.ini
$ $EXTERNAL-MEDIA-TESTS some/path/tests.ini --profile custom_profile --urls some/path/provider-urls.ini
```
@ -66,7 +107,7 @@ In order to run EME tests, you must use a Firefox profile that has a signed plug
What if Firefox crashes during a test run? You want to know why! To report useful crash data, the test runner needs access to a "minidump_stackwalk" binary and a "symbols.zip" file.
1. Download a `minidump_stackwalk` binary for your platform (save it whereever). Get it from http://hg.mozilla.org/build/tools/file/tip/breakpad/.
1. Download a `minidump_stackwalk` binary for your platform (save it wherever). Get it from http://hg.mozilla.org/build/tools/file/tip/breakpad/.
2. Make `minidump_stackwalk` executable
```sh
@ -84,7 +125,7 @@ What if Firefox crashes during a test run? You want to know why! To report usefu
5. Run the tests with a `--symbols-path` flag
```sh
$ external-media-tests --binary $FF_PATH --symbols-path path/to/example/firefox-38.0a2.en-US.win32.crashreporter-symbols
$ $EXTERNAL-MEDIA-TESTS --symbols-path path/to/example/firefox-38.0a2.en-US.win32.crashreporter-symbols
```
To check whether the above setup is working for you, trigger a (silly) Firefox crash while the tests are running. One way to do this is with the [crashme add-on](https://github.com/luser/crashme) -- you can add it to Firefox even while the tests are running. Another way on Linux and Mac OS systems:
@ -124,17 +165,15 @@ Crash address: 0x104616900
1. Download the browsermob proxy zip file from http://bmp.lightbody.net/. The most current version as of this writing is browsermob-proxy-2.1.0-beta-2-bin.zip.
2. Unpack the .zip file.
3. Verify that you can launch browsermobproxy on your machine by running \<browsermob\>/bin/browsermob-proxy on your machine. I had to do a lot of work to install and use a java that browsermobproxy would like.
3. Verify that you can launch browsermobproxy on your machine by running \<browsermob\>/bin/browsermob-proxy (or browsermob-proxy.bat on Windows) on your machine. I had to do a lot of work to install and use a java that browsermobproxy would like.
4. Import the certificate into your Firefox profile. Select Preferences->Advanced->Certificates->View Certificates->Import... Navigate to <browsermob>/ssl-support and select cybervilliansCA.cer. Select all of the checkboxes.
5. Tell marionette where browsermobproxy is and what port to start it on. Add the following command-line parameters to your firefox-media-tests command line:
5. Tell marionette where browsermobproxy is and what port to start it on. Add the following command-line parameters to your external-media-tests command line:
<pre><code>
--browsermob-script <browsermob>/bin/browsermob-proxy --browsermob-port 999 --profile <your saved profile>
</code></pre>
On Windows, use browsermob-proxy.bat.
You can then call browsermob to shape the network. You can find an example in firefox_media_tests/playback/test_playback_limiting_bandwidth.py. Another example can be found at https://dxr.mozilla.org/mozilla-central/source/testing/marionette/client/marionette/tests/unit/test_browsermobproxy.py.
You can then call browsermob to shape the network. You can find an example in external_media_tests/playback/test_playback_limiting_bandwidth.py. Another example can be found at https://dxr.mozilla.org/mozilla-central/source/testing/marionette/client/marionette/tests/unit/test_browsermobproxy.py.
### A warning about video URLs
The ini files in `external_media_tests/urls` may contain URLs pulled from Firefox crash or bug data. Automated tests don't care about video content, but you might: visit these at your own risk and be aware that they may be NSFW. We do not intend to ever moderate or filter these URLs.

View File

@ -1665,7 +1665,7 @@ nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent)
}
#endif
WidgetEvent* theEvent = aFocusEvent->GetInternalNSEvent();
WidgetEvent* theEvent = aFocusEvent->WidgetEventPtr();
if (theEvent) {
WidgetGUIEvent focusEvent(theEvent->mFlags.mIsTrusted, theEvent->mMessage,
nullptr);
@ -1707,7 +1707,7 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
if (mInstance) {
WidgetKeyboardEvent* keyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
aKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
if (keyEvent && keyEvent->mClass == eKeyboardEventClass) {
nsEventStatus rv = ProcessEvent(*keyEvent);
if (nsEventStatus_eConsumeNoDefault == rv) {
@ -1742,7 +1742,7 @@ nsPluginInstanceOwner::ProcessMouseDown(nsIDOMEvent* aMouseEvent)
}
WidgetMouseEvent* mouseEvent =
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
aMouseEvent->WidgetEventPtr()->AsMouseEvent();
if (mouseEvent && mouseEvent->mClass == eMouseEventClass) {
mLastMouseDownButtonType = mouseEvent->button;
nsEventStatus rv = ProcessEvent(*mouseEvent);
@ -1767,7 +1767,7 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent,
return NS_OK;
WidgetMouseEvent* mouseEvent =
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
aMouseEvent->WidgetEventPtr()->AsMouseEvent();
if (mouseEvent && mouseEvent->mClass == eMouseEventClass) {
nsEventStatus rv = ProcessEvent(*mouseEvent);
if (nsEventStatus_eConsumeNoDefault == rv) {
@ -1882,7 +1882,7 @@ nsPluginInstanceOwner::DispatchCompositionToPlugin(nsIDOMEvent* aEvent)
return NS_OK;
}
WidgetCompositionEvent* compositionEvent =
aEvent->GetInternalNSEvent()->AsCompositionEvent();
aEvent->WidgetEventPtr()->AsCompositionEvent();
if (NS_WARN_IF(!compositionEvent)) {
return NS_ERROR_INVALID_ARG;
}
@ -2025,7 +2025,7 @@ nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIDOMDragEvent> dragEvent(do_QueryInterface(aEvent));
if (dragEvent && mInstance) {
WidgetEvent* ievent = aEvent->GetInternalNSEvent();
WidgetEvent* ievent = aEvent->WidgetEventPtr();
if (ievent && ievent->mFlags.mIsTrusted &&
ievent->mMessage != eDragEnter && ievent->mMessage != eDragOver) {
aEvent->PreventDefault();

View File

@ -22,7 +22,7 @@ function write_registry(version, info) {
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
.createInstance(Components.interfaces.nsIFileOutputStream);
// write, create, truncate
foStream.init(registry, 0x02 | 0x08 | 0x20, 0666, 0);
foStream.init(registry, 0x02 | 0x08 | 0x20, 0o666, 0);
var charset = "UTF-8"; // Can be any character encoding name that Mozilla supports
var os = Cc["@mozilla.org/intl/converter-output-stream;1"].

View File

@ -26,7 +26,7 @@ function write_registry(version, info) {
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
.createInstance(Components.interfaces.nsIFileOutputStream);
// write, create, truncate
foStream.init(registry, 0x02 | 0x08 | 0x20, 0666, 0);
foStream.init(registry, 0x02 | 0x08 | 0x20, 0o666, 0);
var charset = "UTF-8"; // Can be any character encoding name that Mozilla supports
var os = Cc["@mozilla.org/intl/converter-output-stream;1"].

View File

@ -26,7 +26,7 @@ function write_registry(version, info) {
let foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
.createInstance(Components.interfaces.nsIFileOutputStream);
// write, create, truncate
foStream.init(registry, 0x02 | 0x08 | 0x20, 0666, 0);
foStream.init(registry, 0x02 | 0x08 | 0x20, 0o666, 0);
let charset = "UTF-8"; // Can be any character encoding name that Mozilla supports
let os = Cc["@mozilla.org/intl/converter-output-stream;1"].

View File

@ -264,7 +264,7 @@ public:
MOZ_ASSERT(aWorkerScope);
MOZ_ASSERT(aEvent);
nsCOMPtr<nsIGlobalObject> sgo = aWorkerScope;
WidgetEvent* internalEvent = aEvent->GetInternalNSEvent();
WidgetEvent* internalEvent = aEvent->WidgetEventPtr();
ErrorResult result;
result = aWorkerScope->DispatchDOMEvent(nullptr, aEvent, nullptr, nullptr);
@ -1223,7 +1223,7 @@ private:
nsCOMPtr<nsIRunnable> runnable;
if (event->DefaultPrevented(aCx)) {
event->ReportCanceled();
} else if (event->GetInternalNSEvent()->mFlags.mExceptionHasBeenRisen) {
} else if (event->WidgetEventPtr()->mFlags.mExceptionHasBeenRisen) {
// Exception logged via the WorkerPrivate ErrorReporter
} else {
runnable = new ResumeRequest(mInterceptedChannel);

View File

@ -141,6 +141,29 @@ ServiceWorkerRegistrar::GetRegistrations(
}
}
namespace {
bool Equivalent(const ServiceWorkerRegistrationData& aLeft,
const ServiceWorkerRegistrationData& aRight)
{
MOZ_ASSERT(aLeft.principal().type() ==
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
MOZ_ASSERT(aRight.principal().type() ==
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
const auto& leftPrincipal = aLeft.principal().get_ContentPrincipalInfo();
const auto& rightPrincipal = aRight.principal().get_ContentPrincipalInfo();
// Only compare the attributes, not the spec part of the principal.
// The scope comparison above already covers the origin and codebase
// principals include the full path in their spec which is not what
// we want here.
return aLeft.scope() == aRight.scope() &&
leftPrincipal.attrs() == rightPrincipal.attrs();
}
} // anonymous namespace
void
ServiceWorkerRegistrar::RegisterServiceWorker(
const ServiceWorkerRegistrationData& aData)
@ -156,26 +179,11 @@ ServiceWorkerRegistrar::RegisterServiceWorker(
MonitorAutoLock lock(mMonitor);
MOZ_ASSERT(mDataLoaded);
const mozilla::ipc::PrincipalInfo& newPrincipalInfo = aData.principal();
MOZ_ASSERT(newPrincipalInfo.type() ==
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
const mozilla::ipc::ContentPrincipalInfo& newContentPrincipalInfo =
newPrincipalInfo.get_ContentPrincipalInfo();
bool found = false;
for (uint32_t i = 0, len = mData.Length(); i < len; ++i) {
if (mData[i].scope() == aData.scope()) {
const mozilla::ipc::PrincipalInfo& existingPrincipalInfo =
mData[i].principal();
const mozilla::ipc::ContentPrincipalInfo& existingContentPrincipalInfo =
existingPrincipalInfo.get_ContentPrincipalInfo();
if (newContentPrincipalInfo == existingContentPrincipalInfo) {
mData[i] = aData;
found = true;
break;
}
if (Equivalent(aData, mData[i])) {
found = true;
break;
}
}
@ -205,9 +213,12 @@ ServiceWorkerRegistrar::UnregisterServiceWorker(
MonitorAutoLock lock(mMonitor);
MOZ_ASSERT(mDataLoaded);
ServiceWorkerRegistrationData tmp;
tmp.principal() = aPrincipalInfo;
tmp.scope() = aScope;
for (uint32_t i = 0; i < mData.Length(); ++i) {
if (mData[i].principal() == aPrincipalInfo &&
mData[i].scope() == aScope) {
if (Equivalent(tmp, mData[i])) {
mData.RemoveElementAt(i);
deleted = true;
break;
@ -315,9 +326,11 @@ ServiceWorkerRegistrar::ReadData()
return NS_ERROR_FAILURE;
}
nsTArray<ServiceWorkerRegistrationData> tmpData;
bool overwrite = false;
while (hasMoreLines) {
ServiceWorkerRegistrationData* entry = mData.AppendElement();
ServiceWorkerRegistrationData* entry = tmpData.AppendElement();
#define GET_LINE(x) \
rv = lineInputStream->ReadLine(x, &hasMoreLines); \
@ -395,6 +408,28 @@ ServiceWorkerRegistrar::ReadData()
stream->Close();
// Dedupe data in file. Old profiles had many duplicates. In theory
// we can remove this in the future. (Bug 1248449)
for (uint32_t i = 0; i < tmpData.Length(); ++i) {
bool match = false;
for (uint32_t j = 0; j < mData.Length(); ++j) {
// Use same comparison as RegisterServiceWorker. Scope contains
// basic origin information. Combine with any principal attributes.
if (Equivalent(tmpData[i], mData[j])) {
// Last match wins, just like legacy loading used to do in
// the ServiceWorkerManager.
mData[j] = tmpData[i];
// Dupe found, so overwrite file with reduced list.
overwrite = true;
match = true;
break;
}
}
if (!match) {
mData.AppendElement(tmpData[i]);
}
}
// Overwrite previous version.
// Cannot call SaveData directly because gtest uses main-thread.
if (overwrite && NS_FAILED(WriteData())) {

View File

@ -11,7 +11,7 @@ function createFileWithData(fileData) {
fileNum++;
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);
0o666, 0);
if (willDelete) {
fileData = "some irrelevant test data\n";
}

View File

@ -157,7 +157,7 @@ TEST(ServiceWorkerRegistrar, TestReadData)
ASSERT_EQ(NS_OK, rv) << "ReadData() should not fail";
const nsTArray<ServiceWorkerRegistrationData>& data = swr->TestGetData();
ASSERT_EQ((uint32_t)2, data.Length()) << "4 entries should be found";
ASSERT_EQ((uint32_t)2, data.Length()) << "2 entries should be found";
const mozilla::ipc::PrincipalInfo& info0 = data[0].principal();
ASSERT_EQ(info0.type(), mozilla::ipc::PrincipalInfo::TContentPrincipalInfo) << "First principal must be content";
@ -312,6 +312,69 @@ TEST(ServiceWorkerRegistrar, TestVersion2Migration)
ASSERT_STREQ("activeCache 1", NS_ConvertUTF16toUTF8(data[1].cacheName()).get());
}
TEST(ServiceWorkerRegistrar, TestDedupe)
{
nsAutoCString buffer(SERVICEWORKERREGISTRAR_VERSION "\n");
// unique entries
buffer.Append("^appId=123&inBrowser=1\n");
buffer.Append("spec 0\nscope 0\ncurrentWorkerURL 0\ncacheName 0\n");
buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
buffer.Append("\n");
buffer.Append("spec 1\nscope 1\ncurrentWorkerURL 1\ncacheName 1\n");
buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
// dupe entries
buffer.Append("^appId=123&inBrowser=1\n");
buffer.Append("spec 1\nscope 0\ncurrentWorkerURL 0\ncacheName 0\n");
buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
buffer.Append("^appId=123&inBrowser=1\n");
buffer.Append("spec 2\nscope 0\ncurrentWorkerURL 0\ncacheName 0\n");
buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
buffer.Append("\n");
buffer.Append("spec 3\nscope 1\ncurrentWorkerURL 1\ncacheName 1\n");
buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
nsresult rv = swr->TestReadData();
ASSERT_EQ(NS_OK, rv) << "ReadData() should not fail";
const nsTArray<ServiceWorkerRegistrationData>& data = swr->TestGetData();
ASSERT_EQ((uint32_t)2, data.Length()) << "2 entries should be found";
const mozilla::ipc::PrincipalInfo& info0 = data[0].principal();
ASSERT_EQ(info0.type(), mozilla::ipc::PrincipalInfo::TContentPrincipalInfo) << "First principal must be content";
const mozilla::ipc::ContentPrincipalInfo& cInfo0 = data[0].principal();
nsAutoCString suffix0;
cInfo0.attrs().CreateSuffix(suffix0);
ASSERT_STREQ("^appId=123&inBrowser=1", suffix0.get());
ASSERT_STREQ("spec 2", cInfo0.spec().get());
ASSERT_STREQ("scope 0", data[0].scope().get());
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
ASSERT_STREQ("cacheName 0", NS_ConvertUTF16toUTF8(data[0].cacheName()).get());
const mozilla::ipc::PrincipalInfo& info1 = data[1].principal();
ASSERT_EQ(info1.type(), mozilla::ipc::PrincipalInfo::TContentPrincipalInfo) << "First principal must be content";
const mozilla::ipc::ContentPrincipalInfo& cInfo1 = data[1].principal();
nsAutoCString suffix1;
cInfo1.attrs().CreateSuffix(suffix1);
ASSERT_STREQ("", suffix1.get());
ASSERT_STREQ("spec 3", cInfo1.spec().get());
ASSERT_STREQ("scope 1", data[1].scope().get());
ASSERT_STREQ("currentWorkerURL 1", data[1].currentWorkerURL().get());
ASSERT_STREQ("cacheName 1", NS_ConvertUTF16toUTF8(data[1].cacheName()).get());
}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);

View File

@ -90,7 +90,7 @@ nsXBLKeyEventHandler::ExecuteMatchedHandlers(
uint32_t aCharCode,
const IgnoreModifierState& aIgnoreModifierState)
{
WidgetEvent* event = aKeyEvent->AsEvent()->GetInternalNSEvent();
WidgetEvent* event = aKeyEvent->AsEvent()->WidgetEventPtr();
nsCOMPtr<EventTarget> target = aKeyEvent->AsEvent()->InternalDOMEvent()->GetCurrentTarget();
bool executed = false;

View File

@ -905,7 +905,7 @@ nsXBLPrototypeHandler::ModifiersMatchMask(
nsIDOMUIEvent* aEvent,
const IgnoreModifierState& aIgnoreModifierState)
{
WidgetInputEvent* inputEvent = aEvent->AsEvent()->GetInternalNSEvent()->AsInputEvent();
WidgetInputEvent* inputEvent = aEvent->AsEvent()->WidgetEventPtr()->AsInputEvent();
NS_ENSURE_TRUE(inputEvent, false);
if (mKeyMask & cMetaMask) {

View File

@ -322,14 +322,14 @@ void
nsXBLWindowKeyHandler::HandleEventOnCapture(nsIDOMKeyEvent* aEvent)
{
WidgetKeyboardEvent* widgetEvent =
aEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
aEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
if (widgetEvent->mFlags.mNoCrossProcessBoundaryForwarding) {
return;
}
nsCOMPtr<mozilla::dom::Element> originalTarget =
do_QueryInterface(aEvent->AsEvent()->GetInternalNSEvent()->originalTarget);
do_QueryInterface(aEvent->AsEvent()->WidgetEventPtr()->originalTarget);
if (!EventStateManager::IsRemoteTarget(originalTarget)) {
return;
}
@ -565,7 +565,7 @@ nsXBLWindowKeyHandler::WalkHandlersAndExecute(
// retry to look for a shortcut key without the Windows-Logo key press.
if (!aIgnoreModifierState.mOS) {
WidgetKeyboardEvent* keyEvent =
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
aKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
if (keyEvent && keyEvent->IsOS()) {
IgnoreModifierState ignoreModifierState(aIgnoreModifierState);
ignoreModifierState.mOS = true;

View File

@ -4616,7 +4616,7 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
// HandleKeyPressEvent()'s switch statement.
WidgetKeyboardEvent* nativeKeyEvent =
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
aKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
"HandleKeyPressEvent gets non-keypress event");
@ -5053,7 +5053,7 @@ nsEditor::IsAcceptableInputEvent(nsIDOMEvent* aEvent)
// If the event is trusted, the event should always cause input.
NS_ENSURE_TRUE(aEvent, false);
WidgetEvent* widgetEvent = aEvent->GetInternalNSEvent();
WidgetEvent* widgetEvent = aEvent->WidgetEventPtr();
if (NS_WARN_IF(!widgetEvent)) {
return false;
}
@ -5086,7 +5086,7 @@ nsEditor::IsAcceptableInputEvent(nsIDOMEvent* aEvent)
case eCompositionCommitAsIs:
// Don't allow composition events whose internal event are not
// WidgetCompositionEvent.
widgetGUIEvent = aEvent->GetInternalNSEvent()->AsCompositionEvent();
widgetGUIEvent = aEvent->WidgetEventPtr()->AsCompositionEvent();
needsWidget = true;
break;
default:

View File

@ -357,7 +357,7 @@ nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIEditor> kungFuDeathGrip = mEditor;
WidgetEvent* internalEvent = aEvent->GetInternalNSEvent();
WidgetEvent* internalEvent = aEvent->WidgetEventPtr();
// Let's handle each event with the message of the internal event of the
// coming event. If the DOM event was created with improper interface,
@ -641,7 +641,7 @@ nsEditorEventListener::KeyPress(nsIDOMKeyEvent* aKeyEvent)
// Now, ask the native key bindings to handle the event.
WidgetKeyboardEvent* keyEvent =
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
aKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
MOZ_ASSERT(keyEvent,
"DOM key event's internal event must be WidgetKeyboardEvent");
nsIWidget* widget = keyEvent->widget;
@ -1047,7 +1047,7 @@ nsEditorEventListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
return NS_OK;
}
WidgetCompositionEvent* compositionStart =
aCompositionEvent->GetInternalNSEvent()->AsCompositionEvent();
aCompositionEvent->WidgetEventPtr()->AsCompositionEvent();
return mEditor->BeginIMEComposition(compositionStart);
}

View File

@ -617,7 +617,7 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
}
WidgetKeyboardEvent* nativeKeyEvent =
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
aKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
"HandleKeyPressEvent gets non-keypress event");
@ -5182,7 +5182,7 @@ nsHTMLEditor::IsAcceptableInputEvent(nsIDOMEvent* aEvent)
// While there is composition, all composition events in its top level window
// are always fired on the composing editor. Therefore, if this editor has
// composition, the composition events should be handled in this editor.
if (mComposition && aEvent->GetInternalNSEvent()->AsCompositionEvent()) {
if (mComposition && aEvent->WidgetEventPtr()->AsCompositionEvent()) {
return true;
}

View File

@ -184,7 +184,7 @@ nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
}
if (nsContentUtils::CheckForSubFrameDrop(dragSession,
aDropEvent->GetInternalNSEvent()->AsDragEvent())) {
aDropEvent->WidgetEventPtr()->AsDragEvent())) {
// Don't allow drags from subframe documents with different origins than
// the drop destination.
if (srcdomdoc && !IsSafeToInsertData(srcdomdoc))

View File

@ -362,7 +362,7 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
}
WidgetKeyboardEvent* nativeKeyEvent =
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
aKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
"HandleKeyPressEvent gets non-keypress event");
@ -848,7 +848,7 @@ nsPlaintextEditor::UpdateIMEComposition(nsIDOMEvent* aDOMTextEvent)
MOZ_ASSERT(aDOMTextEvent, "aDOMTextEvent must not be nullptr");
WidgetCompositionEvent* compositionChangeEvent =
aDOMTextEvent->GetInternalNSEvent()->AsCompositionEvent();
aDOMTextEvent->WidgetEventPtr()->AsCompositionEvent();
NS_ENSURE_TRUE(compositionChangeEvent, NS_ERROR_INVALID_ARG);
MOZ_ASSERT(compositionChangeEvent->mMessage == eCompositionChange,
"The internal event should be eCompositionChange");

View File

@ -63,7 +63,7 @@ nsAutoWindowStateHelper::DispatchEventToChrome(const char* aEventName)
}
event->InitEvent(NS_ConvertASCIItoUTF16(aEventName), true, true);
event->SetTrusted(true);
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
nsCOMPtr<EventTarget> target = do_QueryInterface(mWindow);
bool defaultActionEnabled;

View File

@ -30,7 +30,7 @@ add_task(function* do_test() {
// write our test data to it.
let ostream = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
ostream.init(file, -1, 0666, 0);
ostream.init(file, -1, 0o666, 0);
let conv = Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Ci.nsIConverterOutputStream);
conv.init(ostream, "UTF-8", 0, 0);

View File

@ -17,7 +17,7 @@ function run_test() {
// corrupt the file
var ostream = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
ostream.init(file, 0x02, 0666, 0);
ostream.init(file, 0x02, 0o666, 0);
var conv = Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Ci.nsIConverterOutputStream);
conv.init(ostream, "UTF-8", 0, 0);
@ -28,7 +28,7 @@ function run_test() {
// prepare an empty hostperm.1 file so that it can be used for importing
var hostperm = dir.clone();
hostperm.append("hostperm.1");
ostream.init(hostperm, 0x02 | 0x08, 0666, 0);
ostream.init(hostperm, 0x02 | 0x08, 0o666, 0);
ostream.close();
// remove all should not throw

View File

@ -130,7 +130,7 @@ function do_get_file_by_line(file, charset) {
let fis = Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(Ci.nsIFileInputStream);
fis.init(file, 0x1 /* READONLY */,
0444, Ci.nsIFileInputStream.CLOSE_ON_EOF);
0o444, Ci.nsIFileInputStream.CLOSE_ON_EOF);
let lis = Cc["@mozilla.org/intl/converter-input-stream;1"].
createInstance(Ci.nsIConverterInputStream);

View File

@ -67,6 +67,7 @@ struct DeviceAttachmentsD3D11
{}
bool CreateShaders();
bool InitBlendShaders();
bool InitSyncObject();
typedef EnumeratedArray<MaskType, MaskType::NumMaskTypes, RefPtr<ID3D11VertexShader>>
@ -971,7 +972,9 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
gfx::IntRect rect = ComputeBackdropCopyRect(aRect, aClipRect, aTransform, &backdropTransform);
RefPtr<ID3D11ShaderResourceView> srv;
if (CopyBackdrop(rect, &mixBlendBackdrop, &srv)) {
if (CopyBackdrop(rect, &mixBlendBackdrop, &srv) &&
mAttachments->InitBlendShaders())
{
vertexShader = mAttachments->mVSQuadBlendShader[maskType];
pixelShader = mAttachments->mBlendShader[MaskType::MaskNone];
@ -1491,15 +1494,26 @@ DeviceAttachmentsD3D11::InitSyncObject()
return true;
}
bool
DeviceAttachmentsD3D11::InitBlendShaders()
{
if (!mVSQuadBlendShader[MaskType::MaskNone]) {
InitVertexShader(sLayerQuadBlendVS, mVSQuadBlendShader, MaskType::MaskNone);
InitVertexShader(sLayerQuadBlendMaskVS, mVSQuadBlendShader, MaskType::Mask2d);
InitVertexShader(sLayerQuadBlendMask3DVS, mVSQuadBlendShader, MaskType::Mask3d);
}
if (!mBlendShader[MaskType::MaskNone]) {
InitPixelShader(sBlendShader, mBlendShader, MaskType::MaskNone);
}
return mInitOkay;
}
bool
DeviceAttachmentsD3D11::CreateShaders()
{
InitVertexShader(sLayerQuadVS, mVSQuadShader, MaskType::MaskNone);
InitVertexShader(sLayerQuadMaskVS, mVSQuadShader, MaskType::Mask2d);
InitVertexShader(sLayerQuadMask3DVS, mVSQuadShader, MaskType::Mask3d);
InitVertexShader(sLayerQuadBlendVS, mVSQuadBlendShader, MaskType::MaskNone);
InitVertexShader(sLayerQuadBlendMaskVS, mVSQuadBlendShader, MaskType::Mask2d);
InitVertexShader(sLayerQuadBlendMask3DVS, mVSQuadBlendShader, MaskType::Mask3d);
InitPixelShader(sSolidColorShader, mSolidColorShader, MaskType::MaskNone);
InitPixelShader(sSolidColorShaderMask, mSolidColorShader, MaskType::Mask2d);
@ -1510,7 +1524,6 @@ DeviceAttachmentsD3D11::CreateShaders()
InitPixelShader(sRGBAShaderMask3D, mRGBAShader, MaskType::Mask3d);
InitPixelShader(sYCbCrShader, mYCbCrShader, MaskType::MaskNone);
InitPixelShader(sYCbCrShaderMask, mYCbCrShader, MaskType::Mask2d);
InitPixelShader(sBlendShader, mBlendShader, MaskType::MaskNone);
if (gfxPrefs::ComponentAlphaEnabled()) {
InitPixelShader(sComponentAlphaShader, mComponentAlphaShader, MaskType::MaskNone);
InitPixelShader(sComponentAlphaShaderMask, mComponentAlphaShader, MaskType::Mask2d);

View File

@ -2968,10 +2968,11 @@ void gfxFontGroup::ComputeRanges(nsTArray<gfxTextRange>& aRanges,
lastRangeIndex++;
prevFont = font;
} else {
// if font has changed, make a new range
// if font or orientation has changed, make a new range...
// unless ch is a variation selector (bug 1248248)
gfxTextRange& prevRange = aRanges[lastRangeIndex];
if (prevRange.font != font || prevRange.matchType != matchType ||
prevRange.orientation != orient) {
(prevRange.orientation != orient && !IsClusterExtender(ch))) {
// close out the previous range
prevRange.end = origI;
aRanges.AppendElement(gfxTextRange(origI, i + 1,

View File

@ -202,9 +202,9 @@ GetFilterOffsetAndLength(UniquePtr<skia::ConvolutionFilter1D>& aFilter,
}
void
Downscaler::ClearRow(uint32_t aStartingAtCol)
Downscaler::ClearRestOfRow(uint32_t aStartingAtCol)
{
MOZ_ASSERT(int64_t(mOriginalSize.width) > int64_t(aStartingAtCol));
MOZ_ASSERT(int64_t(aStartingAtCol) <= int64_t(mOriginalSize.width));
uint32_t bytesToClear = (mOriginalSize.width - aStartingAtCol)
* sizeof(uint32_t);
memset(mRowBuffer.get() + (aStartingAtCol * sizeof(uint32_t)),

View File

@ -92,8 +92,11 @@ public:
return mRowBuffer.get() + mFrameRect.x * sizeof(uint32_t);
}
/// Clears the current row buffer (optionally starting at @aStartingAtCol).
void ClearRow(uint32_t aStartingAtCol = 0);
/// Clears the current row buffer.
void ClearRow() { ClearRestOfRow(0); }
/// Clears the current row buffer starting at @aStartingAtCol.
void ClearRestOfRow(uint32_t aStartingAtCol);
/// Signals that the decoder has finished writing a row into the row buffer.
void CommitRow();
@ -166,7 +169,8 @@ public:
bool IsFrameComplete() const { return false; }
uint8_t* RowBuffer() { return nullptr; }
void ClearRow(uint32_t = 0) { }
void ClearRow() { }
void ClearRestOfRow(uint32_t) { }
void CommitRow() { }
bool HasInvalidation() const { return false; }
DownscalerInvalidRect TakeInvalidRect() { return DownscalerInvalidRect(); }

View File

@ -994,7 +994,7 @@ nsBMPDecoder::ReadRLEDelta(const char* aData)
if (mDownscaler) {
// Clear the skipped pixels. (This clears to the end of the row,
// which is perfect if there's a Y delta and harmless if not).
mDownscaler->ClearRow(/* aStartingAtCol = */ mCurrentPos);
mDownscaler->ClearRestOfRow(/* aStartingAtCol = */ mCurrentPos);
}
// Handle the XDelta.

View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<meta http-equiv='Cache-control' content='no-cache'>
</head>
<body>
<img id='m1' src='data:image/bmp;base64,Qk1mDgAAAAAAAHYAAAAoAAAAQAEAAPAAAAABAAQAAgAAAPANAADoAwAA6AMAABAAAAAAAAAA/wD/AAAAAAAAAP8AAP8AAP8AAAD///8AzMzMAMzMzADMzMwAzMzMAMzMzADMzMwAzMzMAMzMzADMzMwAzMzMAAACAAEAAgABAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAAAAAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRCAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBpRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAIAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICAGgiAAJqAGpEAAAAAgIAaCIAAmoAakQAAAACAgBoIgACagBqRAAAAAICADgRMCIAAmoAakQAAAACAgA4ETAiAAJqAGpEAAAAAgIABhEBVQURA1UDEQFVCREEVQIRBFUCEQFVCBEBVQYRMCIAAmoAakQAAAACAgAGEQFVBBEBVQMRAVUCEQFVCREBVQURAVUFEQFVCBEBVQYRMCIAAmoAakQAAAACAgAGEQFVBBEBVQMRAVUCEQFVCREBVQURAVUFEQFVCBEBVQYRMCIAAmoAakQAAAACAgAGEQFVBBEBVQMRAVUCEQRVBhEBVQURA1UDEQNVBhEBVQYRMCIAAmoAakQAAAACAgAGEQFVBBEBVQMRAVUCEQFVAxEBVQURAVUFEQFVBREBVQgRAVUGETAiAAJqAGpEAAAAAgIABhEBVQQRAVUDEQFVAhEBVQMRAVUFEQFVBREBVQURAVUIEQFVBhEwIgACagBqRAAAAAICAAMRB1UCEQNVAxEEVQYRAVUFEQRVAhEEVQIRB1UDETAiAAJqAGpEAAAAAgIAOBEwIgACagBqRAAAAAICADgRMCIAAmoAakQAAAACAAEAAgABAAE='>
<img id='m2' height='2' width='2'>
<canvas id='c1'></canvas>
<script>
var im1=document.getElementById('m1');
var im2=document.getElementById('m2');
im2.src=im1.src;
window.onload=function(){
var ctx=document.getElementById('c1').getContext('2d');
ctx.drawImage(im1, 0, 0); // sync docoder call
ctx.drawImage(im2, 0, 0); // sync downscaler call
}
</script>
</body>
</html>

View File

@ -17,6 +17,7 @@ load 1212954-1.svg
load 1235605.gif
load 1241728-1.html
load 1241729-1.html
load 1242093-1.html
load 1242778-1.png
load colormap-range.gif
HTTP load delayedframe.sjs # A 3-frame animated GIF with an inordinate delay between the second and third frame

View File

@ -19,7 +19,7 @@ function dumpToFile(aData) {
var outputStream = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
// WR_ONLY|CREAT|TRUNC
outputStream.init(outputFile, 0x02 | 0x08 | 0x20, 0644, null);
outputStream.init(outputFile, 0x02 | 0x08 | 0x20, 0o644, null);
var bos = Cc["@mozilla.org/binaryoutputstream;1"].
createInstance(Ci.nsIBinaryOutputStream);

View File

@ -793,6 +793,7 @@ class GCRuntime
bool isIncrementalGc() const { return isIncremental; }
bool isFullGc() const { return isFull; }
bool isCompactingGc() const { return isCompacting; }
bool shouldCleanUpEverything() { return cleanUpEverything; }

View File

@ -933,6 +933,7 @@ Statistics::endGC()
int64_t markRootsTotal = SumPhase(PHASE_MARK_ROOTS, phaseTimes);
runtime->addTelemetry(JS_TELEMETRY_GC_MARK_MS, t(markTotal));
runtime->addTelemetry(JS_TELEMETRY_GC_SWEEP_MS, t(phaseTimes[PHASE_DAG_NONE][PHASE_SWEEP]));
runtime->addTelemetry(JS_TELEMETRY_GC_COMPACT_MS, t(phaseTimes[PHASE_DAG_NONE][PHASE_COMPACT]));
runtime->addTelemetry(JS_TELEMETRY_GC_MARK_ROOTS_MS, t(markRootsTotal));
runtime->addTelemetry(JS_TELEMETRY_GC_MARK_GRAY_MS, t(phaseTimes[PHASE_DAG_NONE][PHASE_SWEEP_MARK_GRAY]));
runtime->addTelemetry(JS_TELEMETRY_GC_NON_INCREMENTAL, !!nonincrementalReason_);

View File

@ -1269,7 +1269,7 @@ function copyTempDouble(ptr) {
node.contentMode = MEMFS.CONTENT_FLEXIBLE;
}
},mount:function (mount) {
return MEMFS.create_node(null, '/', 0040000 | 0777, 0);
return MEMFS.create_node(null, '/', 0o040000 | 0o777, 0);
},create_node:function (parent, name, mode, dev) {
if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
// no supported
@ -1407,7 +1407,7 @@ function copyTempDouble(ptr) {
}
return entries;
},symlink:function (parent, newname, oldpath) {
var node = MEMFS.create_node(parent, newname, 0777 | 0120000, 0);
var node = MEMFS.create_node(parent, newname, 0o777 | 0o120000, 0);
node.link = oldpath;
return node;
},readlink:function (node) {
@ -1657,19 +1657,19 @@ function copyTempDouble(ptr) {
},isMountpoint:function (node) {
return node.mounted;
},isFile:function (mode) {
return (mode & 0170000) === 0100000;
return (mode & 0o170000) === 0o100000;
},isDir:function (mode) {
return (mode & 0170000) === 0040000;
return (mode & 0o170000) === 0o040000;
},isLink:function (mode) {
return (mode & 0170000) === 0120000;
return (mode & 0o170000) === 0o120000;
},isChrdev:function (mode) {
return (mode & 0170000) === 0020000;
return (mode & 0o170000) === 0o020000;
},isBlkdev:function (mode) {
return (mode & 0170000) === 0060000;
return (mode & 0o170000) === 0o060000;
},isFIFO:function (mode) {
return (mode & 0170000) === 0010000;
return (mode & 0o170000) === 0o010000;
},isSocket:function (mode) {
return (mode & 0140000) === 0140000;
return (mode & 0o140000) === 0o140000;
},flagModes:{"r":0,"rs":8192,"r+":2,"w":1537,"wx":3585,"xw":3585,"w+":1538,"wx+":3586,"xw+":3586,"a":521,"ax":2569,"xa":2569,"a+":522,"ax+":2570,"xa+":2570},modeStringToFlags:function (str) {
var flags = FS.flagModes[str];
if (typeof flags === 'undefined') {
@ -1836,21 +1836,21 @@ function copyTempDouble(ptr) {
}
return parent.node_ops.mknod(parent, name, mode, dev);
},create:function (path, mode) {
mode = mode !== undefined ? mode : 0666;
mode = mode !== undefined ? mode : 0o666;
mode &= 4095;
mode |= 0100000;
mode |= 0o100000;
return FS.mknod(path, mode, 0);
},mkdir:function (path, mode) {
mode = mode !== undefined ? mode : 0777;
mode &= 511 | 0001000;
mode |= 0040000;
mode = mode !== undefined ? mode : 0o777;
mode &= 511 | 0o001000;
mode |= 0o040000;
return FS.mknod(path, mode, 0);
},mkdev:function (path, mode, dev) {
if (typeof(dev) === 'undefined') {
dev = mode;
mode = 0666;
mode = 0o666;
}
mode |= 0020000;
mode |= 0o020000;
return FS.mknod(path, mode, dev);
},symlink:function (oldpath, newpath) {
var lookup = FS.lookupPath(newpath, { parent: true });
@ -2096,16 +2096,16 @@ function copyTempDouble(ptr) {
},open:function (path, flags, mode, fd_start, fd_end) {
path = PATH.normalize(path);
flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags;
mode = typeof mode === 'undefined' ? 0666 : mode;
mode = typeof mode === 'undefined' ? 0o666 : mode;
if ((flags & 512)) {
mode = (mode & 4095) | 0100000;
mode = (mode & 4095) | 0o100000;
} else {
mode = 0;
}
var node;
try {
var lookup = FS.lookupPath(path, {
follow: !(flags & 0200000)
follow: !(flags & 0o200000)
});
node = lookup.node;
path = lookup.path;
@ -2345,7 +2345,7 @@ function copyTempDouble(ptr) {
assert(stderr.fd === 3, 'invalid handle for stderr (' + stderr.fd + ')');
},staticInit:function () {
FS.nameTable = new Array(4096);
FS.root = FS.createNode(null, '/', 0040000 | 0777, 0);
FS.root = FS.createNode(null, '/', 0o040000 | 0o777, 0);
FS.mount(MEMFS, {}, '/');
FS.createDefaultDirectories();
FS.createDefaultDevices();
@ -2767,7 +2767,7 @@ function copyTempDouble(ptr) {
openRequest.onerror = onerror;
}};
var SOCKFS={mount:function (mount) {
return FS.createNode(null, '/', 0040000 | 0777, 0);
return FS.createNode(null, '/', 0o040000 | 0o777, 0);
},nextname:function () {
if (!SOCKFS.nextname.current) {
SOCKFS.nextname.current = 0;
@ -2791,7 +2791,7 @@ function copyTempDouble(ptr) {
};
// create the filesystem node to store the socket structure
var name = SOCKFS.nextname();
var node = FS.createNode(SOCKFS.root, name, 0140000, 0);
var node = FS.createNode(SOCKFS.root, name, 0o140000, 0);
node.sock = sock;
// and the wrapping stream that enables library functions such
// as read and write to indirectly interact with the socket

View File

@ -916,53 +916,54 @@ JS_TransplantObject(JSContext* cx, HandleObject origobj, HandleObject target)
RootedValue origv(cx, ObjectValue(*origobj));
RootedObject newIdentity(cx);
{
AutoDisableProxyCheck adpc(cx->runtime());
// Don't allow a compacting GC to observe any intermediate state.
AutoDisableCompactingGC nocgc(cx->runtime());
JSCompartment* destination = target->compartment();
AutoDisableProxyCheck adpc(cx->runtime());
if (origobj->compartment() == destination) {
// If the original object is in the same compartment as the
// destination, then we know that we won't find a wrapper in the
// destination's cross compartment map and that the same
// object will continue to work.
if (!JSObject::swap(cx, origobj, target))
MOZ_CRASH();
newIdentity = origobj;
} else if (WrapperMap::Ptr p = destination->lookupWrapper(origv)) {
// There might already be a wrapper for the original object in
// the new compartment. If there is, we use its identity and swap
// in the contents of |target|.
newIdentity = &p->value().get().toObject();
JSCompartment* destination = target->compartment();
// When we remove origv from the wrapper map, its wrapper, newIdentity,
// must immediately cease to be a cross-compartment wrapper. Nuke it.
destination->removeWrapper(p);
NukeCrossCompartmentWrapper(cx, newIdentity);
if (!JSObject::swap(cx, newIdentity, target))
MOZ_CRASH();
} else {
// Otherwise, we use |target| for the new identity object.
newIdentity = target;
}
// Now, iterate through other scopes looking for references to the
// old object, and update the relevant cross-compartment wrappers.
if (!RemapAllWrappersForObject(cx, origobj, newIdentity))
if (origobj->compartment() == destination) {
// If the original object is in the same compartment as the
// destination, then we know that we won't find a wrapper in the
// destination's cross compartment map and that the same
// object will continue to work.
if (!JSObject::swap(cx, origobj, target))
MOZ_CRASH();
newIdentity = origobj;
} else if (WrapperMap::Ptr p = destination->lookupWrapper(origv)) {
// There might already be a wrapper for the original object in
// the new compartment. If there is, we use its identity and swap
// in the contents of |target|.
newIdentity = &p->value().get().toObject();
// Lastly, update the original object to point to the new one.
if (origobj->compartment() != destination) {
RootedObject newIdentityWrapper(cx, newIdentity);
AutoCompartment ac(cx, origobj);
if (!JS_WrapObject(cx, &newIdentityWrapper))
MOZ_CRASH();
MOZ_ASSERT(Wrapper::wrappedObject(newIdentityWrapper) == newIdentity);
if (!JSObject::swap(cx, origobj, newIdentityWrapper))
MOZ_CRASH();
origobj->compartment()->putWrapper(cx, CrossCompartmentKey(newIdentity), origv);
}
// When we remove origv from the wrapper map, its wrapper, newIdentity,
// must immediately cease to be a cross-compartment wrapper. Nuke it.
destination->removeWrapper(p);
NukeCrossCompartmentWrapper(cx, newIdentity);
if (!JSObject::swap(cx, newIdentity, target))
MOZ_CRASH();
} else {
// Otherwise, we use |target| for the new identity object.
newIdentity = target;
}
// Now, iterate through other scopes looking for references to the
// old object, and update the relevant cross-compartment wrappers.
if (!RemapAllWrappersForObject(cx, origobj, newIdentity))
MOZ_CRASH();
// Lastly, update the original object to point to the new one.
if (origobj->compartment() != destination) {
RootedObject newIdentityWrapper(cx, newIdentity);
AutoCompartment ac(cx, origobj);
if (!JS_WrapObject(cx, &newIdentityWrapper))
MOZ_CRASH();
MOZ_ASSERT(Wrapper::wrappedObject(newIdentityWrapper) == newIdentity);
if (!JSObject::swap(cx, origobj, newIdentityWrapper))
MOZ_CRASH();
origobj->compartment()->putWrapper(cx, CrossCompartmentKey(newIdentity), origv);
}
// The new identity object might be one of several things. Return it to avoid

View File

@ -115,6 +115,7 @@ enum {
JS_TELEMETRY_GC_MAX_PAUSE_MS,
JS_TELEMETRY_GC_MARK_MS,
JS_TELEMETRY_GC_SWEEP_MS,
JS_TELEMETRY_GC_COMPACT_MS,
JS_TELEMETRY_GC_MARK_ROOTS_MS,
JS_TELEMETRY_GC_MARK_GRAY_MS,
JS_TELEMETRY_GC_SLICE_MS,

View File

@ -2005,6 +2005,8 @@ AutoDisableCompactingGC::AutoDisableCompactingGC(JSRuntime* rt)
: gc(rt->gc)
{
gc.disableCompactingGC();
if (gc.isIncrementalGCInProgress() && gc.isCompactingGc())
AutoFinishGC finishGC(rt);
}
AutoDisableCompactingGC::~AutoDisableCompactingGC()

View File

@ -300,7 +300,7 @@ IsCrossCompartmentWrapper(JSObject* obj);
void
NukeCrossCompartmentWrapper(JSContext* cx, JSObject* wrapper);
bool
void
RemapWrapper(JSContext* cx, JSObject* wobj, JSObject* newTarget);
JS_FRIEND_API(bool)

View File

@ -494,7 +494,9 @@ js::NukeCrossCompartmentWrappers(JSContext* cx,
// Given a cross-compartment wrapper |wobj|, update it to point to
// |newTarget|. This recomputes the wrapper with JS_WrapValue, and thus can be
// useful even if wrapper already points to newTarget.
bool
// This operation crashes on failure rather than leaving the heap in an
// inconsistent state.
void
js::RemapWrapper(JSContext* cx, JSObject* wobjArg, JSObject* newTargetArg)
{
RootedObject wobj(cx, wobjArg);
@ -551,8 +553,8 @@ js::RemapWrapper(JSContext* cx, JSObject* wobjArg, JSObject* newTargetArg)
// Update the entry in the compartment's wrapper map to point to the old
// wrapper, which has now been updated (via reuse or swap).
MOZ_ASSERT(wobj->is<WrapperObject>());
wcompartment->putWrapper(cx, CrossCompartmentKey(newTarget), ObjectValue(*wobj));
return true;
if (!wcompartment->putWrapper(cx, CrossCompartmentKey(newTarget), ObjectValue(*wobj)))
MOZ_CRASH();
}
// Remap all cross-compartment wrappers pointing to |oldTarget| to point to
@ -575,10 +577,8 @@ js::RemapAllWrappersForObject(JSContext* cx, JSObject* oldTargetArg,
}
}
for (const Value& v : toTransplant) {
if (!RemapWrapper(cx, &v.toObject(), newTarget))
MOZ_CRASH();
}
for (const Value& v : toTransplant)
RemapWrapper(cx, &v.toObject(), newTarget);
return true;
}
@ -615,8 +615,7 @@ js::RecomputeWrappers(JSContext* cx, const CompartmentFilter& sourceFilter,
for (const Value& v : toRecompute) {
JSObject* wrapper = &v.toObject();
JSObject* wrapped = Wrapper::wrappedObject(wrapper);
if (!RemapWrapper(cx, wrapper, wrapped))
MOZ_CRASH();
RemapWrapper(cx, wrapper, wrapped);
}
return true;

View File

@ -389,9 +389,9 @@ js::RunScript(JSContext* cx, RunState& state)
{
JS_CHECK_RECURSION(cx, return false);
#if defined(NIGHTLY_BUILD) && defined(MOZ_HAVE_RDTSC)
#if defined(MOZ_HAVE_RDTSC)
js::AutoStopwatch stopwatch(cx);
#endif // defined(NIGHTLY_BUILD) && defined(MOZ_HAVE_RDTSC)
#endif // defined(MOZ_HAVE_RDTSC)
SPSEntryMarker marker(cx->runtime(), state.script());

View File

@ -158,6 +158,10 @@ struct SavedFrame::Lookup {
MOZ_ASSERT(source);
MOZ_ASSERT_IF(framePtr.isSome(), pc);
MOZ_ASSERT_IF(framePtr.isSome(), activation);
#ifdef JS_MORE_DETERMINISTIC
column = 0;
#endif
}
explicit Lookup(SavedFrame& savedFrame)
@ -424,6 +428,9 @@ SavedFrame::initLine(uint32_t line)
void
SavedFrame::initColumn(uint32_t column)
{
#ifdef JS_MORE_DETERMINISTIC
column = 0;
#endif
initReservedSlot(JSSLOT_COLUMN, PrivateUint32Value(column));
}

View File

@ -3148,6 +3148,9 @@ AccumulateTelemetryCallback(int id, uint32_t sample, const char* key)
case JS_TELEMETRY_GC_SWEEP_MS:
Telemetry::Accumulate(Telemetry::GC_SWEEP_MS, sample);
break;
case JS_TELEMETRY_GC_COMPACT_MS:
Telemetry::Accumulate(Telemetry::GC_COMPACT_MS, sample);
break;
case JS_TELEMETRY_GC_MARK_ROOTS_MS:
Telemetry::Accumulate(Telemetry::GC_MARK_ROOTS_MS, sample);
break;

View File

@ -1209,7 +1209,7 @@ AccessibleCaretManager::DispatchCaretStateChangedEvent(CaretChangedReason aReaso
CaretStateChangedEvent::Constructor(doc, NS_LITERAL_STRING("mozcaretstatechanged"), init);
event->SetTrusted(true);
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
AC_LOG("%s: reason %d, collapsed %d, caretVisible %d", __FUNCTION__,
init.mReason, init.mCollapsed, init.mCaretVisible);

View File

@ -3519,7 +3519,7 @@ ContainerState::NewPaintedLayerData(nsDisplayItem* aItem,
data.mAnimatedGeometryRootOffset = aTopLeft;
data.mReferenceFrame = aItem->ReferenceFrame();
data.mSingleItemFixedToViewport = aShouldFixToViewport;
data.mBackfaceHidden = aItem->Frame()->BackfaceIsHidden();
data.mBackfaceHidden = aItem->Frame()->In3DContextAndBackfaceIsHidden();
data.mIsCaret = aItem->GetType() == nsDisplayItem::TYPE_CARET;
data.mNewChildLayersIndex = mNewChildLayers.Length();
@ -4138,7 +4138,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
PaintedLayerData* paintedLayerData =
mPaintedLayerDataTree.FindPaintedLayerFor(animatedGeometryRoot, agrScrollClip,
itemVisibleRect, false,
item->Frame()->BackfaceIsHidden(),
item->Frame()->In3DContextAndBackfaceIsHidden(),
avoidCreatingLayer,
[&]() {
layerCount++;

View File

@ -1141,7 +1141,7 @@ nsDocumentViewer::PermitUnloadInternal(bool *aShouldPrompt,
// the event being dispatched.
if (!sIsBeforeUnloadDisabled && *aShouldPrompt && dialogsAreEnabled && mDocument &&
(!sBeforeUnloadRequiresInteraction || mDocument->UserHasInteracted()) &&
(event->GetInternalNSEvent()->mFlags.mDefaultPrevented ||
(event->WidgetEventPtr()->mFlags.mDefaultPrevented ||
!text.IsEmpty())) {
// Ask the user if it's ok to unload the current page

View File

@ -2054,7 +2054,7 @@ nsLayoutUtils::GetDOMEventCoordinatesRelativeTo(nsIDOMEvent* aDOMEvent, nsIFrame
{
if (!aDOMEvent)
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
WidgetEvent* event = aDOMEvent->GetInternalNSEvent();
WidgetEvent* event = aDOMEvent->WidgetEventPtr();
if (!event)
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
return GetEventCoordinatesRelativeTo(event, aFrame);

View File

@ -1643,7 +1643,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
// So we cheat here by either setting or unsetting the clcikCount in the native event
// so the right thing happens for the onclick event
WidgetMouseEvent* mouseEvent =
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
aMouseEvent->WidgetEventPtr()->AsMouseEvent();
int32_t selectedIndex;
if (NS_SUCCEEDED(GetIndexFromDOMEvent(aMouseEvent, selectedIndex))) {
@ -2097,7 +2097,7 @@ nsListControlFrame::KeyDown(nsIDOMEvent* aKeyEvent)
// XXXmats in onkeydown. That seems sub-optimal though.
const WidgetKeyboardEvent* keyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
aKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
MOZ_ASSERT(keyEvent,
"DOM event must have WidgetKeyboardEvent for its internal event");
@ -2250,7 +2250,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
AutoIncrementalSearchResetter incrementalSearchResetter;
const WidgetKeyboardEvent* keyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
aKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
MOZ_ASSERT(keyEvent,
"DOM event must have WidgetKeyboardEvent for its internal event");

View File

@ -1164,6 +1164,12 @@ nsIFrame::Combines3DTransformWithAncestors() const
return StyleDisplay()->HasTransform(this) || StyleDisplay()->BackfaceIsHidden();
}
bool
nsIFrame::In3DContextAndBackfaceIsHidden() const
{
return Combines3DTransformWithAncestors() && StyleDisplay()->BackfaceIsHidden();
}
bool
nsIFrame::HasPerspective() const
{
@ -2106,8 +2112,6 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
nsDisplayListBuilder::AutoSaveRestorePerspectiveIndex perspectiveIndex(aBuilder, this);
if (isTransformed || useBlendMode || usingSVGEffects || useFixedPosition || useStickyPosition) {
// We don't need to pass ancestor clipping down to our children;
// everything goes inside a display item's child list, and the display
@ -2126,6 +2130,9 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
DisplayListClipState::AutoSaveRestore nestedClipState(aBuilder);
nsDisplayListBuilder::AutoInTransformSetter
inTransformSetter(aBuilder, inTransform);
nsDisplayListBuilder::AutoSaveRestorePerspectiveIndex
perspectiveIndex(aBuilder, this);
CheckForApzAwareEventHandlers(aBuilder, this);
nsRect clipPropClip;

Some files were not shown because too many files have changed in this diff Show More