From 8d4abb78c5178a232a9910282fd0602237402aa3 Mon Sep 17 00:00:00 2001 From: Andrew Swan Date: Wed, 6 Jul 2016 16:49:36 -0700 Subject: [PATCH 001/150] Bug 1285059 Do not use signal.pause r=kmag MozReview-Commit-ID: JKTbFMktx8Y --HG-- extra : rebase_source : badde67b6c7a685e31bbedba82b193d3c01554a5 --- .../mochitest/test_chrome_ext_native_messaging.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html b/toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html index dd3431bd9740..7ed450f45bcd 100644 --- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html +++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html @@ -110,13 +110,22 @@ const WONTDIE_BODY = String.raw` import signal import struct import sys +import time signal.signal(signal.SIGTERM, signal.SIG_IGN) +def spin(): + while True: + try: + signal.pause() + except AttributeError: + time.sleep(5) + while True: rawlen = sys.stdin.read(4) if len(rawlen) == 0: - signal.pause() + spin() + msglen = struct.unpack('@I', rawlen)[0] msg = sys.stdin.read(msglen) From aee6e800d60bcd56e5b23aa6eac1e7017cbbb6c6 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 14 Jul 2016 20:47:02 +1000 Subject: [PATCH 002/150] Bug 1286796: [MSE] P1. Replace InvalidAccessError usage with TypeError. r=gerald See https://github.com/w3c/media-source/issues/34 MozReview-Commit-ID: 6RDjhxnaOGM --HG-- extra : rebase_source : f7686b58bfde94865cccb123578675d11ce9a37e --- dom/media/mediasource/MediaSource.cpp | 6 +++--- dom/media/mediasource/SourceBuffer.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dom/media/mediasource/MediaSource.cpp b/dom/media/mediasource/MediaSource.cpp index e0e3d4114ec6..b0780d6027bc 100644 --- a/dom/media/mediasource/MediaSource.cpp +++ b/dom/media/mediasource/MediaSource.cpp @@ -89,7 +89,7 @@ static nsresult IsTypeSupported(const nsAString& aType, DecoderDoctorDiagnostics* aDiagnostics) { if (aType.IsEmpty()) { - return NS_ERROR_DOM_INVALID_ACCESS_ERR; + return NS_ERROR_DOM_TYPE_ERR; } nsContentTypeParser parser(aType); nsAutoString mimeType; @@ -201,7 +201,7 @@ MediaSource::SetDuration(double aDuration, ErrorResult& aRv) MOZ_ASSERT(NS_IsMainThread()); MSE_API("SetDuration(aDuration=%f, ErrorResult)", aDuration); if (aDuration < 0 || IsNaN(aDuration)) { - aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR); + aRv.Throw(NS_ERROR_DOM_TYPE_ERR); return; } if (mReadyState != MediaSourceReadyState::Open || @@ -340,7 +340,7 @@ MediaSource::EndOfStream(const Optional& aError, Er mDecoder->DecodeError(); break; default: - aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR); + aRv.Throw(NS_ERROR_DOM_TYPE_ERR); } } diff --git a/dom/media/mediasource/SourceBuffer.cpp b/dom/media/mediasource/SourceBuffer.cpp index 23eed5f6b293..771435c34b27 100644 --- a/dom/media/mediasource/SourceBuffer.cpp +++ b/dom/media/mediasource/SourceBuffer.cpp @@ -51,7 +51,7 @@ SourceBuffer::SetMode(SourceBufferAppendMode aMode, ErrorResult& aRv) } if (mCurrentAttributes.mGenerateTimestamps && aMode == SourceBufferAppendMode::Segments) { - aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR); + aRv.Throw(NS_ERROR_DOM_TYPE_ERR); return; } MOZ_ASSERT(mMediaSource->ReadyState() != MediaSourceReadyState::Closed); @@ -138,7 +138,7 @@ SourceBuffer::SetAppendWindowStart(double aAppendWindowStart, ErrorResult& aRv) } if (aAppendWindowStart < 0 || aAppendWindowStart >= mCurrentAttributes.GetAppendWindowEnd()) { - aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR); + aRv.Throw(NS_ERROR_DOM_TYPE_ERR); return; } mCurrentAttributes.SetAppendWindowStart(aAppendWindowStart); @@ -155,7 +155,7 @@ SourceBuffer::SetAppendWindowEnd(double aAppendWindowEnd, ErrorResult& aRv) } if (IsNaN(aAppendWindowEnd) || aAppendWindowEnd <= mCurrentAttributes.GetAppendWindowStart()) { - aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR); + aRv.Throw(NS_ERROR_DOM_TYPE_ERR); return; } mCurrentAttributes.SetAppendWindowEnd(aAppendWindowEnd); @@ -232,7 +232,7 @@ SourceBuffer::Remove(double aStart, double aEnd, ErrorResult& aRv) if (IsNaN(mMediaSource->Duration()) || aStart < 0 || aStart > mMediaSource->Duration() || aEnd <= aStart || IsNaN(aEnd)) { - aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR); + aRv.Throw(NS_ERROR_DOM_TYPE_ERR); return; } if (mMediaSource->ReadyState() == MediaSourceReadyState::Ended) { From b9093041524e12c90057f89f8638cc044406e75e Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 14 Jul 2016 21:08:46 +1000 Subject: [PATCH 003/150] Bug 1286796: [MSE] P2. Update InvalidAccessError with TypeError. r=jgraham As per https://github.com/w3c/media-source/issues/34 MozReview-Commit-ID: 5MEEKhINo1m --HG-- extra : rebase_source : f8eb039a67467a3551c5610757344d52d4ceaaa7 --- .../mediasource-addsourcebuffer.html | 2 +- .../media-source/mediasource-appendwindow.html | 16 ++++++++-------- .../mediasource-duration-boundaryconditions.html | 10 +++++----- .../tests/media-source/mediasource-remove.html | 10 +++++----- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/testing/web-platform/tests/media-source/mediasource-addsourcebuffer.html b/testing/web-platform/tests/media-source/mediasource-addsourcebuffer.html index 61f67f4b27ee..47a2b353f6aa 100644 --- a/testing/web-platform/tests/media-source/mediasource-addsourcebuffer.html +++ b/testing/web-platform/tests/media-source/mediasource-addsourcebuffer.html @@ -20,7 +20,7 @@ mediasource_test(function(test, mediaElement, mediaSource) { - assert_throws("InvalidAccessError", + assert_throws(new TypeError(), function() { mediaSource.addSourceBuffer(""); }, "addSourceBuffer() threw an exception when passed an empty string."); test.done(); diff --git a/testing/web-platform/tests/media-source/mediasource-appendwindow.html b/testing/web-platform/tests/media-source/mediasource-appendwindow.html index 2a6fb426c8d6..8ea8a15b0a65 100644 --- a/testing/web-platform/tests/media-source/mediasource-appendwindow.html +++ b/testing/web-platform/tests/media-source/mediasource-appendwindow.html @@ -44,35 +44,35 @@ function() { sourceBuffer.appendWindowStart = Number.NaN; }, "set appendWindowStart throws an exception for Number.NaN."); - assert_throws("InvalidAccessError", + assert_throws(new TypeError(), function() { sourceBuffer.appendWindowStart = 600.0; }, "set appendWindowStart throws an exception when greater than appendWindowEnd."); - assert_throws("InvalidAccessError", + assert_throws(new TypeError(), function() { sourceBuffer.appendWindowStart = sourceBuffer.appendWindowEnd; }, "set appendWindowStart throws an exception when equal to appendWindowEnd."); - assert_throws("InvalidAccessError", + assert_throws(new TypeError(), function() { sourceBuffer.appendWindowEnd = sourceBuffer.appendWindowStart; }, "set appendWindowEnd throws an exception when equal to appendWindowStart."); - assert_throws("InvalidAccessError", + assert_throws(new TypeError(), function() { sourceBuffer.appendWindowEnd = sourceBuffer.appendWindowStart - 1; }, "set appendWindowEnd throws an exception if less than appendWindowStart."); - assert_throws("InvalidAccessError", + assert_throws(new TypeError(), function() { sourceBuffer.appendWindowStart = -100.0; }, "set appendWindowStart throws an exception when less than 0."); - assert_throws("InvalidAccessError", + assert_throws(new TypeError(), function() { sourceBuffer.appendWindowEnd = -100.0; }, "set appendWindowEnd throws an exception when less than 0."); - assert_throws("InvalidAccessError", + assert_throws(new TypeError(), function() { sourceBuffer.appendWindowEnd = Number.NaN; }, "set appendWindowEnd throws an exception if NaN."); - assert_throws("InvalidAccessError", + assert_throws(new TypeError(), function() { sourceBuffer.appendWindowEnd = undefined; }, "set appendWindowEnd throws an exception if undefined."); diff --git a/testing/web-platform/tests/media-source/mediasource-duration-boundaryconditions.html b/testing/web-platform/tests/media-source/mediasource-duration-boundaryconditions.html index 4521fd08fd38..7b1e8d7176e2 100644 --- a/testing/web-platform/tests/media-source/mediasource-duration-boundaryconditions.html +++ b/testing/web-platform/tests/media-source/mediasource-duration-boundaryconditions.html @@ -49,14 +49,14 @@ DurationBoundaryConditionTest(Number.MAX_VALUE, null, "Set duration to Number.MAX_VALUE"); DurationBoundaryConditionTest(Number.MIN_VALUE, null, "Set duration to Number.MIN_VALUE"); DurationBoundaryConditionTest(Number.MAX_VALUE - 1, null, "Set duration to Number.MAX_VALUE - 1"); - DurationBoundaryConditionTest(Number.MIN_VALUE - 1, "InvalidAccessError", "Set duration to Number.MIN_VALUE - 1"); + DurationBoundaryConditionTest(Number.MIN_VALUE - 1, new TypeError(), "Set duration to Number.MIN_VALUE - 1"); DurationBoundaryConditionTest(Number.POSITIVE_INFINITY, null, "Set duration to Number.POSITIVE_INFINITY"); - DurationBoundaryConditionTest(Number.NEGATIVE_INFINITY, "InvalidAccessError", "Set duration to Number.NEGATIVE_INFINITY"); - DurationBoundaryConditionTest(-1 * Number.MAX_VALUE, "InvalidAccessError", "Set duration to lowest value."); - DurationBoundaryConditionTest(-101.9, "InvalidAccessError", "Set duration to a negative double."); + DurationBoundaryConditionTest(Number.NEGATIVE_INFINITY, new TypeError(), "Set duration to Number.NEGATIVE_INFINITY"); + DurationBoundaryConditionTest(-1 * Number.MAX_VALUE, new TypeError(), "Set duration to lowest value."); + DurationBoundaryConditionTest(-101.9, new TypeError(), "Set duration to a negative double."); DurationBoundaryConditionTest(101.9, null, "Set duration to a positive double."); DurationBoundaryConditionTest(0, null, "Set duration to zero"); - DurationBoundaryConditionTest(NaN, "InvalidAccessError", "Set duration to NaN"); + DurationBoundaryConditionTest(NaN, new TypeError(), "Set duration to NaN"); diff --git a/testing/web-platform/tests/media-source/mediasource-remove.html b/testing/web-platform/tests/media-source/mediasource-remove.html index 0b9db531cecb..da3ae71d2f35 100644 --- a/testing/web-platform/tests/media-source/mediasource-remove.html +++ b/testing/web-platform/tests/media-source/mediasource-remove.html @@ -13,7 +13,7 @@ { var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE); - assert_throws("InvalidAccessError", function() + assert_throws(new TypeError(), function() { sourceBuffer.remove(-1, 2); }, "remove"); @@ -42,7 +42,7 @@ mediaSource.duration = 10; - assert_throws("InvalidAccessError", function() + assert_throws(new TypeError(), function() { sourceBuffer.remove(11, 12); }, "remove"); @@ -56,7 +56,7 @@ mediaSource.duration = 10; - assert_throws("InvalidAccessError", function() + assert_throws(new TypeError(), function() { sourceBuffer.remove(2, 1); }, "remove"); @@ -68,7 +68,7 @@ { var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE); - assert_throws("InvalidAccessError", function() + assert_throws(new TypeError(), function() { sourceBuffer.remove(0, Number.NEGATIVE_INFINITY); }, "remove"); @@ -80,7 +80,7 @@ { var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE); - assert_throws("InvalidAccessError", function() + assert_throws(new TypeError(), function() { sourceBuffer.remove(0, Number.NaN); }, "remove"); From 65b0fd2d1db378ff4650949a7a3d0805c608f8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nelson=20Jo=C3=A3o=20Morais?= Date: Thu, 14 Jul 2016 01:11:07 +0100 Subject: [PATCH 004/150] Bug 1283959 - Add SetWindowSize to return new width and height to comply with WD Spec r=automatedtester MozReview-Commit-ID: AGnJuLqyULY --HG-- extra : rebase_source : a77d4f7ab84c023f78a1e927a155626add26af6c --- .../marionette/client/marionette_driver/marionette.py | 2 +- testing/marionette/driver.js | 1 + .../marionette/tests/unit/test_set_window_size.py | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/testing/marionette/client/marionette_driver/marionette.py b/testing/marionette/client/marionette_driver/marionette.py index 6752ba57480a..780d7b8b188c 100644 --- a/testing/marionette/client/marionette_driver/marionette.py +++ b/testing/marionette/client/marionette_driver/marionette.py @@ -1934,7 +1934,7 @@ class Marionette(object): """ body = {"width": width, "height": height} - self._send_message("setWindowSize", body) + return self._send_message("setWindowSize", body) def maximize_window(self): """ Resize the browser window currently receiving commands. The action diff --git a/testing/marionette/driver.js b/testing/marionette/driver.js index 5ef39577f20f..b8ce378cd12c 100644 --- a/testing/marionette/driver.js +++ b/testing/marionette/driver.js @@ -2492,6 +2492,7 @@ GeckoDriver.prototype.setWindowSize = function(cmd, resp) { let {width, height} = cmd.parameters; let win = this.getCurrentWindow(); win.resizeTo(width, height); + this.getWindowSize(cmd, resp); }; /** diff --git a/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py b/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py index 7545f8509b4f..7a3fa84c897e 100644 --- a/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py +++ b/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py @@ -43,6 +43,17 @@ class TestSetWindowSize(MarionetteTestCase): self.assertEqual(size['height'], height, "Window height is %s but should be %s" % (size['height'], height)) + def test_that_we_can_get_new_size_when_set_window_size(self): + actual = self.marionette.window_size + width = actual['width'] - 50 + height = actual['height'] - 50 + size = self.marionette.set_window_size(width, height) + self.assertIsNotNone(size, "Response is None") + self.assertEqual(size['width'], width, + "New width is %s but should be %s" % (size['width'], width)) + self.assertEqual(size['height'], height, + "New height is %s but should be %s" % (size['height'], height)) + def test_possible_to_request_window_larger_than_screen(self): self.marionette.set_window_size(100000, 100000) size = self.marionette.window_size From 7d69ebf641cca50fabd671dd4f1f064fa29d1912 Mon Sep 17 00:00:00 2001 From: Andrew Comminos Date: Wed, 13 Jul 2016 16:28:07 -0400 Subject: [PATCH 005/150] Bug 1286649 - Replace X11 SHM dependencies with XCB. r=glandium MozReview-Commit-ID: Ii74rWquYhb --HG-- extra : rebase_source : 3d5ba8333e6598d4940958920ea3271ad78c6785 --- config/system-headers | 3 +++ old-configure.in | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/config/system-headers b/config/system-headers index 3644fe3bf2e0..474d3962bbc8 100644 --- a/config/system-headers +++ b/config/system-headers @@ -1210,6 +1210,8 @@ wx/log.h wx/toolbar.h wx/wx.h wx/xrc/xmlres.h +xcb/xcb.h +xcb/shm.h X11/cursorfont.h X11/extensions/Print.h X11/extensions/shape.h @@ -1231,6 +1233,7 @@ X11/X.h X11/XKBlib.h X11/Xlib.h X11/Xlibint.h +X11/Xlib-xcb.h X11/Xlocale.h X11/Xos.h X11/Xutil.h diff --git a/old-configure.in b/old-configure.in index 72ed2f14719b..96d0f1178e8c 100644 --- a/old-configure.in +++ b/old-configure.in @@ -1755,7 +1755,7 @@ dnl Xt is dependent upon SM as of X11R6 dnl ======================================================== if test -n "$MOZ_X11"; then AC_DEFINE_UNQUOTED(FUNCPROTO,15) - XLIBS="-lX11 $XLIBS" + XLIBS="-lX11-xcb -lX11 -lxcb-shm -lxcb $XLIBS" _SAVE_LDFLAGS="$LDFLAGS" LDFLAGS="$XLDFLAGS $LDFLAGS" AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"], @@ -1772,10 +1772,11 @@ if test -n "$MOZ_X11"; then ]) dnl ======================================================== - dnl = Check for XShm + dnl = Check for xcb dnl ======================================================== - AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,, - $XLIBS $XEXT_LIBS) + AC_CHECK_LIB(X11-xcb, XGetXCBConnection,, [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS) + AC_CHECK_LIB(xcb-shm, xcb_shm_query_version,, [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS) + AC_CHECK_LIB(xcb, xcb_connect,, [MISSING_X="$MISSING_X -lxcb"], $XLIBS) dnl ======================================================== dnl = Check for Xss From b6196b138b4ae7b4ced590e1b07fe32e7101ac20 Mon Sep 17 00:00:00 2001 From: Andrew Comminos Date: Wed, 13 Jul 2016 16:28:28 -0400 Subject: [PATCH 006/150] Bug 1286649 - Port Xlib code in nsShmImage to use XCB. r=lsalzman MozReview-Commit-ID: DUIv1RQBWW4 --HG-- extra : rebase_source : f8fec665e4afa4334c637c34a51f0e36969b3516 --- widget/nsShmImage.cpp | 263 ++++++++++++++++-------------------------- widget/nsShmImage.h | 27 +++-- 2 files changed, 112 insertions(+), 178 deletions(-) diff --git a/widget/nsShmImage.cpp b/widget/nsShmImage.cpp index ea42a7faf865..abeb2bad8a18 100644 --- a/widget/nsShmImage.cpp +++ b/widget/nsShmImage.cpp @@ -25,18 +25,19 @@ nsShmImage::nsShmImage(Display* aDisplay, Drawable aWindow, Visual* aVisual, unsigned int aDepth) - : mImage(nullptr) - , mDisplay(aDisplay) - , mWindow(aWindow) + : mWindow(aWindow) , mVisual(aVisual) , mDepth(aDepth) , mFormat(mozilla::gfx::SurfaceFormat::UNKNOWN) - , mPixmap(None) - , mGC(nullptr) - , mRequest(0) - , mPreviousRequestProcessed(0) + , mSize(0, 0) + , mPixmap(XCB_NONE) + , mGC(XCB_NONE) + , mShmSeg(XCB_NONE) + , mShmId(-1) + , mShmAddr(nullptr) { - memset(&mInfo, -1, sizeof(mInfo)); + mConnection = XGetXCBConnection(aDisplay); + mozilla::PodZero(&mLastRequest); } nsShmImage::~nsShmImage() @@ -52,38 +53,25 @@ bool nsShmImage::UseShm() return gShmAvailable; } -static int gShmError = 0; - -static int -TrapShmError(Display* aDisplay, XErrorEvent* aEvent) -{ - // store the error code and ignore the error - gShmError = aEvent->error_code; - return 0; -} - bool nsShmImage::CreateShmSegment() { - if (!mImage) { + size_t size = SharedMemory::PageAlignedSize(BytesPerPixel(mFormat) * + mSize.width * mSize.height); + + mShmId = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600); + if (mShmId == -1) { return false; } - - size_t size = SharedMemory::PageAlignedSize(mImage->bytes_per_line * mImage->height); - - mInfo.shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600); - if (mInfo.shmid == -1) { - return false; - } - - mInfo.shmaddr = (char *)shmat(mInfo.shmid, nullptr, 0); + mShmAddr = (uint8_t*) shmat(mShmId, nullptr, 0); + mShmSeg = xcb_generate_id(mConnection); // Mark the handle removed so that it will destroy the segment when unmapped. - shmctl(mInfo.shmid, IPC_RMID, nullptr); + shmctl(mShmId, IPC_RMID, nullptr); - if (mInfo.shmaddr == (void *)-1) { + if (mShmAddr == (void *)-1) { // Since mapping failed, the segment is already destroyed. - mInfo.shmid = -1; + mShmId = -1; nsPrintfCString warning("shmat(): %s (%d)\n", strerror(errno), errno); NS_WARNING(warning.get()); @@ -92,7 +80,7 @@ nsShmImage::CreateShmSegment() #ifdef DEBUG struct shmid_ds info; - if (shmctl(mInfo.shmid, IPC_STAT, &info) < 0) { + if (shmctl(mShmId, IPC_STAT, &info) < 0) { return false; } @@ -100,25 +88,20 @@ nsShmImage::CreateShmSegment() "Segment doesn't have enough space!"); #endif - mInfo.readOnly = False; - - mImage->data = mInfo.shmaddr; - return true; } void nsShmImage::DestroyShmSegment() { - if (mInfo.shmid != -1) { - shmdt(mInfo.shmaddr); - mInfo.shmid = -1; + if (mShmId != -1) { + shmdt(mShmAddr); + mShmId = -1; } } static bool gShmInitialized = false; -static int gShmEvent = -1; -static Atom gShmPixmapAtom = None; +static bool gUseShmPixmaps = false; bool nsShmImage::InitExtension() @@ -129,27 +112,27 @@ nsShmImage::InitExtension() gShmInitialized = true; - if (!XShmQueryExtension(mDisplay)) { + const xcb_query_extension_reply_t* extReply; + extReply = xcb_get_extension_data(mConnection, &xcb_shm_id); + if (!extReply || !extReply->present) { gShmAvailable = false; return false; } - int major, minor; - Bool pixmaps; - if (!XShmQueryVersion(mDisplay, &major, &minor, &pixmaps)) { + xcb_shm_query_version_reply_t* shmReply = xcb_shm_query_version_reply( + mConnection, + xcb_shm_query_version(mConnection), + nullptr); + + if (!shmReply) { gShmAvailable = false; return false; } - gShmEvent = XShmGetEventBase(mDisplay); - if (gShmEvent < 0) { - gShmAvailable = false; - return false; - } + gUseShmPixmaps = shmReply->shared_pixmaps && + shmReply->pixmap_format == XCB_IMAGE_FORMAT_Z_PIXMAP; - if (pixmaps && XShmPixmapFormat(mDisplay) == ZPixmap) { - gShmPixmapAtom = XInternAtom(mDisplay, "_MOZ_SHM_PIXMAP", False); - } + free(shmReply); return true; } @@ -157,12 +140,14 @@ nsShmImage::InitExtension() bool nsShmImage::CreateImage(const IntSize& aSize) { - MOZ_ASSERT(mDisplay && mVisual); + MOZ_ASSERT(mConnection && mVisual); if (!InitExtension()) { return false; } + mSize = aSize; + BackendType backend = gfxPlatform::GetPlatform()->GetDefaultContentBackend(); mFormat = SurfaceFormat::UNKNOWN; @@ -200,38 +185,36 @@ nsShmImage::CreateImage(const IntSize& aSize) return false; } - mImage = XShmCreateImage(mDisplay, mVisual, mDepth, - ZPixmap, nullptr, - &mInfo, - aSize.width, aSize.height); - if (!mImage || !CreateShmSegment()) { + if (!CreateShmSegment()) { DestroyImage(); return false; } - gShmError = 0; - XErrorHandler previousHandler = XSetErrorHandler(TrapShmError); - Status attachOk = XShmAttach(mDisplay, &mInfo); - XSync(mDisplay, False); - XSetErrorHandler(previousHandler); - if (gShmError) { - attachOk = 0; - } + xcb_generic_error_t* error; + xcb_void_cookie_t cookie; - if (!attachOk) { - DestroyShmSegment(); + cookie = xcb_shm_attach_checked(mConnection, mShmSeg, mShmId, 0); + + if ((error = xcb_request_check(mConnection, cookie))) { + NS_WARNING("Failed to attach MIT-SHM segment."); DestroyImage(); - - // Assume XShm isn't available, and don't attempt to use it - // again. gShmAvailable = false; + free(error); return false; } - if (gShmPixmapAtom != None) { - mPixmap = XShmCreatePixmap(mDisplay, mWindow, - mImage->data, &mInfo, - mImage->width, mImage->height, mImage->depth); + if (gUseShmPixmaps) { + mPixmap = xcb_generate_id(mConnection); + cookie = xcb_shm_create_pixmap_checked(mConnection, mPixmap, mWindow, + aSize.width, aSize.height, mDepth, + mShmSeg, 0); + + if ((error = xcb_request_check(mConnection, cookie))) { + // Disable shared pixmaps permanently if creation failed. + mPixmap = XCB_NONE; + gUseShmPixmaps = false; + free(error); + } } return true; @@ -240,23 +223,17 @@ nsShmImage::CreateImage(const IntSize& aSize) void nsShmImage::DestroyImage() { - if (mImage) { - mozilla::FinishX(mDisplay); - } if (mGC) { - XFreeGC(mDisplay, mGC); - mGC = nullptr; + xcb_free_gc(mConnection, mGC); + mGC = XCB_NONE; } - if (mPixmap != None) { - XFreePixmap(mDisplay, mPixmap); - mPixmap = None; + if (mPixmap != XCB_NONE) { + xcb_free_pixmap(mConnection, mPixmap); + mPixmap = XCB_NONE; } - if (mImage) { - if (mInfo.shmid != -1) { - XShmDetach(mDisplay, &mInfo); - } - XDestroyImage(mImage); - mImage = nullptr; + if (mShmSeg != XCB_NONE) { + xcb_shm_detach_checked(mConnection, mShmSeg); + mShmSeg = XCB_NONE; } DestroyShmSegment(); } @@ -264,8 +241,17 @@ nsShmImage::DestroyImage() already_AddRefed nsShmImage::CreateDrawTarget(const mozilla::LayoutDeviceIntRegion& aRegion) { - // Wait for any in-flight XShmPutImage requests to complete. - WaitForRequest(); + // Wait for any in-flight requests to complete. + // Typically X clients would wait for a XShmCompletionEvent to be received, + // but this works as it's sent immediately after the request is processed. + xcb_generic_error_t* error; + if (mLastRequest.sequence != XCB_NONE && + (error = xcb_request_check(mConnection, mLastRequest))) + { + gShmAvailable = false; + free(error); + return nullptr; + } // Due to bug 1205045, we must avoid making GTK calls off the main thread to query window size. // Instead we just track the largest offset within the image we are drawing to and grow the image @@ -273,7 +259,7 @@ nsShmImage::CreateDrawTarget(const mozilla::LayoutDeviceIntRegion& aRegion) // this should grow the image to the necessary size quickly without many intermediate reallocations. IntRect bounds = aRegion.GetBounds().ToUnknownRect(); IntSize size(bounds.XMost(), bounds.YMost()); - if (!mImage || size.width > mImage->width || size.height > mImage->height) { + if (size.width > mSize.width || size.height > mSize.height) { DestroyImage(); if (!CreateImage(size)) { return nullptr; @@ -281,97 +267,46 @@ nsShmImage::CreateDrawTarget(const mozilla::LayoutDeviceIntRegion& aRegion) } return gfxPlatform::GetPlatform()->CreateDrawTargetForData( - reinterpret_cast(mImage->data) - + bounds.y * mImage->bytes_per_line + bounds.x * BytesPerPixel(mFormat), + reinterpret_cast(mShmAddr) + + BytesPerPixel(mFormat) * (bounds.y * mSize.width + bounds.x), bounds.Size(), - mImage->bytes_per_line, + BytesPerPixel(mFormat) * mSize.width, mFormat); } -bool -nsShmImage::RequestWasProcessed() -{ - // Check for either that the sequence number has advanced to the request, - // or that it has advanced so far around that it appears to be before the - // last request processed at the time the request was initially sent. - unsigned long processed = LastKnownRequestProcessed(mDisplay); - return long(processed - mRequest) >= 0 || - long(processed - mPreviousRequestProcessed) < 0; -} - -Bool -nsShmImage::FindEvent(Display* aDisplay, XEvent* aEvent, XPointer aArg) -{ - nsShmImage* image = (nsShmImage*)aArg; - return image->RequestWasProcessed(); -} - -void -nsShmImage::WaitForRequest() -{ - if (!mRequest) { - return; - } - - if (!RequestWasProcessed()) { - XEvent event; - XPeekIfEvent(mDisplay, &event, FindEvent, (XPointer)this); - } - - mRequest = 0; -} - -void -nsShmImage::SendEvent() -{ - XClientMessageEvent event; - memset(&event, 0, sizeof(event)); - - event.type = ClientMessage; - event.window = mWindow; - event.message_type = gShmPixmapAtom; - event.format = 32; - event.data.l[0] = (long)mInfo.shmseg; - - XSendEvent(mDisplay, mWindow, False, 0, (XEvent*)&event); -} - void nsShmImage::Put(const mozilla::LayoutDeviceIntRegion& aRegion) { - if (!mImage) { - return; - } - - AutoTArray xrects; + AutoTArray xrects; xrects.SetCapacity(aRegion.GetNumRects()); for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) { const mozilla::LayoutDeviceIntRect &r = iter.Get(); - XRectangle xrect = { (short)r.x, (short)r.y, (unsigned short)r.width, (unsigned short)r.height }; + xcb_rectangle_t xrect = { (short)r.x, (short)r.y, (unsigned short)r.width, (unsigned short)r.height }; xrects.AppendElement(xrect); } if (!mGC) { - mGC = XCreateGC(mDisplay, mWindow, 0, nullptr); - if (!mGC) { - return; - } + mGC = xcb_generate_id(mConnection); + xcb_create_gc(mConnection, mGC, mWindow, 0, nullptr); } - XSetClipRectangles(mDisplay, mGC, 0, 0, xrects.Elements(), xrects.Length(), YXBanded); - mRequest = XNextRequest(mDisplay); - if (mPixmap != None) { - XCopyArea(mDisplay, mPixmap, mWindow, mGC, 0, 0, mImage->width, mImage->height, 0, 0); - // Send a synthetic event to ensure WaitForRequest can safely poll it. - SendEvent(); + xcb_set_clip_rectangles(mConnection, XCB_CLIP_ORDERING_YX_BANDED, mGC, 0, 0, + xrects.Length(), xrects.Elements()); + + if (mPixmap != XCB_NONE) { + mLastRequest = xcb_copy_area_checked(mConnection, mPixmap, mWindow, mGC, + 0, 0, 0, 0, mSize.width, mSize.height); } else { - // The send_event parameter is True here for WaitForRequest polling. - XShmPutImage(mDisplay, mWindow, mGC, mImage, 0, 0, 0, 0, mImage->width, mImage->height, True); + mLastRequest = xcb_shm_put_image_checked(mConnection, mWindow, mGC, + mSize.width, mSize.height, + 0, 0, mSize.width, mSize.height, + 0, 0, mDepth, + XCB_IMAGE_FORMAT_Z_PIXMAP, 0, + mShmSeg, 0); } - mPreviousRequestProcessed = LastKnownRequestProcessed(mDisplay); - XFlush(mDisplay); + xcb_flush(mConnection); } #endif // MOZ_HAVE_SHMIMAGE diff --git a/widget/nsShmImage.h b/widget/nsShmImage.h index 000b62ee6259..5be968fe1717 100644 --- a/widget/nsShmImage.h +++ b/widget/nsShmImage.h @@ -17,8 +17,8 @@ #include "nsIWidget.h" #include "Units.h" -#include -#include +#include +#include class nsShmImage { // bug 1168843, compositor thread may create shared memory instances that are destroyed by main thread on shutdown, so this must use thread-safe RC to avoid hitting assertion @@ -48,22 +48,21 @@ private: bool CreateImage(const mozilla::gfx::IntSize& aSize); void DestroyImage(); - static Bool FindEvent(Display* aDisplay, XEvent* aEvent, XPointer aArg); - bool RequestWasProcessed(); - void WaitForRequest(); - void SendEvent(); - - XImage* mImage; - Display* mDisplay; + xcb_connection_t* mConnection; Window mWindow; Visual* mVisual; unsigned int mDepth; - XShmSegmentInfo mInfo; + mozilla::gfx::SurfaceFormat mFormat; - Pixmap mPixmap; - GC mGC; - unsigned long mRequest; - unsigned long mPreviousRequestProcessed; + mozilla::gfx::IntSize mSize; + + xcb_pixmap_t mPixmap; + xcb_gcontext_t mGC; + xcb_void_cookie_t mLastRequest; + + xcb_shm_seg_t mShmSeg; + int mShmId; + uint8_t* mShmAddr; }; #endif // MOZ_HAVE_SHMIMAGE From 6798f0265479fbf4be776610086619c9f5efd0b3 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Thu, 21 Apr 2016 15:48:59 +0200 Subject: [PATCH 007/150] Bug 1286530 - Clean AvailableIn, CheckAnyPermissions and CheckAllPermissions from WebIDL r=bz,fabrice MozReview-Commit-ID: 6EQfBM09xUE --HG-- rename : dom/contacts/tests/test_contacts_cache.xul => dom/contacts/tests/test_contacts_a_cache.xul rename : dom/contacts/tests/test_contacts_shutdown.xul => dom/contacts/tests/test_contacts_a_shutdown.xul rename : dom/contacts/tests/test_contacts_upgrade.xul => dom/contacts/tests/test_contacts_a_upgrade.xul rename : dom/mobilemessage/tests/mochitest/mochitest.ini => dom/mobilemessage/tests/mochitest/chrome.ini extra : rebase_source : 5f708f2a927fafff66626367ef07080785ba9f55 --- dom/alarm/moz.build | 2 + dom/alarm/test/chrome.ini | 7 ++ dom/alarm/test/mochitest.ini | 9 +- dom/alarm/test/test_alarm_permitted_app.html | 6 +- dom/base/Navigator.cpp | 8 +- dom/base/test/chrome.ini | 6 ++ .../test/file_navigator_resolve_identity.html | 36 +++++++ dom/base/test/mochitest.ini | 5 - dom/base/test/mozbrowser_api_utils.js | 22 ++-- dom/base/test/test_getFeature_with_perm.html | 34 +++--- .../test/test_getFeature_without_perm.html | 21 ---- dom/base/test/test_hasFeature.html | 8 +- .../test/test_mozbrowser_apis_allowed.html | 18 ++-- .../test/test_navigator_resolve_identity.html | 24 +---- .../test_navigator_resolve_identity_xrays.xul | 16 --- dom/bindings/BindingUtils.cpp | 70 ------------ dom/bindings/BindingUtils.h | 14 --- dom/bindings/Codegen.py | 100 +----------------- dom/bindings/Configuration.py | 53 ---------- dom/bindings/DOMJSClass.h | 36 +------ dom/bindings/mozwebidlcodegen/__init__.py | 1 - dom/bindings/parser/WebIDL.py | 35 +----- dom/bindings/test/TestCodeGen.webidl | 11 +- dom/bindings/test/TestJSImplGen.webidl | 8 -- dom/bindings/test/chrome.ini | 4 +- dom/bindings/test/file_bug707564-2.html | 4 +- dom/bindings/test/mochitest.ini | 3 - dom/bindings/test/test_bug707564-chrome.html | 66 ------------ dom/bindings/test/test_bug707564.html | 13 +-- .../mochitest/browserElementTestHelpers.js | 1 + .../browserElement_ActiveStateChange.js | 5 +- .../mochitest/browserElement_AudioChannel.js | 9 +- ...owserElement_AudioChannelMutedByDefault.js | 5 +- .../browserElement_AudioChannelSeeking.js | 5 +- .../browserElement_AudioChannel_nested.js | 15 +-- .../mochitest/browserElement_AudioPlayback.js | 3 +- .../mochitest/browserElement_BackForward.js | 1 - .../mochitest/browserElement_BadScreenshot.js | 1 - .../browserElement_DOMRequestError.js | 1 - .../browserElement_DocumentFirstPaint.js | 1 - .../mochitest/browserElement_Find.js | 1 - .../browserElement_GetContentDimensions.js | 1 - .../mochitest/browserElement_GetScreenshot.js | 1 - .../browserElement_GetScreenshotDppx.js | 1 - .../mochitest/browserElement_NextPaint.js | 1 - .../mochitest/browserElement_NoAudioTrack.js | 5 +- .../browserElement_OpenMixedProcess.js | 1 - .../mochitest/browserElement_PurgeHistory.js | 3 +- .../browserElement_ReloadPostRequest.js | 1 - .../mochitest/browserElement_SendEvent.js | 17 +-- .../browserElement_SetInputMethodActive.js | 19 ++-- .../mochitest/browserElement_SetNFCFocus.js | 5 +- .../mochitest/browserElement_SetVisible.js | 1 - .../browserElement_SetVisibleFrames.js | 15 --- .../browserElement_SetVisibleFrames2.js | 15 --- .../mochitest/browserElement_Stop.js | 4 +- .../browserElement_VisibilityChange.js | 1 - .../browserElement_XFrameOptionsAllowFrom.js | 28 +---- .../browserElement_XFrameOptionsDeny.js | 26 +---- .../browserElement_getWebManifest.js | 1 - dom/browser-element/mochitest/chrome.ini | 91 +++++++++++++++- dom/browser-element/mochitest/file_audio.html | 2 +- ...le_browserElement_AudioChannel_nested.html | 6 +- .../file_browserElement_SendEvent.html | 15 +++ ...e_browserElement_SetInputMethodActive.html | 2 + .../mochitest/file_illegal_web_manifest.html | 3 +- .../mochitest/mochitest-oop.ini | 45 ++++++-- dom/browser-element/mochitest/mochitest.ini | 84 +-------------- .../mochitest/priority/chrome.ini | 19 ++++ .../mochitest/priority/mochitest.ini | 13 +-- .../mochitest/priority/test_Activity.html | 5 +- .../mochitest/priority/test_Audio.html | 5 +- .../mochitest/priority/test_Background.html | 5 +- .../mochitest/priority/test_Keyboard.html | 5 +- .../priority/test_MultipleFrames.html | 5 +- .../mochitest/priority/test_NestedFrames.html | 22 +--- .../mochitest/priority/test_Simple.html | 13 ++- .../mochitest/priority/test_Visibility.html | 5 +- ...owserElement_inproc_ActiveStateChange.html | 4 +- ...st_browserElement_inproc_AudioChannel.html | 4 +- ...ent_inproc_AudioChannelMutedByDefault.html | 6 +- ...serElement_inproc_AudioChannelSeeking.html | 6 +- ...serElement_inproc_AudioChannel_nested.html | 4 +- ...t_browserElement_inproc_AudioPlayback.html | 4 +- ...est_browserElement_inproc_BackForward.html | 4 +- ...t_browserElement_inproc_BadScreenshot.html | 6 +- ...browserElement_inproc_DOMRequestError.html | 4 +- ...wserElement_inproc_DocumentFirstPaint.html | 4 +- ...t_browserElement_inproc_ExecuteScript.html | 4 +- .../test_browserElement_inproc_Find.html | 4 +- ...erElement_inproc_GetContentDimensions.html | 4 +- ...t_browserElement_inproc_GetScreenshot.html | 4 +- ...owserElement_inproc_GetScreenshotDppx.html | 4 +- .../test_browserElement_inproc_NextPaint.html | 6 +- ...st_browserElement_inproc_NoAudioTrack.html | 6 +- ...rowserElement_inproc_OpenMixedProcess.html | 2 +- ...st_browserElement_inproc_PurgeHistory.html | 4 +- .../test_browserElement_inproc_SendEvent.html | 4 +- ...erElement_inproc_SetInputMethodActive.html | 4 +- ...est_browserElement_inproc_SetNFCFocus.html | 4 +- ...test_browserElement_inproc_SetVisible.html | 4 +- ...rowserElement_inproc_SetVisibleFrames.html | 6 +- ...owserElement_inproc_SetVisibleFrames2.html | 6 +- .../test_browserElement_inproc_Stop.html | 4 +- ...rowserElement_inproc_VisibilityChange.html | 4 +- ..._browserElement_inproc_getWebManifest.html | 6 +- ..._browserElement_oop_ActiveStateChange.html | 4 +- dom/browser-element/moz.build | 6 +- dom/contacts/tests/chrome.ini | 48 ++++++++- dom/contacts/tests/file_contacts_basics.html | 4 +- dom/contacts/tests/file_contacts_basics2.html | 4 +- dom/contacts/tests/file_contacts_blobs.html | 4 +- dom/contacts/tests/file_contacts_events.html | 4 +- dom/contacts/tests/file_contacts_getall.html | 4 +- dom/contacts/tests/file_contacts_getall2.html | 4 +- .../tests/file_contacts_international.html | 4 +- .../file_contacts_substringmatching.html | 4 +- .../file_contacts_substringmatchingCL.html | 4 +- .../file_contacts_substringmatchingVE.html | 4 +- dom/contacts/tests/file_migration.html | 4 +- dom/contacts/tests/mochitest.ini | 30 ------ ...ts_cache.xul => test_contacts_a_cache.xul} | 0 ...tdown.xul => test_contacts_a_shutdown.xul} | 0 ...pgrade.xul => test_contacts_a_upgrade.xul} | 0 dom/contacts/tests/test_contacts_basics.html | 12 +-- dom/contacts/tests/test_contacts_basics2.html | 12 +-- dom/contacts/tests/test_contacts_blobs.html | 12 +-- dom/contacts/tests/test_contacts_events.html | 12 +-- dom/contacts/tests/test_contacts_getall.html | 12 +-- dom/contacts/tests/test_contacts_getall2.html | 12 +-- .../tests/test_contacts_international.html | 12 +-- .../test_contacts_substringmatching.html | 12 +-- .../test_contacts_substringmatchingCL.html | 12 +-- .../test_contacts_substringmatchingVE.html | 12 +-- dom/contacts/tests/test_migration.html | 12 +-- dom/html/test/chrome.ini | 8 +- dom/html/test/mochitest.ini | 6 -- dom/html/test/test_audio_wakelock.html | 12 +-- dom/html/test/test_video_wakelock.html | 14 +-- .../mochitest/{mochitest.ini => chrome.ini} | 22 +++- .../mochitest/file_test_bug1066515.html | 6 ++ .../mochitest/file_test_bug1137557.html | 6 ++ .../mochitest/file_test_bug1175399.html | 1 + .../file_test_focus_blur_manage_events.html | 22 ++++ .../file_test_setSupportsSwitching.html | 5 + .../file_test_simple_manage_events.html | 1 + .../mochitest/file_test_sync_edit.html | 1 + .../mochitest/file_test_two_inputs.html | 1 + .../mochitest/file_test_two_selects.html | 1 + .../mochitest/file_test_unload.html | 1 + .../mochitest/file_test_unload_action.html | 1 + .../mochitest/inputmethod_common.js | 25 ++--- dom/inputmethod/mochitest/test_basic.html | 4 +- .../mochitest/test_bug1026997.html | 4 +- .../mochitest/test_bug1043828.html | 67 +++++------- .../mochitest/test_bug1059163.html | 7 +- .../mochitest/test_bug1066515.html | 4 +- .../mochitest/test_bug1137557.html | 6 +- .../mochitest/test_bug1175399.html | 6 +- dom/inputmethod/mochitest/test_bug944397.html | 41 +++---- dom/inputmethod/mochitest/test_bug949059.html | 4 +- dom/inputmethod/mochitest/test_bug953044.html | 4 +- dom/inputmethod/mochitest/test_bug960946.html | 4 +- dom/inputmethod/mochitest/test_bug978918.html | 4 +- .../test_focus_blur_manage_events.html | 56 +++------- .../test_forward_hardware_key_to_ime.html | 8 +- .../mochitest/test_input_registry_events.html | 45 ++++---- .../mochitest/test_sendkey_cancel.html | 4 +- .../mochitest/test_setSupportsSwitching.html | 10 +- .../mochitest/test_simple_manage_events.html | 43 +++----- dom/inputmethod/mochitest/test_sync_edit.html | 6 +- .../mochitest/test_two_inputs.html | 6 +- .../mochitest/test_two_selects.html | 6 +- dom/inputmethod/mochitest/test_unload.html | 8 +- dom/inputmethod/moz.build | 2 +- dom/mobilemessage/moz.build | 2 +- .../mochitest/{mochitest.ini => chrome.ini} | 0 .../tests/mochitest/test_sms_basics.html | 20 ++-- dom/network/TCPSocket.cpp | 8 +- dom/network/tests/chrome.ini | 8 +- dom/network/tests/mochitest.ini | 7 -- ...st_tcpsocket_client_and_server_basics.html | 4 +- ...test_tcpsocket_client_and_server_basics.js | 15 --- .../tests/test_tcpsocket_enabled_no_perm.html | 3 +- .../test_tcpsocket_enabled_with_perm.html | 8 +- dom/network/tests/test_tcpsocket_legacy.html | 12 +-- dom/network/tests/test_udpsocket.html | 19 ++-- dom/permission/tests/mochitest.ini | 26 +++-- dom/power/moz.build | 1 + dom/power/test/browser_wakelocks.js | 8 +- dom/power/test/chrome.ini | 9 ++ dom/power/test/mochitest.ini | 9 -- dom/power/test/test_power_basics.html | 24 +---- .../test/test_power_set_cpusleepallowed.html | 22 ++-- .../test_power_set_key_light_enabled.html | 22 ++-- .../test_power_set_screen_brightness.html | 22 ++-- .../test/test_power_set_screen_enabled.html | 22 ++-- dom/presentation/tests/mochitest/chrome.ini | 12 ++- .../tests/mochitest/mochitest.ini | 7 -- .../test_presentation_device_info.html | 18 ++-- ...t_presentation_device_info_permission.html | 14 +-- ...t_presentation_sender_startWithDevice.html | 19 ++-- .../test_presentation_tcp_sender.html | 15 +-- ...esentation_tcp_sender_default_request.html | 15 +-- dom/settings/moz.build | 4 +- dom/settings/tests/chrome.ini | 19 +++- dom/settings/tests/file_bug1110872.html | 5 - dom/settings/tests/mochitest.ini | 17 --- dom/settings/tests/test_settings_basics.html | 9 +- dom/settings/tests/test_settings_blobs.html | 9 +- .../tests/test_settings_bug1110872.html | 4 +- .../tests/test_settings_data_uris.html | 9 +- dom/settings/tests/test_settings_events.html | 8 +- .../tests/test_settings_navigator_object.html | 15 +-- .../tests/test_settings_observer_killer.html | 64 +++++------ .../tests/test_settings_onsettingchange.html | 9 +- .../tests/test_settings_permissions.html | 15 +-- dom/tests/mochitest/general/chrome.ini | 2 + dom/tests/mochitest/general/mochitest.ini | 2 - .../general/test_idleapi_permissions.html | 7 +- dom/tests/mochitest/geolocation/chrome.ini | 9 ++ dom/tests/mochitest/geolocation/mochitest.ini | 4 - .../geolocation/test_mozsettings.html | 15 +-- .../geolocation/test_mozsettingsWatch.html | 15 +-- dom/tests/mochitest/notification/chrome.ini | 8 ++ .../mochitest/notification/mochitest.ini | 4 +- .../test_notification_noresend.html | 4 +- dom/tests/moz.build | 2 + dom/tv/moz.build | 4 +- dom/tv/test/mochitest/chrome.ini | 19 ++++ dom/tv/test/mochitest/head.js | 18 +--- dom/tv/test/mochitest/mochitest.ini | 14 --- .../test/mochitest/test_tv_get_channels.html | 4 +- .../test_tv_get_channels_during_scanning.html | 4 +- .../test_tv_get_current_program.html | 4 +- .../test/mochitest/test_tv_get_programs.html | 4 +- .../test/mochitest/test_tv_get_sources.html | 4 +- dom/tv/test/mochitest/test_tv_get_tuners.html | 4 +- .../test/mochitest/test_tv_permitted_app.html | 4 +- .../test_tv_scan_channels_completed.html | 4 +- .../test_tv_scan_channels_stopped.html | 4 +- .../test_tv_set_current_channel.html | 4 +- ...v_set_current_channel_during_scanning.html | 4 +- .../mochitest/test_tv_set_current_source.html | 4 +- .../test_tv_set_invalid_current_channel.html | 4 +- .../test_tv_set_invalid_current_source.html | 4 +- dom/webidl/AVInputPort.webidl | 2 +- dom/webidl/AlarmsManager.webidl | 4 +- dom/webidl/Apps.webidl | 11 +- dom/webidl/AudioChannelManager.webidl | 2 +- dom/webidl/BeforeAfterKeyboardEvent.webidl | 4 +- dom/webidl/BluetoothAdapter.webidl | 38 ++++--- dom/webidl/BluetoothAdapterEvent.webidl | 2 +- dom/webidl/BluetoothAttributeEvent.webidl | 2 +- dom/webidl/BluetoothClassOfDevice.webidl | 2 +- dom/webidl/BluetoothDevice.webidl | 2 +- dom/webidl/BluetoothDeviceEvent.webidl | 2 +- dom/webidl/BluetoothDiscoveryHandle.webidl | 2 +- dom/webidl/BluetoothGatt.webidl | 2 +- dom/webidl/BluetoothGattAttributeEvent.webidl | 2 +- dom/webidl/BluetoothGattCharacteristic.webidl | 2 +- .../BluetoothGattCharacteristicEvent.webidl | 2 +- dom/webidl/BluetoothGattDescriptor.webidl | 2 +- dom/webidl/BluetoothGattServer.webidl | 2 +- dom/webidl/BluetoothGattService.webidl | 4 +- dom/webidl/BluetoothLeDeviceEvent.webidl | 2 +- dom/webidl/BluetoothManager.webidl | 2 +- .../BluetoothMapFolderListingEvent.webidl | 2 +- dom/webidl/BluetoothMapGetMessageEvent.webidl | 2 +- .../BluetoothMapMessageUpdateEvent.webidl | 2 +- .../BluetoothMapMessagesListingEvent.webidl | 2 +- dom/webidl/BluetoothMapRequestHandle.webidl | 14 +-- .../BluetoothMapSendMessageEvent.webidl | 2 +- .../BluetoothMapSetMessageStatusEvent.webidl | 2 +- dom/webidl/BluetoothObexAuthEvent.webidl | 2 +- dom/webidl/BluetoothObexAuthHandle.webidl | 2 +- dom/webidl/BluetoothPairingEvent.webidl | 2 +- dom/webidl/BluetoothPairingHandle.webidl | 2 +- dom/webidl/BluetoothPairingListener.webidl | 2 +- dom/webidl/BluetoothPbapRequestHandle.webidl | 8 +- .../BluetoothPhonebookPullingEvent.webidl | 2 +- dom/webidl/BluetoothStatusChangedEvent.webidl | 2 +- dom/webidl/BluetoothUUID.webidl | 2 +- dom/webidl/BluetoothVCardListingEvent.webidl | 2 +- dom/webidl/BluetoothVCardPullingEvent.webidl | 2 +- dom/webidl/BrowserElement.webidl | 52 ++++----- dom/webidl/BrowserElementAudioChannel.webidl | 14 +-- dom/webidl/BrowserElementProxy.webidl | 2 +- dom/webidl/ChromeNotifications.webidl | 2 +- dom/webidl/Contacts.webidl | 4 +- dom/webidl/DOMMobileMessageError.webidl | 3 +- dom/webidl/DisplayPortInputPort.webidl | 2 +- dom/webidl/DownloadEvent.webidl | 2 +- dom/webidl/Downloads.webidl | 5 +- dom/webidl/HDMIInputPort.webidl | 2 +- dom/webidl/IccCardLockError.webidl | 3 +- dom/webidl/IccChangeEvent.webidl | 3 +- dom/webidl/InputMethod.webidl | 35 ++---- dom/webidl/InputPort.webidl | 2 +- dom/webidl/InputPortManager.webidl | 2 +- dom/webidl/MMICall.webidl | 3 +- dom/webidl/MmsMessage.webidl | 3 +- dom/webidl/MobileMessageThread.webidl | 3 +- dom/webidl/MozCellBroadcast.webidl | 3 +- dom/webidl/MozCellBroadcastEvent.webidl | 3 +- dom/webidl/MozCellBroadcastMessage.webidl | 6 +- dom/webidl/MozContactChangeEvent.webidl | 2 +- dom/webidl/MozIcc.webidl | 3 +- dom/webidl/MozIccInfo.webidl | 9 +- dom/webidl/MozIccManager.webidl | 3 +- dom/webidl/MozIsoDepTech.webidl | 2 +- dom/webidl/MozMessageDeletedEvent.webidl | 3 +- dom/webidl/MozMmsEvent.webidl | 3 +- dom/webidl/MozMobileConnection.webidl | 49 ++++----- dom/webidl/MozMobileMessageManager.webidl | 3 +- dom/webidl/MozNFC.webidl | 16 ++- dom/webidl/MozNFCPeer.webidl | 4 +- dom/webidl/MozNFCPeerEvent.webidl | 3 +- dom/webidl/MozNFCTag.webidl | 2 +- dom/webidl/MozNFCTagEvent.webidl | 3 +- dom/webidl/MozNetworkStats.webidl | 1 - dom/webidl/MozNetworkStatsAlarm.webidl | 1 - dom/webidl/MozNetworkStatsData.webidl | 1 - dom/webidl/MozNetworkStatsInterface.webidl | 2 +- dom/webidl/MozNetworkStatsManager.webidl | 2 +- dom/webidl/MozNfcATech.webidl | 2 +- dom/webidl/MozPowerManager.webidl | 2 +- dom/webidl/MozSettingsEvent.webidl | 2 +- dom/webidl/MozSettingsTransactionEvent.webidl | 2 +- dom/webidl/MozSmsEvent.webidl | 3 +- dom/webidl/MozStkCommandEvent.webidl | 3 +- dom/webidl/MozTetheringManager.webidl | 2 +- dom/webidl/MozVoicemail.webidl | 3 +- dom/webidl/MozVoicemailEvent.webidl | 3 +- dom/webidl/MozVoicemailStatus.webidl | 3 +- dom/webidl/Navigator.webidl | 40 +++---- dom/webidl/PermissionSettings.webidl | 2 +- dom/webidl/PhoneNumberService.webidl | 2 +- .../PresentationDeviceInfoManager.webidl | 2 +- dom/webidl/PresentationRequest.webidl | 2 +- dom/webidl/ResourceStats.webidl | 9 +- dom/webidl/ResourceStatsManager.webidl | 6 +- dom/webidl/SecureElement.webidl | 12 +-- dom/webidl/SecureElementManager.webidl | 3 +- dom/webidl/SettingsManager.webidl | 2 +- dom/webidl/SimplePushManager.webidl | 2 +- dom/webidl/SmsMessage.webidl | 3 +- dom/webidl/SystemUpdate.webidl | 4 +- dom/webidl/TCPSocketErrorEvent.webidl | 4 +- dom/webidl/TVChannel.webidl | 2 +- .../TVCurrentChannelChangedEvent.webidl | 3 +- dom/webidl/TVCurrentSourceChangedEvent.webidl | 3 +- dom/webidl/TVEITBroadcastedEvent.webidl | 3 +- dom/webidl/TVManager.webidl | 2 +- dom/webidl/TVProgram.webidl | 2 +- dom/webidl/TVScanningStateChangedEvent.webidl | 3 +- dom/webidl/TVSource.webidl | 2 +- dom/webidl/TVTuner.webidl | 2 +- dom/webidl/Telephony.webidl | 3 +- dom/webidl/UDPMessageEvent.webidl | 2 +- dom/webidl/UDPSocket.webidl | 2 +- dom/webidl/USSDReceivedEvent.webidl | 3 +- dom/webidl/USSDSession.webidl | 3 +- dom/workers/WorkerPrivate.cpp | 14 --- dom/workers/WorkerPrivate.h | 12 --- dom/workers/WorkerScope.cpp | 7 +- dom/workers/Workers.h | 2 - 367 files changed, 1284 insertions(+), 2109 deletions(-) create mode 100644 dom/alarm/test/chrome.ini create mode 100644 dom/base/test/file_navigator_resolve_identity.html delete mode 100644 dom/base/test/test_getFeature_without_perm.html delete mode 100644 dom/bindings/test/test_bug707564-chrome.html create mode 100644 dom/browser-element/mochitest/file_browserElement_SendEvent.html create mode 100644 dom/browser-element/mochitest/file_browserElement_SetInputMethodActive.html create mode 100644 dom/browser-element/mochitest/priority/chrome.ini rename dom/contacts/tests/{test_contacts_cache.xul => test_contacts_a_cache.xul} (100%) rename dom/contacts/tests/{test_contacts_shutdown.xul => test_contacts_a_shutdown.xul} (100%) rename dom/contacts/tests/{test_contacts_upgrade.xul => test_contacts_a_upgrade.xul} (100%) rename dom/inputmethod/mochitest/{mochitest.ini => chrome.ini} (65%) create mode 100644 dom/inputmethod/mochitest/file_test_bug1066515.html create mode 100644 dom/inputmethod/mochitest/file_test_bug1137557.html create mode 100644 dom/inputmethod/mochitest/file_test_bug1175399.html create mode 100644 dom/inputmethod/mochitest/file_test_focus_blur_manage_events.html create mode 100644 dom/inputmethod/mochitest/file_test_setSupportsSwitching.html create mode 100644 dom/inputmethod/mochitest/file_test_simple_manage_events.html create mode 100644 dom/inputmethod/mochitest/file_test_sync_edit.html create mode 100644 dom/inputmethod/mochitest/file_test_two_inputs.html create mode 100644 dom/inputmethod/mochitest/file_test_two_selects.html create mode 100644 dom/inputmethod/mochitest/file_test_unload.html create mode 100644 dom/inputmethod/mochitest/file_test_unload_action.html rename dom/mobilemessage/tests/mochitest/{mochitest.ini => chrome.ini} (100%) create mode 100644 dom/power/test/chrome.ini delete mode 100644 dom/settings/tests/mochitest.ini create mode 100644 dom/tests/mochitest/geolocation/chrome.ini create mode 100644 dom/tests/mochitest/notification/chrome.ini create mode 100644 dom/tv/test/mochitest/chrome.ini diff --git a/dom/alarm/moz.build b/dom/alarm/moz.build index 5632c12ece1e..96556fb1864f 100644 --- a/dom/alarm/moz.build +++ b/dom/alarm/moz.build @@ -34,4 +34,6 @@ FINAL_LIBRARY = 'xul' MOCHITEST_MANIFESTS += ['test/mochitest.ini'] +MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini'] + XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell.ini'] diff --git a/dom/alarm/test/chrome.ini b/dom/alarm/test/chrome.ini new file mode 100644 index 000000000000..c6a343919d74 --- /dev/null +++ b/dom/alarm/test/chrome.ini @@ -0,0 +1,7 @@ +[DEFAULT] +run-if = buildapp == 'b2g' || buildapp == 'mulet' +support-files = + file_empty.html + system_message_chrome_script.js + +[test_alarm_permitted_app.html] diff --git a/dom/alarm/test/mochitest.ini b/dom/alarm/test/mochitest.ini index 4958fcf701b2..2f8c3d3383c3 100644 --- a/dom/alarm/test/mochitest.ini +++ b/dom/alarm/test/mochitest.ini @@ -1,21 +1,14 @@ [DEFAULT] +run-if = buildapp == 'b2g' || buildapp == 'mulet' support-files = file_empty.html system_message_chrome_script.js [test_alarm_add_data.html] -skip-if = ((buildapp == 'b2g') && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage [test_alarm_add_date.html] -skip-if = ((buildapp == 'b2g') && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage [test_alarm_add_respectTimezone.html] -skip-if = ((buildapp == 'b2g') && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage [test_alarm_non_permitted_app.html] -[test_alarm_permitted_app.html] [test_alarm_remove.html] -skip-if = ((buildapp == 'b2g') && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage [test_bug1015540.html] -skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage [test_bug1037079.html] -skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage [test_bug1090896.html] -skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage diff --git a/dom/alarm/test/test_alarm_permitted_app.html b/dom/alarm/test/test_alarm_permitted_app.html index e07737303518..9df2cb63fc04 100644 --- a/dom/alarm/test/test_alarm_permitted_app.html +++ b/dom/alarm/test/test_alarm_permitted_app.html @@ -2,8 +2,8 @@ Test Permitted Application for Alarm API - - + +

@@ -16,8 +16,6 @@ SimpleTest.waitForExplicitFinish(); SpecialPowers.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() { - SpecialPowers.addPermission("alarms", true, document); - // mozAlarms is installed on all platforms except Android for the moment. if (navigator.appVersion.indexOf("Android") != -1) { try { diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 6a023342974a..bf626e549545 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -118,8 +118,6 @@ #endif #include "mozilla/dom/ContentChild.h" -#include "mozilla/dom/FeatureList.h" - #ifdef MOZ_EME #include "mozilla/EMEUtils.h" #include "mozilla/DetailedPromise.h" @@ -1792,11 +1790,7 @@ Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv) return p.forget(); } - if (IsFeatureDetectible(featureName)) { - p->MaybeResolve(true); - } else { - p->MaybeResolve(JS::UndefinedHandleValue); - } + p->MaybeResolve(JS::UndefinedHandleValue); return p.forget(); } diff --git a/dom/base/test/chrome.ini b/dom/base/test/chrome.ini index e88449f57981..836e6de1bb8c 100644 --- a/dom/base/test/chrome.ini +++ b/dom/base/test/chrome.ini @@ -5,6 +5,7 @@ support-files = file_bug945152.jar file_bug945152_worker.js file_bug1008126_worker.js + mozbrowser_api_utils.js [test_anonymousContent_xul_window.xul] [test_bug715041.xul] @@ -12,6 +13,8 @@ support-files = [test_domrequesthelper.xul] [test_navigator_resolve_identity_xrays.xul] support-files = file_navigator_resolve_identity_xrays.xul +[test_navigator_resolve_identity.html] +support-files = file_navigator_resolve_identity.html [test_sendQueryContentAndSelectionSetEvent.html] [test_bug1016960.html] [test_copypaste.xul] @@ -23,3 +26,6 @@ skip-if = buildapp == 'mulet' [test_bug1008126.html] [test_sandboxed_blob_uri.html] [test_websocket_frame.html] +[test_getFeature_with_perm.html] +[test_hasFeature.html] +[test_mozbrowser_apis_allowed.html] diff --git a/dom/base/test/file_navigator_resolve_identity.html b/dom/base/test/file_navigator_resolve_identity.html new file mode 100644 index 000000000000..0ce127f74be1 --- /dev/null +++ b/dom/base/test/file_navigator_resolve_identity.html @@ -0,0 +1,36 @@ + + + + + + Test for Bug 985827 + + + + + +Mozilla Bug 985827 +

+ +
+
+ + diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index 3eaa3aecf4f1..c676e93e8190 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -677,14 +677,11 @@ skip-if = (toolkit == 'android') || e10s # Android: Bug 775227, e10s: Bug 122647 skip-if = e10s || os != 'linux' || buildapp != 'browser' # Already tests multiprocess [test_getAttribute_after_createAttribute.html] [test_getElementById.html] -[test_getFeature_with_perm.html] -[test_getFeature_without_perm.html] [test_getTranslationNodes.html] [test_getTranslationNodes_limit.html] [test_gsp-qualified.html] [test_gsp-quirks.html] [test_gsp-standards.html] -[test_hasFeature.html] [test_history_document_open.html] [test_history_state_null.html] [test_html_colors_quirks.html] @@ -719,7 +716,6 @@ skip-if = (os != 'b2g' && os != 'android') # meta-viewport tag support is mob skip-if = (os != 'b2g' && os != 'android') # meta-viewport tag support is mobile-only [test_meta_viewport7.html] skip-if = (os != 'b2g' && os != 'android') # meta-viewport tag support is mobile-only -[test_mozbrowser_apis_allowed.html] [test_mozbrowser_apis_blocked.html] [test_mozfiledataurl.html] skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT @@ -729,7 +725,6 @@ skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' #TIME skip-if = buildapp == 'b2g' # b2g(bug 901385, showmodaldialog) b2g-debug(bug 901385, showmodaldialog) b2g-desktop(bug 901385, showmodaldialog) [test_named_frames.html] [test_navigator_hardwareConcurrency.html] -[test_navigator_resolve_identity.html] [test_navigator_language.html] [test_navigatorPrefOverride.html] [test_noAudioNotification.html] diff --git a/dom/base/test/mozbrowser_api_utils.js b/dom/base/test/mozbrowser_api_utils.js index 25845df2afb9..6e19ab2c8099 100644 --- a/dom/base/test/mozbrowser_api_utils.js +++ b/dom/base/test/mozbrowser_api_utils.js @@ -20,12 +20,12 @@ const METHODS = { getCanGoBack: {}, getCanGoForward: {}, getContentDimensions: {}, - setInputMethodActive: { alwaysFails: true }, // needs input-manage - setNFCFocus: { alwaysFails: true }, // needs nfc-manager + setInputMethodActive: {}, + setNFCFocus: {}, findAll: {}, findNext: {}, clearMatch: {}, - executeScript: { alwaysFails: true }, // needs browser:universalxss + executeScript: {}, getWebManifest: {}, mute: {}, unmute: {}, @@ -39,7 +39,7 @@ const ATTRIBUTES = [ ]; function once(target, eventName, useCapture = false) { - info("Waiting for event: '" + eventName + "' on " + target + "."); + info("Waiting for event: '" + JSON.stringify(eventName) + "' on " + target + "."); return new Promise(resolve => { for (let [add, remove] of [ @@ -47,11 +47,13 @@ function once(target, eventName, useCapture = false) { ["addMessageListener", "removeMessageListener"], ]) { if ((add in target) && (remove in target)) { - target[add](eventName, function onEvent(...aArgs) { - info("Got event: '" + eventName + "' on " + target + "."); - target[remove](eventName, onEvent, useCapture); - resolve(aArgs); - }, useCapture); + eventName.forEach(evName => { + target[add](evName, function onEvent(...aArgs) { + info("Got event: '" + evName + "' on " + target + "."); + target[remove](evName, onEvent, useCapture); + resolve(aArgs); + }, useCapture); + }); break; } } @@ -64,7 +66,7 @@ function* loadFrame(attributes = {}) { for (let key in attributes) { iframe.setAttribute(key, attributes[key]); } - let loaded = once(iframe, "load"); + let loaded = once(iframe, [ "load", "mozbrowserloadend" ]); document.body.appendChild(iframe); yield loaded; return iframe; diff --git a/dom/base/test/test_getFeature_with_perm.html b/dom/base/test/test_getFeature_with_perm.html index 0c6fb7b370f0..a95a3ef34fb5 100644 --- a/dom/base/test/test_getFeature_with_perm.html +++ b/dom/base/test/test_getFeature_with_perm.html @@ -6,8 +6,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=979109 Test for Bug 979109 - - + + Mozilla Bug 983502 @@ -114,23 +114,19 @@ function runNextTest() { info("About to run " + tests.length + " tests"); -SpecialPowers.pushPermissions([ - {type: "feature-detection", allow: 1, context: document} -], function() { - ok('getFeature' in navigator, "navigator.getFeature should exist"); - ok('hasFeature' in navigator, "navigator.hasFeature should exist"); - // B2G specific manifest features. - // Touching navigator before pushPermissions makes it fail. - if (!navigator.userAgent.includes("Android") && - /Mobile|Tablet/.test(navigator.userAgent)) { - info("Adding B2G specific tests"); - tests.push(createManifestTest("manifest.chrome.navigation")); - tests.push(createManifestTest("manifest.precompile")); - tests.push(createManifestTest("manifest.role.homescreen")); - } - runNextTest(); - ok(true, "Test DONE"); -}); +ok('getFeature' in navigator, "navigator.getFeature should exist"); +ok('hasFeature' in navigator, "navigator.hasFeature should exist"); +// B2G specific manifest features. +// Touching navigator before pushPermissions makes it fail. +if (!navigator.userAgent.includes("Android") && + /Mobile|Tablet/.test(navigator.userAgent)) { + info("Adding B2G specific tests"); + tests.push(createManifestTest("manifest.chrome.navigation")); + tests.push(createManifestTest("manifest.precompile")); + tests.push(createManifestTest("manifest.role.homescreen")); +} +runNextTest(); +ok(true, "Test DONE"); SimpleTest.waitForExplicitFinish(); diff --git a/dom/base/test/test_getFeature_without_perm.html b/dom/base/test/test_getFeature_without_perm.html deleted file mode 100644 index ff2968008cf1..000000000000 --- a/dom/base/test/test_getFeature_without_perm.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - Test for Bug 979109 - - - - -Mozilla Bug 983502 - - - diff --git a/dom/base/test/test_hasFeature.html b/dom/base/test/test_hasFeature.html index fcc6ca809b6a..37a16c38c1ef 100644 --- a/dom/base/test/test_hasFeature.html +++ b/dom/base/test/test_hasFeature.html @@ -6,8 +6,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1009645 Test for Bug 1009645 - - + + Mozilla Bug 1009645 @@ -27,9 +27,9 @@ function testAPIs() { var APIEndPoints = [ { name: "MozMobileNetworkInfo", enabled: pref("dom.mobileconnection.enabled") }, // { name: "Navigator.mozBluetooth", enabled: b2gOnly }, // conditional on MOZ_B2G_BT, tricky to test - { name: "Navigator.mozContacts", enabled: pref("dom.mozContacts.enabled") }, + // Bug 1266035 { name: "Navigator.mozContacts", enabled: pref("dom.mozContacts.enabled") }, { name: "Navigator.getDeviceStorage", enabled: pref("device.storage.enabled") }, - { name: "Navigator.addIdleObserver", enabled: true }, + // Bug 1266035 { name: "Navigator.addIdleObserver", enabled: true }, { name: "Navigator.mozNetworkStats", enabled: pref("dom.mozNetworkStats.enabled") }, { name: "Navigator.push", enabled: pref("services.push.enabled") }, // { name: "Navigator.mozTime", enabled: b2gOnly }, // conditional on MOZ_TIME_MANAGER, tricky to test diff --git a/dom/base/test/test_mozbrowser_apis_allowed.html b/dom/base/test/test_mozbrowser_apis_allowed.html index f6fa72bb301b..a82b313c09a3 100644 --- a/dom/base/test/test_mozbrowser_apis_allowed.html +++ b/dom/base/test/test_mozbrowser_apis_allowed.html @@ -2,10 +2,10 @@ Verify mozbrowser APIs are allowed with browser permission - - + + - + @@ -18,18 +18,12 @@ }); }); - add_task(function*() { - yield new Promise(resolve => { - SpecialPowers.pushPermissions([ - { "type": "browser", "allow": 1, "context": document } - ], resolve); - }); - }); - add_task(function*() { // Create - - -
-
-
- - diff --git a/dom/bindings/test/test_bug707564.html b/dom/bindings/test/test_bug707564.html index 49a0a0c6bc43..0961c7c4122c 100644 --- a/dom/bindings/test/test_bug707564.html +++ b/dom/bindings/test/test_bug707564.html @@ -1,8 +1,8 @@ - - + + @@ -15,13 +15,8 @@ function run_tests() { } SimpleTest.waitForExplicitFinish(); -onload = function() { - SpecialPowers.pushPermissions([ - {type: "contacts-read", allow: true, context: document}, - {type: "contacts-write", allow: true, context: document}, - {type: "contacts-create", allow: true, context: document}, - ], run_tests); -}; + +addEventListener('load', run_tests); diff --git a/dom/browser-element/mochitest/browserElementTestHelpers.js b/dom/browser-element/mochitest/browserElementTestHelpers.js index 96038a032bb3..b2a72f475530 100644 --- a/dom/browser-element/mochitest/browserElementTestHelpers.js +++ b/dom/browser-element/mochitest/browserElementTestHelpers.js @@ -109,6 +109,7 @@ const browserElementTestHelpers = { // Some basically-empty pages from different domains you can load. 'emptyPage1': 'http://example.com' + _getPath() + '/file_empty.html', + 'fileEmptyPage1': 'file_empty.html', 'emptyPage2': 'http://example.org' + _getPath() + '/file_empty.html', 'emptyPage3': 'http://test1.example.org' + _getPath() + '/file_empty.html', 'focusPage': 'http://example.org' + _getPath() + '/file_focus.html', diff --git a/dom/browser-element/mochitest/browserElement_ActiveStateChange.js b/dom/browser-element/mochitest/browserElement_ActiveStateChange.js index a8ffcc59f792..cfbc1cb1e185 100644 --- a/dom/browser-element/mochitest/browserElement_ActiveStateChange.js +++ b/dom/browser-element/mochitest/browserElement_ActiveStateChange.js @@ -2,9 +2,8 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); -var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_ActiveStateChange.html'; +var fileURL = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_ActiveStateChange.html'; var generator = runTests(); var testFrame; var ac; @@ -78,7 +77,7 @@ function setupTestFrame() { testFrame.removeEventListener('mozbrowserloadend', loadend); ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist"); var channels = testFrame.allowedAudioChannels; - is(channels.length, 1, "1 audio channel by default"); + is(channels.length, 9, "9 audio channel by default"); ac = channels[0]; diff --git a/dom/browser-element/mochitest/browserElement_AudioChannel.js b/dom/browser-element/mochitest/browserElement_AudioChannel.js index 0b889e2d9161..20f7b4e47d3a 100644 --- a/dom/browser-element/mochitest/browserElement_AudioChannel.js +++ b/dom/browser-element/mochitest/browserElement_AudioChannel.js @@ -7,13 +7,12 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function noaudio() { info("Test : no-audio"); var iframe = document.createElement('iframe'); iframe.setAttribute('mozbrowser', 'true'); - iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_empty.html'; + iframe.src = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_empty.html'; function noaudio_loadend() { ok("mute" in iframe, "iframe.mute exists"); @@ -24,7 +23,7 @@ function noaudio() { ok("allowedAudioChannels" in iframe, "allowedAudioChannels exist"); var channels = iframe.allowedAudioChannels; - is(channels.length, 1, "1 audio channel by default"); + is(channels.length, 9, "9 audio channel by default"); var ac = channels[0]; @@ -146,7 +145,7 @@ function audio() { info("Test : audio"); var iframe = document.createElement('iframe'); iframe.setAttribute('mozbrowser', 'true'); - iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/iframe_file_audio.html'; + iframe.src = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/iframe_file_audio.html'; function audio_loadend() { ok("mute" in iframe, "iframe.mute exists"); @@ -157,7 +156,7 @@ function audio() { ok("allowedAudioChannels" in iframe, "allowedAudioChannels exist"); var channels = iframe.allowedAudioChannels; - is(channels.length, 1, "1 audio channel by default"); + is(channels.length, 9, "9 audio channel by default"); var ac = channels[0]; diff --git a/dom/browser-element/mochitest/browserElement_AudioChannelMutedByDefault.js b/dom/browser-element/mochitest/browserElement_AudioChannelMutedByDefault.js index e648b955b679..897c4318aee5 100644 --- a/dom/browser-element/mochitest/browserElement_AudioChannelMutedByDefault.js +++ b/dom/browser-element/mochitest/browserElement_AudioChannelMutedByDefault.js @@ -2,9 +2,8 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); -var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AudioChannelMutedByDefault.html'; +var fileURL = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_AudioChannelMutedByDefault.html'; var testFrame; var ac; @@ -78,7 +77,7 @@ function setupTestFrame() { testFrame.removeEventListener('mozbrowserloadend', loadend); ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist"); var channels = testFrame.allowedAudioChannels; - is(channels.length, 1, "1 audio channel by default"); + is(channels.length, 9, "9 audio channel by default"); ac = channels[0]; ok(ac instanceof BrowserElementAudioChannel, "Correct class"); diff --git a/dom/browser-element/mochitest/browserElement_AudioChannelSeeking.js b/dom/browser-element/mochitest/browserElement_AudioChannelSeeking.js index 775d5cbad559..f354a9d82e68 100644 --- a/dom/browser-element/mochitest/browserElement_AudioChannelSeeking.js +++ b/dom/browser-element/mochitest/browserElement_AudioChannelSeeking.js @@ -2,9 +2,8 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); -var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AudioChannelSeeking.html'; +var fileURL = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_AudioChannelSeeking.html'; var generator = runTests(); var testFrame; var ac; @@ -104,7 +103,7 @@ function setupTestFrame() { testFrame.removeEventListener('mozbrowserloadend', loadend); ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist"); var channels = testFrame.allowedAudioChannels; - is(channels.length, 1, "1 audio channel by default"); + is(channels.length, 9, "9 audio channel by default"); ac = channels[0]; ok(ac instanceof BrowserElementAudioChannel, "Correct class"); diff --git a/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js b/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js index 948f938f6bdd..2ed432b2aacf 100644 --- a/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js +++ b/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js @@ -7,7 +7,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function runTests() { var iframe = document.createElement('iframe'); @@ -22,6 +21,7 @@ function runTests() { } else if (/DONE/.exec(message)) { ok(true, "Messaging from app complete"); iframe.removeEventListener('mozbrowsershowmodalprompt', listener); + SimpleTest.finish(); } } @@ -34,7 +34,7 @@ function runTests() { ok("allowedAudioChannels" in iframe, "allowedAudioChannels exist"); var channels = iframe.allowedAudioChannels; - is(channels.length, 1, "1 audio channel by default"); + is(channels.length, 9, "9 audio channel by default"); var ac = channels[0]; @@ -51,7 +51,6 @@ function runTests() { ac.onactivestatechanged = function() { ok(true, "activestatechanged event received."); ac.onactivestatechanged = null; - SimpleTest.finish(); } } @@ -59,15 +58,7 @@ function runTests() { iframe.addEventListener('mozbrowsershowmodalprompt', listener, false); document.body.appendChild(iframe); - var context = { 'url': 'http://example.org', - 'appId': SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID, - 'isInIsolatedMozBrowserElement': true }; - SpecialPowers.pushPermissions([ - {'type': 'browser', 'allow': 1, 'context': context}, - {'type': 'embed-apps', 'allow': 1, 'context': context} - ], function() { - iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AudioChannel_nested.html'; - }); + iframe.src = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_AudioChannel_nested.html'; } addEventListener('testready', function() { diff --git a/dom/browser-element/mochitest/browserElement_AudioPlayback.js b/dom/browser-element/mochitest/browserElement_AudioPlayback.js index 66642a9d73ba..bcbe89cb104c 100644 --- a/dom/browser-element/mochitest/browserElement_AudioPlayback.js +++ b/dom/browser-element/mochitest/browserElement_AudioPlayback.js @@ -8,7 +8,6 @@ const { Services } = SpecialPowers.Cu.import('resource://gre/modules/Services.js SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); /** * Content script passed to the child iframe @@ -65,7 +64,7 @@ function runTest() { }); // Load a simple page to get the process started. - iframe.src = browserElementTestHelpers.emptyPage1; + iframe.src = browserElementTestHelpers.fileEmptyPage1; } addEventListener('testready', function() { diff --git a/dom/browser-element/mochitest/browserElement_BackForward.js b/dom/browser-element/mochitest/browserElement_BackForward.js index e3739a6948f6..e3d23a81dd39 100644 --- a/dom/browser-element/mochitest/browserElement_BackForward.js +++ b/dom/browser-element/mochitest/browserElement_BackForward.js @@ -7,7 +7,6 @@ "use strict"; SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); var iframe; function addOneShotIframeEventListener(event, fn) { diff --git a/dom/browser-element/mochitest/browserElement_BadScreenshot.js b/dom/browser-element/mochitest/browserElement_BadScreenshot.js index d673a2eb4f62..7b194da868bd 100644 --- a/dom/browser-element/mochitest/browserElement_BadScreenshot.js +++ b/dom/browser-element/mochitest/browserElement_BadScreenshot.js @@ -7,7 +7,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); var iframe; var numPendingTests = 0; diff --git a/dom/browser-element/mochitest/browserElement_DOMRequestError.js b/dom/browser-element/mochitest/browserElement_DOMRequestError.js index 80a97fcc8d42..040cb81fd4ef 100644 --- a/dom/browser-element/mochitest/browserElement_DOMRequestError.js +++ b/dom/browser-element/mochitest/browserElement_DOMRequestError.js @@ -7,7 +7,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function runTest() { var iframe1 = document.createElement('iframe'); diff --git a/dom/browser-element/mochitest/browserElement_DocumentFirstPaint.js b/dom/browser-element/mochitest/browserElement_DocumentFirstPaint.js index 2f2a8ae86017..16618829ef03 100644 --- a/dom/browser-element/mochitest/browserElement_DocumentFirstPaint.js +++ b/dom/browser-element/mochitest/browserElement_DocumentFirstPaint.js @@ -6,7 +6,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); var iframe; diff --git a/dom/browser-element/mochitest/browserElement_Find.js b/dom/browser-element/mochitest/browserElement_Find.js index 03eef4385552..3a496811985c 100644 --- a/dom/browser-element/mochitest/browserElement_Find.js +++ b/dom/browser-element/mochitest/browserElement_Find.js @@ -7,7 +7,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function runTest() { diff --git a/dom/browser-element/mochitest/browserElement_GetContentDimensions.js b/dom/browser-element/mochitest/browserElement_GetContentDimensions.js index 266503b6f0e1..722c42b77a4f 100644 --- a/dom/browser-element/mochitest/browserElement_GetContentDimensions.js +++ b/dom/browser-element/mochitest/browserElement_GetContentDimensions.js @@ -6,7 +6,6 @@ "use strict"; SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); var resizeContent = function() { var innerBox = content.document.getElementById('abox'); diff --git a/dom/browser-element/mochitest/browserElement_GetScreenshot.js b/dom/browser-element/mochitest/browserElement_GetScreenshot.js index 246b628ec846..75d70f04c812 100644 --- a/dom/browser-element/mochitest/browserElement_GetScreenshot.js +++ b/dom/browser-element/mochitest/browserElement_GetScreenshot.js @@ -6,7 +6,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function runTest() { var iframe1 = document.createElement('iframe'); diff --git a/dom/browser-element/mochitest/browserElement_GetScreenshotDppx.js b/dom/browser-element/mochitest/browserElement_GetScreenshotDppx.js index 1debdc602f84..1d61f6afc136 100644 --- a/dom/browser-element/mochitest/browserElement_GetScreenshotDppx.js +++ b/dom/browser-element/mochitest/browserElement_GetScreenshotDppx.js @@ -6,7 +6,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function runTest() { var dppxPref = 'layout.css.devPixelsPerPx'; diff --git a/dom/browser-element/mochitest/browserElement_NextPaint.js b/dom/browser-element/mochitest/browserElement_NextPaint.js index 82b199e16c99..749a8efe3cc3 100644 --- a/dom/browser-element/mochitest/browserElement_NextPaint.js +++ b/dom/browser-element/mochitest/browserElement_NextPaint.js @@ -6,7 +6,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function runTest() { var iframe = document.createElement('iframe'); diff --git a/dom/browser-element/mochitest/browserElement_NoAudioTrack.js b/dom/browser-element/mochitest/browserElement_NoAudioTrack.js index c584247a6bb2..2d163c91a210 100644 --- a/dom/browser-element/mochitest/browserElement_NoAudioTrack.js +++ b/dom/browser-element/mochitest/browserElement_NoAudioTrack.js @@ -2,9 +2,8 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); -var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_NoAudioTrack.html'; +var fileURL = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_NoAudioTrack.html'; var generator = runTests(); var testFrame; @@ -67,7 +66,7 @@ function setupTestFrame() { testFrame.removeEventListener('mozbrowserloadend', loadend); ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist"); var channels = testFrame.allowedAudioChannels; - is(channels.length, 1, "1 audio channel by default"); + is(channels.length, 9, "9 audio channel by default"); var ac = channels[0]; ok(ac instanceof BrowserElementAudioChannel, "Correct class"); diff --git a/dom/browser-element/mochitest/browserElement_OpenMixedProcess.js b/dom/browser-element/mochitest/browserElement_OpenMixedProcess.js index cd19e5199292..c5cde7f50c32 100644 --- a/dom/browser-element/mochitest/browserElement_OpenMixedProcess.js +++ b/dom/browser-element/mochitest/browserElement_OpenMixedProcess.js @@ -20,7 +20,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function runTest() { // We're going to open a remote frame if OOP off by default. If OOP is on by diff --git a/dom/browser-element/mochitest/browserElement_PurgeHistory.js b/dom/browser-element/mochitest/browserElement_PurgeHistory.js index e89e31d5ab4f..dac013518537 100644 --- a/dom/browser-element/mochitest/browserElement_PurgeHistory.js +++ b/dom/browser-element/mochitest/browserElement_PurgeHistory.js @@ -7,7 +7,6 @@ "use strict"; SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); var iframe; function addOneShotIframeEventListener(event, fn) { @@ -22,6 +21,8 @@ function addOneShotIframeEventListener(event, fn) { function runTest() { iframe = document.createElement('iframe'); iframe.setAttribute('mozbrowser', 'true'); + // FIXME: Bug 1270790 + iframe.setAttribute('remote', 'true'); addOneShotIframeEventListener('mozbrowserloadend', function() { SimpleTest.executeSoon(test2); diff --git a/dom/browser-element/mochitest/browserElement_ReloadPostRequest.js b/dom/browser-element/mochitest/browserElement_ReloadPostRequest.js index 3bac01d338c3..614ed7c49753 100644 --- a/dom/browser-element/mochitest/browserElement_ReloadPostRequest.js +++ b/dom/browser-element/mochitest/browserElement_ReloadPostRequest.js @@ -8,7 +8,6 @@ SimpleTest.waitForExplicitFinish(); SimpleTest.requestFlakyTimeout("untriaged"); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); var iframe; var gotConfirmRepost = false; diff --git a/dom/browser-element/mochitest/browserElement_SendEvent.js b/dom/browser-element/mochitest/browserElement_SendEvent.js index 88e65d96fc13..4d5816a18b17 100644 --- a/dom/browser-element/mochitest/browserElement_SendEvent.js +++ b/dom/browser-element/mochitest/browserElement_SendEvent.js @@ -6,7 +6,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function runTest() { var iframe = document.createElement("iframe"); @@ -79,21 +78,7 @@ function runTest() { } }); - iframe.src = "data:text/html," + - "" + - ""; + iframe.src = "file_browserElement_SendEvent.html"; } diff --git a/dom/browser-element/mochitest/browserElement_SetInputMethodActive.js b/dom/browser-element/mochitest/browserElement_SetInputMethodActive.js index 151889ac6b2e..81f933af14ca 100644 --- a/dom/browser-element/mochitest/browserElement_SetInputMethodActive.js +++ b/dom/browser-element/mochitest/browserElement_SetInputMethodActive.js @@ -7,7 +7,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); // We'll need to get the appId from the current document, // it's either SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID when @@ -67,21 +66,19 @@ function createFrames() { // Create an input field to receive string from input method iframes. gInputFrame = document.createElement('iframe'); gInputFrame.setAttribute('mozbrowser', 'true'); - gInputFrame.src = - 'data:text/html,' + - '

This is targetted mozbrowser frame.

'; + gInputFrame.src = 'file_browserElement_SetInputMethodActive.html'; document.body.appendChild(gInputFrame); gInputFrame.addEventListener('mozbrowserloadend', countLoadend); for (let i = 0; i < 2; i++) { - let frame = gInputMethodFrames[i] = document.createElement('iframe'); - frame.setAttribute('mozbrowser', 'true'); - if (currentAppManifestURL) { - frame.setAttribute('mozapp', currentAppManifestURL); - } - frame.src = 'file_empty.html#' + i; - document.body.appendChild(frame); + let frame = gInputMethodFrames[i] = document.createElement('iframe'); + frame.setAttribute('mozbrowser', 'true'); + if (currentAppManifestURL) { + frame.setAttribute('mozapp', currentAppManifestURL); + } frame.addEventListener('mozbrowserloadend', countLoadend); + frame.src = 'file_empty.html#' + i; + document.body.appendChild(frame); } } diff --git a/dom/browser-element/mochitest/browserElement_SetNFCFocus.js b/dom/browser-element/mochitest/browserElement_SetNFCFocus.js index 3332ca347e28..c76a56d3acf8 100644 --- a/dom/browser-element/mochitest/browserElement_SetNFCFocus.js +++ b/dom/browser-element/mochitest/browserElement_SetNFCFocus.js @@ -6,7 +6,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function hasSetNFCFocus() { return new Promise((resolve, reject) => { @@ -22,9 +21,7 @@ function hasSetNFCFocus() { } function runTest() { - SpecialPowers.pushPermissions( - [{ 'type': 'nfc-manager', 'allow': 1, 'context': document }], - () => hasSetNFCFocus().then(SimpleTest.finish)); + hasSetNFCFocus().then(SimpleTest.finish); } addEventListener('testready', runTest); diff --git a/dom/browser-element/mochitest/browserElement_SetVisible.js b/dom/browser-element/mochitest/browserElement_SetVisible.js index cd8ed2a18825..dac8d7e427cd 100644 --- a/dom/browser-element/mochitest/browserElement_SetVisible.js +++ b/dom/browser-element/mochitest/browserElement_SetVisible.js @@ -7,7 +7,6 @@ SimpleTest.waitForExplicitFinish(); SimpleTest.requestFlakyTimeout("untriaged"); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); var iframeScript = function() { content.document.addEventListener("visibilitychange", function() { diff --git a/dom/browser-element/mochitest/browserElement_SetVisibleFrames.js b/dom/browser-element/mochitest/browserElement_SetVisibleFrames.js index 222084e2c896..721248ab9922 100644 --- a/dom/browser-element/mochitest/browserElement_SetVisibleFrames.js +++ b/dom/browser-element/mochitest/browserElement_SetVisibleFrames.js @@ -12,18 +12,10 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); var iframe; function runTest() { - var principal = SpecialPowers.wrap(document).nodePrincipal; - SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec, - originAttributes: { - appId: principal.appId, - inIsolatedMozBrowser: true - }}); - iframe = document.createElement('iframe'); iframe.setAttribute('mozbrowser', 'true'); @@ -75,13 +67,6 @@ function finish() { // expected, but if we don't remove our listener, then we'll end up causing // the /next/ test to fail! iframe.removeEventListener('mozbrowsershowmodalprompt', checkMessage); - - var principal = SpecialPowers.wrap(document).nodePrincipal; - SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec, - originAttributes: { - appId: principal.appId, - inIsolatedMozBrowser: true - }}); SimpleTest.finish(); } diff --git a/dom/browser-element/mochitest/browserElement_SetVisibleFrames2.js b/dom/browser-element/mochitest/browserElement_SetVisibleFrames2.js index 911181c1619c..cf841a4707b0 100644 --- a/dom/browser-element/mochitest/browserElement_SetVisibleFrames2.js +++ b/dom/browser-element/mochitest/browserElement_SetVisibleFrames2.js @@ -8,16 +8,8 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); function runTest() { - var principal = SpecialPowers.wrap(document).nodePrincipal; - SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec, - originAttributes: { - appId: principal.appId, - inIsolatedMozBrowser: true - }}); - var iframe = document.createElement('iframe'); iframe.setAttribute('mozbrowser', 'true'); @@ -57,13 +49,6 @@ function runTest() { } function finish() { - var principal = SpecialPowers.wrap(document).nodePrincipal; - SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec, - originAttributes: { - appId: principal.appId, - inIsolatedMozBrowser: true - }}); - SimpleTest.finish(); } diff --git a/dom/browser-element/mochitest/browserElement_Stop.js b/dom/browser-element/mochitest/browserElement_Stop.js index ff7d5a635412..67720c148df9 100644 --- a/dom/browser-element/mochitest/browserElement_Stop.js +++ b/dom/browser-element/mochitest/browserElement_Stop.js @@ -12,7 +12,6 @@ SimpleTest.waitForExplicitFinish(); SimpleTest.requestFlakyTimeout("untriaged"); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); var iframe; var stopped = false; @@ -21,7 +20,8 @@ var imgSrc = 'http://test/tests/dom/browser-element/mochitest/file_bug709759.sjs function runTest() { iframe = document.createElement('iframe'); iframe.setAttribute('mozbrowser', 'true'); - + // FIXME: Bug 1270790 + iframe.setAttribute('remote', 'true'); iframe.addEventListener('mozbrowserloadend', loadend); iframe.src = 'data:text/html,' + ''; diff --git a/dom/browser-element/mochitest/browserElement_VisibilityChange.js b/dom/browser-element/mochitest/browserElement_VisibilityChange.js index 0107a76c498a..d7db5f45d8dd 100644 --- a/dom/browser-element/mochitest/browserElement_VisibilityChange.js +++ b/dom/browser-element/mochitest/browserElement_VisibilityChange.js @@ -6,7 +6,6 @@ SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); var iframe1 = null; function runTest() { diff --git a/dom/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js b/dom/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js index d8f9f350be49..3657d973226f 100644 --- a/dom/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js +++ b/dom/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js @@ -33,23 +33,12 @@ function runTest() { iframe.setAttribute('mozbrowser', 'true'); iframe.height = '1000px'; + var step1, stepfinish; // The innermost page we load will fire an alert when it successfully loads. iframe.addEventListener('mozbrowsershowmodalprompt', function(e) { switch (e.detail.message) { case 'step 1': - // Make the page wait for us to unblock it (which we do after we finish - // taking the screenshot). - e.preventDefault(); - - iframe.getScreenshot(1000, 1000).onsuccess = function(sshot) { - var fr = new FileReader(); - fr.onloadend = function() { - if (initialScreenshotArrayBuffer == null) - initialScreenshotArrayBuffer = fr.result; - e.detail.unblock(); - }; - fr.readAsArrayBuffer(sshot.target.result); - }; + step1 = SpecialPowers.snapshotWindow(iframe.contentWindow); break; case 'step 2': ok(false, 'cross origin page loaded'); @@ -57,16 +46,9 @@ function runTest() { case 'finish': // The page has now attempted to load the X-Frame-Options page; take // another screenshot. - iframe.getScreenshot(1000, 1000).onsuccess = function(sshot) { - var fr = new FileReader(); - fr.onloadend = function() { - ok(arrayBuffersEqual(fr.result, initialScreenshotArrayBuffer), - "Screenshots should be identical"); - SimpleTest.finish(); - }; - fr.readAsArrayBuffer(sshot.target.result); - }; - break; + stepfinish = SpecialPowers.snapshotWindow(iframe.contentWindow); + ok(step1.toDataURL() == stepfinish.toDataURL(), "Screenshots should be identical"); + SimpleTest.finish(); } }); diff --git a/dom/browser-element/mochitest/browserElement_XFrameOptionsDeny.js b/dom/browser-element/mochitest/browserElement_XFrameOptionsDeny.js index 2ba560494677..bf307cc194ef 100644 --- a/dom/browser-element/mochitest/browserElement_XFrameOptionsDeny.js +++ b/dom/browser-element/mochitest/browserElement_XFrameOptionsDeny.js @@ -36,34 +36,18 @@ function runTest() { // frames. iframe.height = '1000px'; + var step1, stepfinish; iframe.addEventListener('mozbrowsershowmodalprompt', function(e) { switch (e.detail.message) { case 'step 1': - // Make the page wait for us to unblock it (which we do after we finish - // taking the screenshot). - e.preventDefault(); - - iframe.getScreenshot(1000, 1000).onsuccess = function(sshot) { - var fr = new FileReader(); - fr.onloadend = function() { - initialScreenshotArrayBuffer = fr.result; - e.detail.unblock(); - } - fr.readAsArrayBuffer(sshot.target.result); - }; + step1 = SpecialPowers.snapshotWindow(iframe.contentWindow); break; case 'step 2': // The page has now attempted to load the X-Frame-Options page; take // another screenshot. - iframe.getScreenshot(1000, 1000).onsuccess = function(sshot) { - var fr = new FileReader(); - fr.onloadend = function() { - ok(arrayBuffersEqual(fr.result, initialScreenshotArrayBuffer), - "Screenshots should be identical"); - SimpleTest.finish(); - } - fr.readAsArrayBuffer(sshot.target.result); - }; + stepfinish = SpecialPowers.snapshotWindow(iframe.contentWindow); + ok(step1.toDataURL() == stepfinish.toDataURL(), "Screenshots should be identical"); + SimpleTest.finish(); break; } }); diff --git a/dom/browser-element/mochitest/browserElement_getWebManifest.js b/dom/browser-element/mochitest/browserElement_getWebManifest.js index b6605015668c..c2b8f96f35ec 100644 --- a/dom/browser-element/mochitest/browserElement_getWebManifest.js +++ b/dom/browser-element/mochitest/browserElement_getWebManifest.js @@ -6,7 +6,6 @@ 'use strict'; SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); // request to load a manifest from a page that doesn't have a manifest. // The expected result to be null. diff --git a/dom/browser-element/mochitest/chrome.ini b/dom/browser-element/mochitest/chrome.ini index ece4090035db..022165f6a500 100644 --- a/dom/browser-element/mochitest/chrome.ini +++ b/dom/browser-element/mochitest/chrome.ini @@ -1,12 +1,101 @@ [DEFAULT] -skip-if = (buildapp != 'b2g' && buildapp != 'mulet') || (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) +skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || e10s support-files = audio.ogg + async.js + browserElementTestHelpers.js + browserElement_ActiveStateChange.js + browserElement_AudioChannelSeeking.js + browserElement_AudioChannelMutedByDefault.js + browserElement_AudioPlayback.js + browserElement_AudioChannel.js + browserElement_AudioChannel_nested.js + browserElement_BackForward.js + browserElement_BadScreenshot.js + browserElement_DocumentFirstPaint.js + browserElement_DOMRequestError.js + browserElement_ExecuteScript.js + browserElement_Find.js + browserElement_GetContentDimensions.js + browserElement_GetScreenshot.js + browserElement_GetScreenshotDppx.js + browserElement_getWebManifest.js browserElement_MultipleAudioChannels.js + browserElement_NextPaint.js + browserElement_NoAudioTrack.js + browserElement_PurgeHistory.js + browserElement_ReloadPostRequest.js + browserElement_SendEvent.js + browserElement_SetInputMethodActive.js + browserElement_SetNFCFocus.js + browserElement_SetVisible.js + browserElement_SetVisibleFrames.js + browserElement_SetVisibleFrames2.js + browserElement_Stop.js + browserElement_VisibilityChange.js + file_audio.html + file_browserElement_ActiveStateChange.html + file_browserElement_AudioChannelSeeking.html + file_browserElement_AudioChannel_nested.html + file_browserElement_AudioChannelMutedByDefault.html + file_browserElement_ExecuteScript.html file_browserElement_MultipleAudioChannels.html + file_browserElement_NextPaint.html + file_browserElement_NoAudioTrack.html + file_browserElement_SendEvent.html + file_browserElement_SetInputMethodActive.html + file_browserElement_SetVisibleFrames2_Outer.html + file_browserElement_SetVisibleFrames_Inner.html + file_browserElement_SetVisibleFrames_Outer.html + file_bug709759.sjs + file_empty.html + file_post_request.html + file_web_manifest.html + file_web_manifest.json + file_illegal_web_manifest.html + iframe_file_audio.html multipleAudioChannels_manifest.webapp multipleAudioChannels_manifest.webapp^headers^ [test_browserElement_MultipleAudioChannels.html] tags = audiochannel +skip-if = (buildapp != 'b2g' && buildapp != 'mulet') || (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) +[test_browserElement_inproc_ActiveStateChange.html] +tags = audiochannel +[test_browserElement_inproc_AudioChannelMutedByDefault.html] +tags = audiochannel +skip-if = toolkit == 'android' +[test_browserElement_inproc_AudioChannelSeeking.html] +tags = audiochannel +[test_browserElement_inproc_AudioPlayback.html] +[test_browserElement_inproc_AudioChannel.html] +tags = audiochannel +[test_browserElement_inproc_AudioChannel_nested.html] +tags = audiochannel +[test_browserElement_inproc_BackForward.html] +[test_browserElement_inproc_BadScreenshot.html] +[test_browserElement_inproc_DocumentFirstPaint.html] +[test_browserElement_inproc_DOMRequestError.html] +[test_browserElement_inproc_ExecuteScript.html] +[test_browserElement_inproc_Find.html] +[test_browserElement_inproc_GetContentDimensions.html] +[test_browserElement_inproc_GetScreenshot.html] +[test_browserElement_inproc_GetScreenshotDppx.html] +[test_browserElement_inproc_getWebManifest.html] +[test_browserElement_inproc_NextPaint.html] +[test_browserElement_inproc_NoAudioTrack.html] +tags = audiochannel +[test_browserElement_inproc_PurgeHistory.html] +[test_browserElement_inproc_ReloadPostRequest.html] +disabled = no modal prompt on POST reload for chrome window +[test_browserElement_inproc_SendEvent.html] +# The setInputMethodActive() tests will timed out on Android +[test_browserElement_inproc_SetInputMethodActive.html] +skip-if = (os == "android") +[test_browserElement_inproc_SetNFCFocus.html] +[test_browserElement_inproc_SetVisible.html] +[test_browserElement_inproc_SetVisibleFrames.html] +[test_browserElement_inproc_SetVisibleFrames2.html] +[test_browserElement_inproc_Stop.html] +[test_browserElement_inproc_VisibilityChange.html] diff --git a/dom/browser-element/mochitest/file_audio.html b/dom/browser-element/mochitest/file_audio.html index 38ea1c41f3df..0e4a8d7c6abc 100644 --- a/dom/browser-element/mochitest/file_audio.html +++ b/dom/browser-element/mochitest/file_audio.html @@ -1,6 +1,6 @@ -