diff --git a/b2g/chrome/content/desktop.js b/b2g/chrome/content/desktop.js index 311d2e886c8b..9224678503a8 100644 --- a/b2g/chrome/content/desktop.js +++ b/b2g/chrome/content/desktop.js @@ -1,3 +1,6 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ window.addEventListener("ContentStart", function(evt) { // Enable touch event shim on desktop that translates mouse events @@ -5,6 +8,10 @@ window.addEventListener("ContentStart", function(evt) { let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}) .devtools.require; let { TouchEventHandler } = require("devtools/touch-events"); - let touchEventHandler = new TouchEventHandler(shell.contentBrowser); + let chromeEventHandler = window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell) + .chromeEventHandler || window; + let touchEventHandler = new TouchEventHandler(chromeEventHandler); touchEventHandler.start(); }); diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js index 40e90f6e40d6..309e93207a3e 100644 --- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -296,14 +296,22 @@ var shell = { .sessionHistory = Cc["@mozilla.org/browser/shistory;1"] .createInstance(Ci.nsISHistory); + // On firefox mulet, shell.html is loaded in a tab + // and we have to listen on the chrome event handler + // to catch key events + let chromeEventHandler = window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell) + .chromeEventHandler || window; // Capture all key events so we can filter out hardware buttons // And send them to Gaia via mozChromeEvents. // Ideally, hardware buttons wouldn't generate key events at all, or // if they did, they would use keycodes that conform to DOM 3 Events. // See discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=762362 - window.addEventListener('keydown', this, true); - window.addEventListener('keypress', this, true); - window.addEventListener('keyup', this, true); + chromeEventHandler.addEventListener('keydown', this, true); + chromeEventHandler.addEventListener('keypress', this, true); + chromeEventHandler.addEventListener('keyup', this, true); + window.addEventListener('MozApplicationManifest', this); window.addEventListener('mozfullscreenchange', this); window.addEventListener('MozAfterPaint', this); diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 2af547048936..4b1f3126cd22 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 607a820a7c4a..892e06787aa3 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 2af547048936..4b1f3126cd22 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 47e9fb5fb70b..74d2827c120b 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "806d5b997ec768914eaff1c46143c55de2612dbf", + "revision": "630d27e5cff74e12e319572dff2b1acd632dc326", "repo_path": "/integration/gaia-central" } diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 1e7b1af8e91c..ec5f6505aa70 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 332e9691d64d..da0d90b4fdb0 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index d62a083a3d7c..a672f2b1fbc9 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 0f7dd8b008e9..71a605760b84 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index f21eee1c146b..e367db9cfa0c 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 2b70edb0ac1a..9994c3f4cce4 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index a447ed129f9e..0680ac699dae 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -265,7 +265,6 @@ toolbarpaletteitem > #personal-bookmarks > #bookmarks-toolbar-placeholder, display: -moz-box; } -#wrapper-urlbar-container > #urlbar-container > #urlbar-wrapper > #urlbar > toolbarbutton, #urlbar-reload-button:not([displaystop]) + #urlbar-stop-button, #urlbar-reload-button[displaystop] { visibility: collapse; diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index c8efda07d708..a3037379f784 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -6433,10 +6433,10 @@ var gIdentityHandler = { // Chrome URIs however get special treatment. Some chrome URIs are // whitelisted to provide a positive security signal to the user. let chromeWhitelist = ["about:addons", "about:app-manager", "about:config", - "about:crashes", "about:healthreport", "about:home", - "about:newaddon", "about:permissions", "about:preferences", - "about:privatebrowsing", "about:sessionstore", - "about:support", "about:welcomeback"]; + "about:crashes", "about:customizing", "about:healthreport", + "about:home", "about:newaddon", "about:permissions", + "about:preferences", "about:privatebrowsing", + "about:sessionstore", "about:support", "about:welcomeback"]; let lowercaseSpec = uri.spec.toLowerCase(); if (chromeWhitelist.some(function(whitelistedSpec) lowercaseSpec.startsWith(whitelistedSpec))) { this.setMode(this.IDENTITY_MODE_CHROMEUI); diff --git a/browser/components/customizableui/content/aboutCustomizing.xhtml b/browser/components/customizableui/content/aboutCustomizing.xhtml index 9a55f5b5ff6f..14d82d0f99d1 100644 --- a/browser/components/customizableui/content/aboutCustomizing.xhtml +++ b/browser/components/customizableui/content/aboutCustomizing.xhtml @@ -18,6 +18,8 @@ disablefastfind="true"> &customizeMode.tabTitle; + diff --git a/browser/components/sessionstore/src/SessionStore.jsm b/browser/components/sessionstore/src/SessionStore.jsm index 44721d55a6c2..86d65348ca78 100644 --- a/browser/components/sessionstore/src/SessionStore.jsm +++ b/browser/components/sessionstore/src/SessionStore.jsm @@ -607,11 +607,6 @@ let SessionStoreInternal = { receiveMessage: function ssi_receiveMessage(aMessage) { var browser = aMessage.target; var win = browser.ownerDocument.defaultView; - let tab = this._getTabForBrowser(browser); - if (!tab) { - // Ignore messages from elements that are not tabs. - return; - } switch (aMessage.name) { case "SessionStore:pageshow": @@ -635,6 +630,7 @@ let SessionStoreInternal = { case "SessionStore:restoreHistoryComplete": if (this.isCurrentEpoch(browser, aMessage.data.epoch)) { // Notify the tabbrowser that the tab chrome has been restored. + let tab = this._getTabForBrowser(browser); let tabData = browser.__SS_data; // wall-paper fix for bug 439675: make sure that the URL to be loaded @@ -685,6 +681,7 @@ let SessionStoreInternal = { Services.obs.notifyObservers(browser, NOTIFY_TAB_RESTORED, null); } + let tab = this._getTabForBrowser(browser); if (tab) { SessionStoreInternal._resetLocalTabRestoringState(tab); SessionStoreInternal.restoreNextTab(); @@ -706,6 +703,7 @@ let SessionStoreInternal = { break; case "SessionStore:reloadPendingTab": if (this.isCurrentEpoch(browser, aMessage.data.epoch)) { + let tab = this._getTabForBrowser(browser); if (tab && browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) { this.restoreTabContent(tab); } @@ -821,12 +819,6 @@ let SessionStoreInternal = { // internal data about the window. aWindow.__SSi = this._generateWindowID(); - let mm = aWindow.messageManager; - MESSAGES.forEach(msg => mm.addMessageListener(msg, this)); - - // Load the frame script after registering listeners. - mm.loadFrameScript("chrome://browser/content/content-sessionStore.js", true); - // and create its data object this._windows[aWindow.__SSi] = { tabs: [], selected: 0, _closedTabs: [], busy: false }; @@ -1351,6 +1343,12 @@ let SessionStoreInternal = { let browser = aTab.linkedBrowser; BROWSER_EVENTS.forEach(msg => browser.addEventListener(msg, this, true)); + let mm = browser.messageManager; + MESSAGES.forEach(msg => mm.addMessageListener(msg, this)); + + // Load the frame script after registering listeners. + mm.loadFrameScript("chrome://browser/content/content-sessionStore.js", false); + if (!aNoNotification) { this.saveStateDelayed(aWindow); } diff --git a/browser/devtools/scratchpad/scratchpad.js b/browser/devtools/scratchpad/scratchpad.js index 3d1cbc57bb18..49e615c9391f 100644 --- a/browser/devtools/scratchpad/scratchpad.js +++ b/browser/devtools/scratchpad/scratchpad.js @@ -982,6 +982,7 @@ var Scratchpad = { this.editor.setText(content); this.editor.clearHistory(); + this.dirty = false; document.getElementById("sp-cmd-revert").setAttribute("disabled", true); } else if (!aSilentError) { diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_files.js b/browser/devtools/scratchpad/test/browser_scratchpad_files.js index 42fde474e5be..a63a996febf9 100644 --- a/browser/devtools/scratchpad/test/browser_scratchpad_files.js +++ b/browser/devtools/scratchpad/test/browser_scratchpad_files.js @@ -53,6 +53,9 @@ function fileImported(aStatus, aFileContent) is(gScratchpad.getText(), gFileContent, "the editor content is correct"); + is(gScratchpad.dirty, false, + "the editor marks imported file as saved"); + // Save the file after changes. gFileContent += "// omg, saved!"; gScratchpad.editor.setText(gFileContent); diff --git a/browser/metro/base/content/contenthandlers/ContextMenuHandler.js b/browser/metro/base/content/contenthandlers/ContextMenuHandler.js index c894aabbc484..af4c42e9474e 100644 --- a/browser/metro/base/content/contenthandlers/ContextMenuHandler.js +++ b/browser/metro/base/content/contenthandlers/ContextMenuHandler.js @@ -165,6 +165,13 @@ var ContextMenuHandler = { } else { Util.dumpLn("error: target element does not support nsIDOMNSEditableElement"); } + } else if (Util.isEditableContent(this._target)) { + try { + this._target.ownerDocument.execCommand("copy", false); + } catch (ex) { + dump("ContextMenuHandler: exception copying from contentEditable: " + + ex.message + "\n"); + } } else { let selectionText = this._previousState.string; diff --git a/browser/metro/base/tests/mochitest/browser_context_menu_tests.js b/browser/metro/base/tests/mochitest/browser_context_menu_tests.js index cbda54fc4615..f59dc1326f28 100644 --- a/browser/metro/base/tests/mochitest/browser_context_menu_tests.js +++ b/browser/metro/base/tests/mochitest/browser_context_menu_tests.js @@ -744,7 +744,7 @@ gTests.push({ // Case #2: Document isn't in design mode and text is selected. tabWindow.getSelection().selectAllChildren(testSpan); - let promise = waitForEvent(tabWindow.document, "popupshown"); + let promise = waitForEvent(document, "popupshown"); sendContextMenuClickToSelection(tabWindow); yield promise; @@ -758,7 +758,7 @@ gTests.push({ tabWindow.document.designMode = "on"; tabWindow.getSelection().removeAllRanges(); - promise = waitForEvent(tabWindow.document, "popupshown"); + promise = waitForEvent(document, "popupshown"); sendContextMenuClickToElement(tabWindow, testSpan); yield promise; @@ -771,7 +771,7 @@ gTests.push({ // Case #4: Document is in design mode and text is selected. tabWindow.getSelection().selectAllChildren(testSpan); - promise = waitForEvent(tabWindow.document, "popupshown"); + promise = waitForEvent(document, "popupshown"); sendContextMenuClickToSelection(tabWindow); yield promise; @@ -787,6 +787,93 @@ gTests.push({ } }); +gTests.push({ + desc: "Bug 961702 - 'Copy' context menu action does not copy rich content " + + "while document in design mode (or inside container that allows to " + + "edit its content)", + run: function test() { + info(chromeRoot + "browser_context_menu_tests_05.html"); + yield addTab(chromeRoot + "browser_context_menu_tests_05.html"); + + purgeEventQueue(); + emptyClipboard(); + ContextUI.dismiss(); + + yield waitForCondition(() => !ContextUI.navbarVisible); + + let tabWindow = Browser.selectedTab.browser.contentWindow; + let testDiv = tabWindow.document.getElementById("div1"); + + // Case #1: Document is in design mode. + tabWindow.document.designMode = "on"; + + let promise = waitForEvent(document, "popupshown"); + sendContextMenuClickToElement(tabWindow, testDiv); + yield promise; + + let selectAllMenuItem = document.getElementById("context-select-all"); + promise = waitForEvent(document, "popuphidden"); + sendNativeTap(selectAllMenuItem); + yield promise; + + promise = waitForEvent(document, "popupshown"); + sendContextMenuClickToSelection(tabWindow); + yield promise; + + let copyMenuItem = document.getElementById("context-copy"); + promise = waitForEvent(document, "popuphidden"); + sendNativeTap(copyMenuItem); + yield promise; + + // The wait is needed to give time to populate the clipboard. + let clipboardContent = ""; + let contentToCopy = tabWindow.document.body.innerHTML; + yield waitForCondition(function () { + clipboardContent = SpecialPowers.getClipboardData("text/html"); + return clipboardContent == contentToCopy; + }); + ok(clipboardContent == contentToCopy, "Rich content copied."); + + // Case #2: Container with editable content. + emptyClipboard(); + tabWindow.document.designMode = "off"; + tabWindow.getSelection().removeAllRanges(); + + promise = waitForEvent(tabWindow.document.body, "focus"); + sendNativeTap(testDiv); + yield promise; + + promise = waitForEvent(document, "popupshown"); + sendContextMenuClickToElement(tabWindow, testDiv); + yield promise; + + selectAllMenuItem = document.getElementById("context-select-all"); + promise = waitForEvent(document, "popuphidden"); + sendNativeTap(selectAllMenuItem); + yield promise; + + promise = waitForEvent(document, "popupshown"); + sendContextMenuClickToSelection(tabWindow); + yield promise; + + copyMenuItem = document.getElementById("context-copy"); + promise = waitForEvent(document, "popuphidden"); + sendNativeTap(copyMenuItem); + yield promise; + + // The wait is needed to give time to populate the clipboard. + clipboardContent = ""; + contentToCopy = testDiv.innerHTML; + yield waitForCondition(function () { + clipboardContent = SpecialPowers.getClipboardData("text/html"); + return clipboardContent == contentToCopy; + }); + ok(clipboardContent == contentToCopy, "Rich content copied."); + + Browser.closeTab(Browser.selectedTab, { forceClose: true }); + } +}); + function test() { setDevPixelEqualToPx(); runTests(); diff --git a/browser/metro/base/tests/mochitest/browser_context_menu_tests_05.html b/browser/metro/base/tests/mochitest/browser_context_menu_tests_05.html new file mode 100644 index 000000000000..140abd794f7e --- /dev/null +++ b/browser/metro/base/tests/mochitest/browser_context_menu_tests_05.html @@ -0,0 +1,15 @@ + + + + + + + Test text +
+ + +
Test content
+
+ + diff --git a/browser/metro/base/tests/mochitest/metro.ini b/browser/metro/base/tests/mochitest/metro.ini index 6709fd8ceed4..67a1eabad293 100644 --- a/browser/metro/base/tests/mochitest/metro.ini +++ b/browser/metro/base/tests/mochitest/metro.ini @@ -4,6 +4,7 @@ support-files = browser_context_menu_tests_02.html browser_context_menu_tests_03.html browser_context_menu_tests_04.html + browser_context_menu_tests_05.html browser_findbar.html browser_form_auto_complete.html browser_form_selects.html diff --git a/browser/themes/linux/jar.mn b/browser/themes/linux/jar.mn index 06af20e890ec..d4bf09ef9c27 100644 --- a/browser/themes/linux/jar.mn +++ b/browser/themes/linux/jar.mn @@ -27,6 +27,7 @@ browser.jar: skin/classic/browser/customizableui/customizeMode-gridTexture.png (customizableui/customizeMode-gridTexture.png) skin/classic/browser/customizableui/customizeMode-separatorHorizontal.png (customizableui/customizeMode-separatorHorizontal.png) skin/classic/browser/customizableui/customizeMode-separatorVertical.png (customizableui/customizeMode-separatorVertical.png) + skin/classic/browser/customizableui/customizeFavicon.ico (../shared/customizableui/customizeFavicon.ico) * skin/classic/browser/engineManager.css skin/classic/browser/fullscreen-darknoise.png skin/classic/browser/Geolocation-16.png diff --git a/browser/themes/osx/jar.mn b/browser/themes/osx/jar.mn index bcec71771c96..efcffd5eaa57 100644 --- a/browser/themes/osx/jar.mn +++ b/browser/themes/osx/jar.mn @@ -27,6 +27,7 @@ browser.jar: skin/classic/browser/customizableui/customizeMode-gridTexture.png (customizableui/customizeMode-gridTexture.png) skin/classic/browser/customizableui/customizeMode-separatorHorizontal.png (customizableui/customizeMode-separatorHorizontal.png) skin/classic/browser/customizableui/customizeMode-separatorVertical.png (customizableui/customizeMode-separatorVertical.png) + skin/classic/browser/customizableui/customizeFavicon.ico (../shared/customizableui/customizeFavicon.ico) * skin/classic/browser/engineManager.css (engineManager.css) skin/classic/browser/fullscreen-darknoise.png skin/classic/browser/Geolocation-16.png diff --git a/browser/themes/shared/customizableui/customizeFavicon.ico b/browser/themes/shared/customizableui/customizeFavicon.ico new file mode 100644 index 000000000000..c7bd843393e1 Binary files /dev/null and b/browser/themes/shared/customizableui/customizeFavicon.ico differ diff --git a/browser/themes/shared/customizableui/panelUIOverlay.inc.css b/browser/themes/shared/customizableui/panelUIOverlay.inc.css index ae8f1e045c7b..f95773bc7917 100644 --- a/browser/themes/shared/customizableui/panelUIOverlay.inc.css +++ b/browser/themes/shared/customizableui/panelUIOverlay.inc.css @@ -5,7 +5,6 @@ %filter substitution %define menuPanelWidth 22.35em -%define panelTextSize 1rem %define exitSubviewGutterWidth 38px %define buttonStateHover :not(:-moz-any([disabled],[checked="true"],[open],:active)):hover %define buttonStateActive :not([disabled]):-moz-any([open],[checked="true"],:hover:active) @@ -67,16 +66,8 @@ padding: .5em 0; } -toolbaritem[cui-areatype="menu-panel"][sdkstylewidget="true"]:not(.panel-wide-item) > .toolbarbutton-text, -.panelUI-grid .panel-combined-button > .toolbarbutton-text, -.widget-overflow-list .toolbarbutton-menubutton-button > .toolbarbutton-text, -.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-text { - font-size: @panelTextSize@; -} - .panelUI-grid .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text, .panelUI-grid .toolbarbutton-1 > .toolbarbutton-multiline-text { - font-size: @panelTextSize@; margin: 2px 0 0; text-align: center; -moz-hyphens: auto; diff --git a/browser/themes/windows/jar.mn b/browser/themes/windows/jar.mn index 5dedf6e6c941..113db65dd925 100644 --- a/browser/themes/windows/jar.mn +++ b/browser/themes/windows/jar.mn @@ -29,6 +29,7 @@ browser.jar: skin/classic/browser/customizableui/customizeMode-gridTexture.png (customizableui/customizeMode-gridTexture.png) skin/classic/browser/customizableui/customizeMode-separatorHorizontal.png (customizableui/customizeMode-separatorHorizontal.png) skin/classic/browser/customizableui/customizeMode-separatorVertical.png (customizableui/customizeMode-separatorVertical.png) + skin/classic/browser/customizableui/customizeFavicon.ico (../shared/customizableui/customizeFavicon.ico) * skin/classic/browser/engineManager.css skin/classic/browser/fullscreen-darknoise.png skin/classic/browser/Geolocation-16.png diff --git a/content/media/MediaDecoder.cpp b/content/media/MediaDecoder.cpp index 65a6b9f0b3a7..5f811b7a07f6 100644 --- a/content/media/MediaDecoder.cpp +++ b/content/media/MediaDecoder.cpp @@ -1569,9 +1569,9 @@ int64_t MediaDecoder::VideoQueueMemoryInUse() { return 0; } -int64_t MediaDecoder::AudioQueueMemoryInUse() { +size_t MediaDecoder::SizeOfAudioQueue() { if (mDecoderStateMachine) { - return mDecoderStateMachine->AudioQueueMemoryInUse(); + return mDecoderStateMachine->SizeOfAudioQueue(); } return 0; } @@ -1826,7 +1826,7 @@ MediaMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport, DecodersArray& decoders = Decoders(); for (size_t i = 0; i < decoders.Length(); ++i) { video += decoders[i]->VideoQueueMemoryInUse(); - audio += decoders[i]->AudioQueueMemoryInUse(); + audio += decoders[i]->SizeOfAudioQueue(); } #define REPORT(_path, _amount, _desc) \ diff --git a/content/media/MediaDecoder.h b/content/media/MediaDecoder.h index 92817556d2c3..875963ac4088 100644 --- a/content/media/MediaDecoder.h +++ b/content/media/MediaDecoder.h @@ -642,7 +642,7 @@ public: // Returns the size, in bytes, of the heap memory used by the currently // queued decoded video and audio data. virtual int64_t VideoQueueMemoryInUse(); - virtual int64_t AudioQueueMemoryInUse(); + size_t SizeOfAudioQueue(); VideoFrameContainer* GetVideoFrameContainer() MOZ_FINAL MOZ_OVERRIDE { diff --git a/content/media/MediaDecoderReader.h b/content/media/MediaDecoderReader.h index ea96c9c2bc92..6da63e7cb23a 100644 --- a/content/media/MediaDecoderReader.h +++ b/content/media/MediaDecoderReader.h @@ -13,6 +13,7 @@ #include "AudioSampleFormat.h" #include "AbstractMediaDecoder.h" #include "ImageTypes.h" +#include "nsIMemoryReporter.h" struct nsIntRect; @@ -154,6 +155,14 @@ public: MOZ_COUNT_DTOR(AudioData); } + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { + size_t size = aMallocSizeOf(this) + aMallocSizeOf(mAudioData); + if (mAudioBuffer) { + size += mAudioBuffer->SizeOfIncludingThis(aMallocSizeOf); + } + return size; + } + // If mAudioBuffer is null, creates it from mAudioData. void EnsureAudioBuffer(); @@ -582,21 +591,23 @@ public: class AudioQueueMemoryFunctor : public nsDequeFunctor { public: - AudioQueueMemoryFunctor() : mResult(0) {} + AudioQueueMemoryFunctor() : mSize(0) {} + + MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf); virtual void* operator()(void* anObject) { const AudioData* audioData = static_cast(anObject); - mResult += audioData->mFrames * audioData->mChannels * sizeof(AudioDataValue); + mSize += audioData->SizeOfIncludingThis(MallocSizeOf); return nullptr; } - int64_t mResult; + size_t mSize; }; - virtual int64_t AudioQueueMemoryInUse() { + size_t SizeOfAudioQueue() { AudioQueueMemoryFunctor functor; mAudioQueue.LockedForEach(functor); - return functor.mResult; + return functor.mSize; } // Only used by WebMReader and MediaOmxReader for now, so stub here rather diff --git a/content/media/MediaDecoderStateMachine.h b/content/media/MediaDecoderStateMachine.h index b82374b10284..dab2fc111c30 100644 --- a/content/media/MediaDecoderStateMachine.h +++ b/content/media/MediaDecoderStateMachine.h @@ -267,9 +267,9 @@ public: return 0; } - int64_t AudioQueueMemoryInUse() { + size_t SizeOfAudioQueue() { if (mReader) { - return mReader->AudioQueueMemoryInUse(); + return mReader->SizeOfAudioQueue(); } return 0; } diff --git a/content/media/SharedBuffer.h b/content/media/SharedBuffer.h index 68ca65564eb4..083a1779cead 100644 --- a/content/media/SharedBuffer.h +++ b/content/media/SharedBuffer.h @@ -43,6 +43,10 @@ public: return p.forget(); } + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { + return aMallocSizeOf(this); + } + private: SharedBuffer() {} }; diff --git a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp index b0c957a55555..81344cd3eb21 100644 --- a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp @@ -676,6 +676,14 @@ BluetoothA2dpManager::HandleSinkPropertyChanged(const BluetoothSignal& aSignal) BluetoothValue::TArrayOfBluetoothNamedValue); const nsString& address = aSignal.path(); + /** + * Update sink property only if + * - mDeviceAddress is empty (A2dp is disconnected), or + * - this property change is from the connected sink. + */ + NS_ENSURE_TRUE_VOID(mDeviceAddress.IsEmpty() || + mDeviceAddress.Equals(address)); + const InfallibleTArray& arr = aSignal.value().get_ArrayOfBluetoothNamedValue(); MOZ_ASSERT(arr.Length() == 1); diff --git a/dom/bluetooth/bluez/BluetoothA2dpManager.cpp b/dom/bluetooth/bluez/BluetoothA2dpManager.cpp index 5cb7a5913dac..36639df86bfa 100644 --- a/dom/bluetooth/bluez/BluetoothA2dpManager.cpp +++ b/dom/bluetooth/bluez/BluetoothA2dpManager.cpp @@ -257,6 +257,14 @@ BluetoothA2dpManager::HandleSinkPropertyChanged(const BluetoothSignal& aSignal) MOZ_ASSERT(aSignal.value().type() == BluetoothValue::TArrayOfBluetoothNamedValue); const nsString& address = aSignal.path(); + /** + * Update sink property only if + * - mDeviceAddress is empty (A2dp is disconnected), or + * - this property change is from the connected sink. + */ + NS_ENSURE_TRUE_VOID(mDeviceAddress.IsEmpty() || + mDeviceAddress.Equals(address)); + const InfallibleTArray& arr = aSignal.value().get_ArrayOfBluetoothNamedValue(); MOZ_ASSERT(arr.Length() == 1); diff --git a/dom/wifi/WifiProxyService.cpp b/dom/wifi/WifiProxyService.cpp index 16d2697b7099..27626e817f49 100644 --- a/dom/wifi/WifiProxyService.cpp +++ b/dom/wifi/WifiProxyService.cpp @@ -293,8 +293,16 @@ void WifiProxyService::DispatchWifiEvent(const nsAString& aEvent, const nsACString& aInterface) { MOZ_ASSERT(NS_IsMainThread()); + nsAutoString event; + if (StringBeginsWith(aEvent, NS_LITERAL_STRING("IFNAME"))) { + // Jump over IFNAME for gonk-kk. + event = Substring(aEvent, aEvent.FindChar(' ') + 1); + } + else { + event = aEvent; + } // Call the listener. - mListener->OnWaitEvent(aEvent, aInterface); + mListener->OnWaitEvent(event, aInterface); } NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WifiProxyService, diff --git a/dom/wifi/WifiUtils.cpp b/dom/wifi/WifiUtils.cpp index a92ba15a2e66..2fe373959919 100644 --- a/dom/wifi/WifiUtils.cpp +++ b/dom/wifi/WifiUtils.cpp @@ -12,6 +12,7 @@ using namespace mozilla::dom; #define BUFFER_SIZE 4096 +#define COMMAND_SIZE 256 #define PROPERTY_VALUE_MAX 80 // Intentionally not trying to dlclose() this handle. That's playing @@ -237,6 +238,20 @@ public: USE_DLFUNC(wifi_stop_supplicant) return wifi_stop_supplicant(arg); } + + DEFINE_DLFUNC(wifi_command, int32_t, const char*, char*, size_t*) + int32_t do_wifi_command(const char* iface, const char* cmd, char* buf, size_t* len) { + char command[COMMAND_SIZE]; + if (!strcmp(iface, "p2p0")) { + // Commands for p2p0 interface don't need prefix + snprintf(command, COMMAND_SIZE, "%s", cmd); + } + else { + snprintf(command, COMMAND_SIZE, "IFNAME=%s %s", iface, cmd); + } + USE_DLFUNC(wifi_command) + return wifi_command(command, buf, len); + } }; // Concrete class to use to access the wpa supplicant. diff --git a/gfx/2d/SourceSurfaceD2DTarget.cpp b/gfx/2d/SourceSurfaceD2DTarget.cpp index d823e2e2298b..bdca5ffc2719 100644 --- a/gfx/2d/SourceSurfaceD2DTarget.cpp +++ b/gfx/2d/SourceSurfaceD2DTarget.cpp @@ -143,9 +143,14 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT) if (FAILED(hr)) { // This seems to happen for SurfaceFormat::A8 sometimes... - aRT->CreateBitmap(D2D1::SizeU(desc.Width, desc.Height), - D2D1::BitmapProperties(D2DPixelFormat(mFormat)), - byRef(mBitmap)); + hr = aRT->CreateBitmap(D2D1::SizeU(desc.Width, desc.Height), + D2D1::BitmapProperties(D2DPixelFormat(mFormat)), + byRef(mBitmap)); + + if (FAILED(hr)) { + gfxWarning() << "Failed in CreateBitmap. Code: " << hr; + return nullptr; + } RefPtr rt; diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index c2f7f4c27529..bfd0b6b2b8a6 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -685,8 +685,8 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, UpdateRenderTarget(); - // Failed to create a render target. - if (!mDefaultRT || + // Failed to create a render target or the view. + if (!mDefaultRT || !mDefaultRT->mRTView || mSize.width == 0 || mSize.height == 0) { *aRenderBoundsOut = Rect(); return; diff --git a/mobile/android/base/AndroidManifest.xml.in b/mobile/android/base/AndroidManifest.xml.in index 887d7740d88f..53e2aae154a5 100644 --- a/mobile/android/base/AndroidManifest.xml.in +++ b/mobile/android/base/AndroidManifest.xml.in @@ -83,6 +83,8 @@ android:debuggable="true"> #endif +