Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2016-09-29 11:48:33 +02:00
Родитель 7024349851 5b45193594
Коммит c26581a004
214 изменённых файлов: 1584 добавлений и 1719 удалений

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

@ -82,6 +82,7 @@ tasks:
features:
taskclusterProxy: true
chainOfTrust: true
# Note: This task is built server side without the context or tooling that
# exist in tree so we must hard code the version

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

@ -172,7 +172,7 @@ faster: install-dist/idl
endif
.PHONY: tup
tup: install-manifests buildid.h
tup: install-manifests buildid.h source-repo.h
@$(TUP) $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),,--verbose)
# process_install_manifest needs to be invoked with --no-remove when building

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

@ -899,10 +899,8 @@ bin/libfreebl_32int64_3.so
#endif
; media
#ifdef MOZ_EME
@RESPATH@/gmp-clearkey/0.1/@DLL_PREFIX@clearkey@DLL_SUFFIX@
@RESPATH@/gmp-clearkey/0.1/clearkey.info
#endif
#ifdef PKG_LOCALE_MANIFEST
#include @PKG_LOCALE_MANIFEST@

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

@ -972,16 +972,24 @@ pref("security.sandbox.windows.log.stackTraceDepth", 0);
#endif
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX) && defined(MOZ_CONTENT_SANDBOX)
// This pref is discussed in bug 1083344, the naming is inspired from its Windows
// counterpart, but on Mac it's an integer which means:
// This pref is discussed in bug 1083344, the naming is inspired from its
// Windows counterpart, but on Mac it's an integer which means:
// 0 -> "no sandbox"
// 1 -> "an imperfect sandbox designed to allow firefox to run reasonably well"
// 2 -> "an ideal sandbox which may break many things"
// 1 -> "preliminary content sandboxing enabled: write access to
// home directory is prevented"
// 2 -> "preliminary content sandboxing enabled with profile protection:
// write access to home directory is prevented, read and write access
// to ~/Library and profile directories are prevented (excluding
// $PROFILE/{extensions,weave})"
// This setting is read when the content process is started. On Mac the content
// process is killed when all windows are closed, so a change will take effect
// when the 1st window is opened.
#if defined(NIGHTLY_BUILD)
pref("security.sandbox.content.level", 2);
#else
pref("security.sandbox.content.level", 1);
#endif
#endif
#if defined(XP_LINUX) && defined(MOZ_SANDBOX) && defined(MOZ_CONTENT_SANDBOX)
// This pref is introduced as part of bug 742434, the naming is inspired from

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

@ -48,15 +48,22 @@
yield PlacesTestUtils.clearHistory();
// Add some visits.
let timeInMicroseconds = PlacesUtils.toPRTime(Date.now() - 10000);
function newTimeInMicroseconds() {
timeInMicroseconds = timeInMicroseconds + 1000;
return timeInMicroseconds;
}
let vtime = Date.now() * 1000;
const ttype = PlacesUtils.history.TRANSITION_TYPED;
let places =
[{ uri: Services.io.newURI("http://example.tld/", null, null),
visitDate: ++vtime, transition: ttype },
visitDate: newTimeInMicroseconds(), transition: ttype },
{ uri: Services.io.newURI("http://example2.tld/", null, null),
visitDate: ++vtime, transition: ttype },
visitDate: newTimeInMicroseconds(), transition: ttype },
{ uri: Services.io.newURI("http://example3.tld/", null, null),
visitDate: ++vtime, transition: ttype }];
visitDate: newTimeInMicroseconds(), transition: ttype }];
yield PlacesTestUtils.addVisits(places);
@ -85,7 +92,7 @@
is(rc, 3, "Found expected number of rows.");
// First check live-update of the view when adding visits.
places.forEach(place => place.visitDate = ++vtime);
places.forEach(place => place.visitDate = newTimeInMicroseconds());
yield PlacesTestUtils.addVisits(places);
for (let i = 0; i < rc; i++) {

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

@ -5,8 +5,6 @@
<?xml-stylesheet href="chrome://global/skin/global.css"?>
<?xml-stylesheet href="chrome://mozapps/content/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://global/skin/in-content/common.css"?>
<?xml-stylesheet

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

@ -11,11 +11,12 @@ var gSubDialog = {
_frame: null,
_overlay: null,
_box: null,
_injectedStyleSheets: ["chrome://mozapps/content/preferences/preferences.css",
"chrome://browser/skin/preferences/preferences.css",
"chrome://global/skin/in-content/common.css",
"chrome://browser/skin/preferences/in-content/preferences.css",
"chrome://browser/skin/preferences/in-content/dialog.css"],
_injectedStyleSheets: [
"chrome://browser/skin/preferences/preferences.css",
"chrome://global/skin/in-content/common.css",
"chrome://browser/skin/preferences/in-content/preferences.css",
"chrome://browser/skin/preferences/in-content/dialog.css",
],
_resizeObserver: null,
init: function() {

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

@ -150,7 +150,6 @@ var Agent = {
let stateString = JSON.stringify(state);
let data = Encoder.encode(stateString);
let startWriteMs, stopWriteMs;
try {
@ -167,7 +166,7 @@ var Agent = {
File.move(this.Paths.clean, this.Paths.cleanBackup);
}
startWriteMs = Date.now();
let startWriteMs = Date.now();
if (options.isFinalWrite) {
// We are shutting down. At this stage, we know that
@ -198,7 +197,8 @@ var Agent = {
});
}
stopWriteMs = Date.now();
telemetry.FX_SESSION_RESTORE_WRITE_FILE_MS = Date.now() - startWriteMs;
telemetry.FX_SESSION_RESTORE_FILE_SIZE_BYTES = data.byteLength;
} catch (ex) {
// Don't throw immediately
@ -276,10 +276,7 @@ var Agent = {
result: {
upgradeBackup: upgradeBackupComplete
},
telemetry: {
FX_SESSION_RESTORE_WRITE_FILE_MS: stopWriteMs - startWriteMs,
FX_SESSION_RESTORE_FILE_SIZE_BYTES: data.byteLength,
}
telemetry: telemetry,
};
},

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

@ -830,10 +830,8 @@ bin/libfreebl_32int64_3.so
; media
#ifdef MOZ_EME
@RESPATH@/gmp-clearkey/0.1/@DLL_PREFIX@clearkey@DLL_SUFFIX@
@RESPATH@/gmp-clearkey/0.1/clearkey.info
#endif
; gfx
#ifdef XP_WIN

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

@ -346,238 +346,6 @@ menuitem.bookmark-item {
opacity: 0.7;
}
/* Stock icons for the menu bar items */
menuitem:not([type]):not(.menuitem-tooltip):not(.menuitem-iconic-tooltip) {
-moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem-iconic");
}
#placesContext_open\:newwindow,
#menu_newNavigator,
#context-openlink,
#context-openframe {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
-moz-image-region: rect(0px 80px 16px 64px);
}
#placesContext_open\:newtab,
#placesContext_openContainer\:tabs,
#menu_newNavigatorTab,
#context-openlinkintab,
#context-openlinkincontainertab,
#context-openframeintab {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
-moz-image-region: rect(0px 64px 16px 48px);
}
#menu_openFile {
list-style-image: url("moz-icon://stock/gtk-open?size=menu");
}
#menu_close {
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
}
#context-media-play {
list-style-image: url("moz-icon://stock/gtk-media-play?size=menu");
}
#context-media-pause {
list-style-image: url("moz-icon://stock/gtk-media-pause?size=menu");
}
#menu_savePage,
#context-savelink,
#context-saveimage,
#context-savevideo,
#context-saveaudio,
#context-savepage,
#context-saveframe {
list-style-image: url("moz-icon://stock/gtk-save-as?size=menu");
}
#menu_printPreview {
list-style-image: url("moz-icon://stock/gtk-print-preview?size=menu");
}
#menu_print,
#context-printframe {
list-style-image: url("moz-icon://stock/gtk-print?size=menu");
}
#menu_FileQuitItem {
list-style-image: url("moz-icon://stock/gtk-quit?size=menu");
}
#menu_undo,
#context-undo {
list-style-image: url("moz-icon://stock/gtk-undo?size=menu");
}
#menu_undo[disabled],
#context-undo[disabled] {
list-style-image: url("moz-icon://stock/gtk-undo?size=menu&state=disabled");
}
#menu_redo {
list-style-image: url("moz-icon://stock/gtk-redo?size=menu");
}
#menu_redo[disabled] {
list-style-image: url("moz-icon://stock/gtk-redo?size=menu&state=disabled");
}
#menu_cut,
#placesContext_cut,
#context-cut {
list-style-image: url("moz-icon://stock/gtk-cut?size=menu");
}
#menu_cut[disabled],
#placesContext_cut[disabled],
#context-cut[disabled] {
list-style-image: url("moz-icon://stock/gtk-cut?size=menu&state=disabled");
}
#menu_copy,
#placesContext_copy,
#context-copy,
#context-copyimage,
#context-copyvideourl,
#context-copyaudiourl,
#context-copylink,
#context-copyemail {
list-style-image: url("moz-icon://stock/gtk-copy?size=menu");
}
#menu_copy[disabled],
#placesContext_copy[disabled],
#context-copy[disabled] {
list-style-image: url("moz-icon://stock/gtk-copy?size=menu&state=disabled");
}
#menu_paste,
#placesContext_paste,
#context-paste {
list-style-image: url("moz-icon://stock/gtk-paste?size=menu");
}
#menu_paste[disabled],
#placesContext_paste[disabled],
#context-paste[disabled] {
list-style-image: url("moz-icon://stock/gtk-paste?size=menu&state=disabled");
}
#menu_delete,
#placesContext_delete,
#placesContext_delete_history,
#context-delete {
list-style-image: url("moz-icon://stock/gtk-delete?size=menu");
}
#menu_delete[disabled],
#placesContext_delete[disabled],
#placesContext_delete_history[disabled],
#context-delete[disabled] {
list-style-image: url("moz-icon://stock/gtk-delete?size=menu&state=disabled");
}
#menu_selectAll,
#context-selectall {
list-style-image: url("moz-icon://stock/gtk-select-all?size=menu");
}
#menu_find {
list-style-image: url("moz-icon://stock/gtk-find?size=menu");
}
#menu_find[disabled] {
list-style-image: url("moz-icon://stock/gtk-find?size=menu&state=disabled");
}
#menu_preferences {
list-style-image: url("moz-icon://stock/gtk-preferences?size=menu");
}
#placesContext_reload,
#context-reloadframe {
list-style-image: url("moz-icon://stock/gtk-refresh?size=menu");
}
#menu_zoomEnlarge {
list-style-image: url("moz-icon://stock/gtk-zoom-in?size=menu");
}
#menu_zoomReduce {
list-style-image: url("moz-icon://stock/gtk-zoom-out?size=menu");
}
#menu_zoomReset {
list-style-image: url("moz-icon://stock/gtk-zoom-100?size=menu");
}
#menu_showAllHistory {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
-moz-image-region: rect(0px 32px 16px 16px);
}
#bookmarksShowAll {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
-moz-image-region: rect(0px 48px 16px 32px);
}
#subscribeToPageMenuitem:not([disabled]),
#subscribeToPageMenupopup {
list-style-image: url("chrome://browser/skin/page-livemarks.png");
}
#bookmarksToolbarFolderMenu,
#BMB_bookmarksToolbar,
#panelMenu_bookmarksToolbar {
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
}
#menu_unsortedBookmarks,
#BMB_unsortedBookmarks,
#panelMenu_unsortedBookmarks {
list-style-image: url("chrome://browser/skin/places/unsortedBookmarks.png");
}
#menu_openDownloads {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
-moz-image-region: rect(0px 16px 16px 0px);
}
#menu_openAddons {
list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric-16.png");
}
#menu_pageInfo,
#context-viewinfo,
#context-viewframeinfo {
list-style-image: url("moz-icon://stock/gtk-info?size=menu");
}
#placesContext_open\:newprivatewindow,
#privateBrowsingItem {
list-style-image: url("chrome://browser/skin/Privacy-16.png");
}
#placesContext_show\:info {
list-style-image: url("moz-icon://stock/gtk-properties?size=menu");
}
#sanitizeItem {
list-style-image: url("moz-icon://stock/gtk-clear?size=menu");
}
#menu_openHelp {
list-style-image: url("moz-icon://stock/gtk-help?size=menu");
}
#aboutName {
list-style-image: url("moz-icon://stock/gtk-about?size=menu");
}
/* Primary toolbar buttons */
:-moz-any(toolbar, .widget-overflow-list) .toolbarbutton-1 > .toolbarbutton-icon,
@ -1866,7 +1634,6 @@ notification.pluginVulnerable > .notification-inner > .messageCloseButton:not(:h
%include ../shared/contextmenu.inc.css
#context-navigation > .menuitem-iconic > .menu-iconic-left {
visibility: visible;
/* override toolkit/themes/linux/global/menu.css */
padding-inline-end: 0 !important;
margin-inline-end: 0 !important;
@ -1880,7 +1647,3 @@ notification.pluginVulnerable > .notification-inner > .messageCloseButton:not(:h
.webextension-popup-browser {
border-radius: inherit;
}
.menuitem-iconic[usercontextid] > .menu-iconic-left > .menu-iconic-icon {
visibility: visible;
}

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

@ -265,16 +265,3 @@ treechildren::-moz-tree-cell-text(broken) {
#securityPanel row {
-moz-box-align: center;
}
/* Icons for context menus */
menuitem:not([type]) {
-moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem-iconic");
}
#menu_selectall {
list-style-image: url("moz-icon://stock/gtk-select-all?size=menu");
}
#menu_copy {
list-style-image: url("moz-icon://stock/gtk-copy?size=menu");
}

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

@ -90,19 +90,6 @@
padding-inline-start: 2px;
}
/**** menuitem stock icons ****/
#orgClose {
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
}
#fileImport {
list-style-image: url("moz-icon://stock/gtk-revert-to-saved?size=menu");
}
#fileExport {
list-style-image: url("moz-icon://stock/gtk-save-as?size=menu");
}
/**
* Downloads pane
*/

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

@ -120,102 +120,3 @@ treechildren::-moz-tree-image(cutting) {
treechildren::-moz-tree-cell-text(cutting) {
opacity: 0.7;
}
/**** menuitem stock icons ****/
menuitem:not([type]) {
-moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem-iconic");
}
menuitem[command="cmd_cut"],
menuitem[cmd="cmd_cut"] {
list-style-image: url("moz-icon://stock/gtk-cut?size=menu");
}
menuitem[command="cmd_cut"][disabled],
menuitem[cmd="cmd_cut"][disabled] {
list-style-image: url("moz-icon://stock/gtk-cut?size=menu&state=disabled");
}
menuitem[command="cmd_copy"],
menuitem[cmd="cmd_copy"] {
list-style-image: url("moz-icon://stock/gtk-copy?size=menu");
}
menuitem[command="cmd_copy"][disabled],
menuitem[cmd="cmd_copy"][disabled] {
list-style-image: url("moz-icon://stock/gtk-copy?size=menu&state=disabled");
}
menuitem[command="cmd_paste"],
menuitem[cmd="cmd_paste"] {
list-style-image: url("moz-icon://stock/gtk-paste?size=menu");
}
menuitem[command="cmd_paste"][disabled],
menuitem[cmd="cmd_paste"][disabled] {
list-style-image: url("moz-icon://stock/gtk-paste?size=menu&state=disabled");
}
menuitem[command="cmd_delete"],
menuitem[cmd="cmd_delete"] {
list-style-image: url("moz-icon://stock/gtk-delete?size=menu");
}
menuitem[command="cmd_delete"][disabled],
menuitem[cmd="cmd_delete"][disabled] {
list-style-image: url("moz-icon://stock/gtk-delete?size=menu&state=disabled");
}
menuitem[command="cmd_undo"],
menuitem[cmd="cmd_undo"] {
list-style-image: url("moz-icon://stock/gtk-undo?size=menu");
}
menuitem[command="cmd_undo"][disabled],
menuitem[cmd="cmd_undo"][disabled] {
list-style-image: url("moz-icon://stock/gtk-undo?size=menu&state=disabled");
}
menuitem[command="cmd_redo"] {
list-style-image: url("moz-icon://stock/gtk-redo?size=menu");
}
menuitem[command="cmd_redo"][disabled] {
list-style-image: url("moz-icon://stock/gtk-redo?size=menu&state=disabled");
}
menuitem[command="cmd_selectAll"],
menuitem[cmd="cmd_selectAll"] {
list-style-image: url("moz-icon://stock/gtk-select-all?size=menu");
}
menuitem[command="cmd_selectAll"][disabled],
menuitem[cmd="cmd_selectAll"][disabled] {
list-style-image: url("moz-icon://stock/gtk-select-all?size=menu&state=disabled");
}
#placesContext_open\:newwindow,
menuitem[command="placesCmd_open:window"] {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
-moz-image-region: rect(0px 80px 16px 64px);
}
#placesContext_open\:newprivatewindow,
menuitem[command="placesCmd_open:privatewindow"] {
list-style-image: url("chrome://browser/skin/Privacy-16.png");
}
#placesContext_open\:newtab,
menuitem[command="placesCmd_open:tab"] {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
-moz-image-region: rect(0px 64px 16px 48px);
}
#placesContext_show\:info,
menuitem[command="placesCmd_show:info"] {
list-style-image: url("moz-icon://stock/gtk-properties?size=menu");
}
#placesContext_reload {
list-style-image: url("moz-icon://stock/gtk-refresh?size=menu");
}

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

@ -7,7 +7,7 @@
@depends(target)
def force_system_ffi(target):
# Pre-emptively move to system ffi for non-tier one platforms.
if target.cpu not in ('x86', 'x86_64', 'arm'):
if target.cpu not in ('x86', 'x86_64', 'arm', 'aarch64'):
return True
imply_option('--with-system-ffi', force_system_ffi, "target")
@ -28,7 +28,7 @@ add_old_configure_assignment('MOZ_SYSTEM_FFI', system_ffi)
# Target selection, based on ffi/configure.ac.
@depends_when(target, when=building_ffi)
def ffi_target(target):
if target.cpu not in ('x86', 'x86_64', 'arm'):
if target.cpu not in ('x86', 'x86_64', 'arm', 'aarch64'):
die('Building libffi from the tree is not supported on this platform. '
'Use --with-system-ffi instead.')
@ -44,6 +44,9 @@ def ffi_target(target):
elif target.cpu == 'arm':
target_dir = 'arm'
target_name = 'ARM'
elif target.cpu == 'aarch64':
target_dir = 'aarch64'
target_name = 'AARCH64'
else:
target_dir = 'x86'
target_name = target.cpu.upper()

5
config/external/ffi/moz.build поставляемый
Просмотреть файл

@ -4,10 +4,11 @@
# 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/.
FINAL_LIBRARY = 'js'
if CONFIG['MOZ_SYSTEM_FFI']:
OS_LIBS += CONFIG['MOZ_FFI_LIBS']
else:
FINAL_LIBRARY = 'js'
ALLOW_COMPILER_WARNINGS = True
NO_VISIBILITY_FLAGS = True
@ -77,6 +78,8 @@ else:
ffi_srcs = ('sysv.S', 'ffi.c')
if CONFIG['CLANG_CXX']:
ASFLAGS += ['-no-integrated-as']
elif CONFIG['FFI_TARGET'] == 'AARCH64':
ffi_srcs = ('sysv.S', 'ffi.c')
elif CONFIG['FFI_TARGET'] == 'X86':
ffi_srcs = ('ffi.c', 'sysv.S', 'win32.S')
elif CONFIG['FFI_TARGET'] == 'X86_64':

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

@ -6,6 +6,12 @@
const TEST_URI = "data:text/html;charset=utf-8,gcli-commands";
const HUDService = require("devtools/client/webconsole/hudservice");
// Use the old webconsole since pprint isn't working on new one (Bug 1304794)
Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", false);
registerCleanupFunction(function* () {
Services.prefs.clearUserPref("devtools.webconsole.new-frontend-enabled");
});
function test() {
return Task.spawn(spawnTest).then(finish, helpers.handleError);
}

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

@ -13,11 +13,14 @@ var gTab, gPanel, gDebugger;
var gPrefs, gOptions;
function test() {
let options = {
source: TAB_URL,
line: 1
};
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
Task.spawn(function* () {
let options = {
source: TAB_URL,
line: 1
};
let [aTab,, aPanel] = yield initDebugger(TAB_URL, options);
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
@ -28,7 +31,7 @@ function test() {
gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false });
testInstrumentsPaneCollapse();
yield testInstrumentsPaneCollapse();
testPanesStartupPref();
closeDebuggerAndFinish(gPanel);
@ -50,7 +53,7 @@ function testPanesState() {
"The options menu item should not be checked.");
}
function testInstrumentsPaneCollapse() {
function* testInstrumentsPaneCollapse () {
let instrumentsPane =
gDebugger.document.getElementById("instruments-pane");
let instrumentsPaneToggleButton =
@ -69,8 +72,13 @@ function testInstrumentsPaneCollapse() {
!instrumentsPaneToggleButton.classList.contains("pane-collapsed"),
"The instruments pane should at this point be visible.");
// Trigger reflow to make sure the UI is in required state.
gDebugger.document.documentElement.getBoundingClientRect();
gDebugger.DebuggerView.toggleInstrumentsPane({ visible: false, animated: true });
yield once(instrumentsPane, "transitionend");
is(gPrefs.panesVisibleOnStartup, false,
"The debugger view panes should still initially be preffed as hidden.");
isnot(gOptions._showPanesOnStartupItem.getAttribute("checked"), "true",
@ -83,7 +91,8 @@ function testInstrumentsPaneCollapse() {
"The instruments pane has an incorrect left margin after collapsing.");
is(instrumentsPane.style.marginRight, margin,
"The instruments pane has an incorrect right margin after collapsing.");
ok(instrumentsPane.hasAttribute("animated"),
ok(!instrumentsPane.hasAttribute("animated"),
"The instruments pane has an incorrect attribute after an animated collapsing.");
ok(instrumentsPane.classList.contains("pane-collapsed") &&
instrumentsPaneToggleButton.classList.contains("pane-collapsed"),

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

@ -7,6 +7,8 @@
const PAGE_URL = "data:text/html;charset=utf-8,test select events";
requestLongerTimeout(2);
add_task(function* () {
let tab = yield addTab(PAGE_URL);

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

@ -335,6 +335,7 @@ Toolbox.prototype = {
get splitConsole() {
return this._splitConsole;
},
/**
* Get the focused state of the split console
*/
@ -1267,6 +1268,16 @@ Toolbox.prototype = {
// backward compatibility with existing extensions do a check
// for a promise return value.
let built = definition.build(iframe.contentWindow, this);
// Set the dir attribute on the documents of panels using HTML.
let docEl = iframe.contentWindow && iframe.contentWindow.document.documentElement;
if (docEl && docEl.namespaceURI === HTML_NS) {
let top = this.win.top;
let topDocEl = top.document.documentElement;
let isRtl = top.getComputedStyle(topDocEl).direction === "rtl";
docEl.setAttribute("dir", isRtl ? "rtl" : "ltr");
}
if (!(typeof built.then == "function")) {
let panel = built;
iframe.panel = panel;

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

@ -138,7 +138,7 @@ function CssComputedView(inspector, document, pageStyle) {
this.propertyViews = [];
let cssProperties = getCssProperties(inspector.toolbox);
this._outputParser = new OutputParser(document, cssProperties.supportsType);
this._outputParser = new OutputParser(document, cssProperties);
// Create bound methods.
this.focusWindow = this.focusWindow.bind(this);

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

@ -430,8 +430,6 @@ MarkupView.prototype = {
/**
* Hide the box model highlighter on a given node front
*
* @param {NodeFront} nodeFront
* The node to hide the highlighter for
* @param {Boolean} forceHide
* See toolbox-highlighter-utils/unhighlight
* @return {Promise} Resolves when the highlighter for this nodeFront is

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

@ -52,6 +52,7 @@ function TextProperty(rule, name, value, priority, enabled = true,
this.priority = priority;
this.enabled = !!enabled;
this.invisible = invisible;
this.panelDoc = this.rule.elementStyle.ruleView.inspector.panelDoc;
const toolbox = this.rule.elementStyle.ruleView.inspector.toolbox;
this.cssProperties = getCssProperties(toolbox);
@ -204,7 +205,7 @@ TextProperty.prototype = {
// compute validity locally (which might not be correct, but better than
// nothing).
if (!this.rule.domRule.declarations) {
return domUtils.cssPropertyIsValid(this.name, this.value);
return this.cssProperties.isValidOnClient(this.name, this.value, this.panelDoc);
}
let selfIndex = this.rule.textProps.indexOf(this);

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

@ -105,7 +105,7 @@ function CssRuleView(inspector, document, store, pageStyle) {
this.cssProperties = getCssProperties(inspector.toolbox);
this._outputParser = new OutputParser(document, this.cssProperties.supportsType);
this._outputParser = new OutputParser(document, this.cssProperties);
this._onAddRule = this._onAddRule.bind(this);
this._onContextMenu = this._onContextMenu.bind(this);

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

@ -199,6 +199,7 @@ subsuite = clipboard
[browser_rules_selector-highlighter_01.js]
[browser_rules_selector-highlighter_02.js]
[browser_rules_selector-highlighter_03.js]
[browser_rules_selector-highlighter_04.js]
[browser_rules_selector_highlight.js]
[browser_rules_strict-search-filter-computed-list_01.js]
[browser_rules_strict-search-filter_01.js]

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

@ -76,9 +76,3 @@ add_task(function* () {
is(HighlighterFront.options.selector, "body",
"The right selector option is passed to the highlighter (2)");
});
function* clickSelectorIcon(icon, view) {
let onToggled = view.once("ruleview-selectorhighlighter-toggled");
EventUtils.synthesizeMouseAtCenter(icon, {}, view.styleWindow);
yield onToggled;
}

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

@ -76,9 +76,3 @@ add_task(function* () {
ok(!HighlighterFront.isShown,
"The highlighter is hidden now that the same selector was clicked");
});
function* clickSelectorIcon(icon, view) {
let onToggled = view.once("ruleview-selectorhighlighter-toggled");
EventUtils.synthesizeMouseAtCenter(icon, {}, view.styleWindow);
yield onToggled;
}

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

@ -0,0 +1,53 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that the selector highlighter is shown when clicking on a selector icon
// for the 'element {}' rule
// Note that in this test, we mock the highlighter front, merely testing the
// behavior of the style-inspector UI for now
const TEST_URI = `
<p>Testing the selector highlighter for the 'element {}' rule</p>
`;
add_task(function* () {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
// Mock the highlighter front to get the reference of the NodeFront
let HighlighterFront = {
isShown: false,
nodeFront: null,
options: null,
show: function (nodeFront, options) {
this.nodeFront = nodeFront;
this.options = options;
this.isShown = true;
},
hide: function () {
this.nodeFront = null;
this.options = null;
this.isShown = false;
}
};
// Inject the mock highlighter in the rule-view
view.selectorHighlighter = HighlighterFront;
info("Checking that the right NodeFront reference and options are passed");
yield selectNode("p", inspector);
let icon = getRuleViewSelectorHighlighterIcon(view, "element");
yield clickSelectorIcon(icon, view);
is(HighlighterFront.nodeFront.tagName, "P",
"The right NodeFront is passed to the highlighter (1)");
is(HighlighterFront.options.selector, "body > p:nth-child(1)",
"The right selector option is passed to the highlighter (1)");
ok(HighlighterFront.isShown, "The toggle event says the highlighter is visible");
yield clickSelectorIcon(icon, view);
ok(!HighlighterFront.isShown, "The toggle event says the highlighter is not visible");
});

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

@ -817,6 +817,17 @@ function waitForStyleModification(inspector) {
});
}
/**
* Click on the selector icon
* @param {DOMNode} icon
* @param {CSSRuleView} view
*/
function* clickSelectorIcon(icon, view) {
let onToggled = view.once("ruleview-selectorhighlighter-toggled");
EventUtils.synthesizeMouseAtCenter(icon, {}, view.styleWindow);
yield onToggled;
}
/**
* Make sure window is properly focused before sending a key event.
* @param {Window} win

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

@ -149,9 +149,10 @@ RuleEditor.prototype = {
});
}
if (this.rule.domRule.type !== CSSRule.KEYFRAME_RULE &&
this.rule.domRule.selectors) {
let selector = this.rule.domRule.selectors.join(", ");
if (this.rule.domRule.type !== CSSRule.KEYFRAME_RULE) {
let selector = this.rule.domRule.selectors
? this.rule.domRule.selectors.join(", ")
: this.ruleView.inspector.selectionCssSelector;
let selectorHighlighter = createChild(header, "span", {
class: "ruleview-selectorhighlighter" +

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

@ -31,6 +31,7 @@ const EventEmitter = require("devtools/shared/event-emitter");
const promise = require("promise");
const {Task} = require("devtools/shared/task");
const Services = require("Services");
const {getCssProperties} = require("devtools/shared/fronts/css-properties");
const PREF_IMAGE_TOOLTIP_SIZE = "devtools.inspector.imagePreviewTooltipSize";
@ -262,6 +263,7 @@ function TooltipsOverlay(view) {
let {CssRuleView} = require("devtools/client/inspector/rules/rules");
this.isRuleView = view instanceof CssRuleView;
this._cssProperties = getCssProperties(this.view.inspector.toolbox);
this._onNewSelection = this._onNewSelection.bind(this);
this.view.inspector.selection.on("new-node-front", this._onNewSelection);
@ -305,7 +307,8 @@ TooltipsOverlay.prototype = {
// Cubic bezier tooltip
this.cubicBezier = new SwatchCubicBezierTooltip(toolbox);
// Filter editor tooltip
this.filterEditor = new SwatchFilterTooltip(toolbox);
this.filterEditor = new SwatchFilterTooltip(toolbox,
this._cssProperties.getValidityChecker(this.view.inspector.panelDoc));
}
this._isStarted = true;

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

@ -302,7 +302,7 @@ add_task(function* () {
yield initCssProperties(toolbox);
let cssProperties = getCssProperties(toolbox);
let parser = new OutputParser(document, cssProperties.supportsType);
let parser = new OutputParser(document, cssProperties);
for (let i = 0; i < TEST_DATA.length; i++) {
let data = TEST_DATA[i];
info("Output-parser test data " + i + ". {" + data.name + " : " +

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

@ -11,6 +11,13 @@ registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.toolbox.splitconsoleEnabled");
});
// Use the old webconsole since the node isn't being rendered as an HTML tag
// in the new one (Bug 1304794)
Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", false);
registerCleanupFunction(function* () {
Services.prefs.clearUserPref("devtools.webconsole.new-frontend-enabled");
});
add_task(function* () {
let { inspector, toolbox } = yield openInspectorForURL(TEST_URL);

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

@ -4,9 +4,6 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % globalDTD
SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
@ -19,7 +16,7 @@
<link rel="stylesheet" href="chrome://devtools/skin/components-frame.css" type="text/css"/>
<link rel="stylesheet" href="chrome://devtools/skin/components-h-split-box.css" type="text/css"/>
</head>
<body class="theme-body" dir="&locale.dir;">
<body class="theme-body">
<div id="app"></div>
<script type="application/javascript;version=1.8"

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

@ -34,8 +34,13 @@ add_task(function* () {
!detailsPaneToggleButton.classList.contains("pane-collapsed"),
"The details pane should at this point be visible.");
// Trigger reflow to make sure the UI is in required state.
document.documentElement.getBoundingClientRect();
NetMonitorView.toggleDetailsPane({ visible: false, animated: true });
yield once(detailsPane, "transitionend");
let margin = -(width + 1) + "px";
is(width, Prefs.networkDetailsWidth,
"The details pane has an incorrect width after collapsing.");
@ -43,7 +48,7 @@ add_task(function* () {
"The details pane has an incorrect left margin after collapsing.");
is(detailsPane.style.marginRight, margin,
"The details pane has an incorrect right margin after collapsing.");
ok(detailsPane.hasAttribute("animated"),
ok(!detailsPane.hasAttribute("animated"),
"The details pane has an incorrect attribute after an animated collapsing.");
ok(detailsPane.classList.contains("pane-collapsed") &&
detailsPaneToggleButton.classList.contains("pane-collapsed"),

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

@ -3,6 +3,11 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/* Bug 661762 */
// Use the old webconsole since scratchpad focus isn't working on new one (Bug 1304794)
Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", false);
registerCleanupFunction(function* () {
Services.prefs.clearUserPref("devtools.webconsole.new-frontend-enabled");
});
function test()
{

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

@ -7,26 +7,26 @@
display: block;
}
.sidebar-toggle:-moz-locale-dir(ltr)::before,
.sidebar-toggle.pane-collapsed:-moz-locale-dir(rtl)::before {
.sidebar-toggle::before,
.sidebar-toggle.pane-collapsed:dir(rtl)::before {
background-image: var(--theme-pane-collapse-image);
}
.sidebar-toggle.pane-collapsed:-moz-locale-dir(ltr)::before,
.sidebar-toggle:-moz-locale-dir(rtl)::before {
.sidebar-toggle.pane-collapsed::before,
.sidebar-toggle:dir(rtl)::before {
background-image: var(--theme-pane-expand-image);
}
/* Rotate button icon 90deg if the toolbox container is
in vertical mode (sidebar displayed under the main panel) */
@media (max-width: 700px) {
.sidebar-toggle:-moz-locale-dir(ltr)::before {
.sidebar-toggle::before {
transform: rotate(90deg);
}
/* Since RTL swaps the used images, we need to flip them
the other way round */
.sidebar-toggle:-moz-locale-dir(rtl)::before {
.sidebar-toggle:dir(rtl)::before {
transform: rotate(-90deg);
}
}

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

@ -29,7 +29,7 @@ loader.lazyRequireGetter(this, "util", "gcli/util/util");
loader.lazyRequireGetter(this, "ConsoleServiceListener", "devtools/server/actors/utils/webconsole-utils", true);
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true);
loader.lazyRequireGetter(this, "nodeConstants", "devtools/shared/dom-node-constants", true);
loader.lazyRequireGetter(this, "nodeConstants", "devtools/shared/dom-node-constants");
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
/**

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

@ -4,7 +4,6 @@
"use strict";
const {Cc, Ci} = require("chrome");
const {angleUtils} = require("devtools/client/shared/css-angle");
const {colorUtils} = require("devtools/shared/css/color");
const {getCSSLexer} = require("devtools/shared/css/lexer");
@ -18,10 +17,6 @@ const {
const HTML_NS = "http://www.w3.org/1999/xhtml";
loader.lazyGetter(this, "DOMUtils", function () {
return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
});
/**
* This module is used to process text for output by developer tools. This means
* linking JS files with the debugger, CSS files with the style editor, JS
@ -37,15 +32,18 @@ loader.lazyGetter(this, "DOMUtils", function () {
* parser.parseCssProperty("color", "red"); // Returns document fragment.
*
* @param {Document} document Used to create DOM nodes.
* @param {Function} supportsTypes A function that returns a boolean when asked if a css
* property name supports a given css type.
* The function is executed like supportsType("color", CSS_TYPES.COLOR) where CSS_TYPES is
* defined in devtools/shared/css/properties-db.js
* @param {Function} supportsTypes - A function that returns a boolean when asked if a css
* property name supports a given css type.
* The function is executed like supportsType("color", CSS_TYPES.COLOR)
* where CSS_TYPES is defined in devtools/shared/css/properties-db.js
* @param {Function} isValidOnClient - A function that checks if a css property
* name/value combo is valid.
*/
function OutputParser(document, supportsType) {
function OutputParser(document, {supportsType, isValidOnClient}) {
this.parsed = [];
this.doc = document;
this.supportsType = supportsType;
this.isValidOnClient = isValidOnClient;
this.colorSwatches = new WeakMap();
this.angleSwatches = new WeakMap();
this._onColorSwatchMouseDown = this._onColorSwatchMouseDown.bind(this);
@ -341,7 +339,7 @@ OutputParser.prototype = {
* CSS Property value to check
*/
_cssPropertySupportsValue: function (name, value) {
return DOMUtils.cssPropertyIsValid(name, value);
return this.isValidOnClient(name, value, this.doc);
},
/**

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

@ -10,6 +10,7 @@ const DOMUtils =
Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
const TEST_URI = `data:text/html,<div id="filter-container" />`;
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
// Verify that the given string consists of a valid CSS URL token.
// Return true on success, false on error.
@ -26,9 +27,10 @@ function verifyURL(string) {
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
let widget = new CSSFilterEditorWidget(container, "none");
let widget = new CSSFilterEditorWidget(container, "none", cssIsValid);
info("Test parsing of a valid CSS Filter value");
widget.setCssValue("blur(2px) contrast(200%)");

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

@ -6,6 +6,7 @@
// Tests that the Filter Editor Widget renders filters correctly
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const { LocalizationHelper } = require("devtools/shared/l10n");
const STRINGS_URI = "devtools/locale/filterwidget.properties";
@ -15,6 +16,7 @@ const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const TEST_DATA = [
{
@ -69,7 +71,7 @@ add_task(function* () {
];
const container = doc.querySelector("#filter-container");
let widget = new CSSFilterEditorWidget(container, "none");
let widget = new CSSFilterEditorWidget(container, "none", cssIsValid);
info("Test rendering of different types");

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

@ -6,6 +6,7 @@
// Tests the Filter Editor Widget add, removeAt, updateAt, getValueAt methods
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const GRAYSCALE_MAX = 100;
const INVERT_MIN = 0;
@ -13,9 +14,10 @@ const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
let widget = new CSSFilterEditorWidget(container, "none");
let widget = new CSSFilterEditorWidget(container, "none", cssIsValid);
info("Test add method");
const blur = widget.add("blur", "10.2px");

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

@ -6,16 +6,18 @@
// Tests the Filter Editor Widget's drag-drop re-ordering
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const LIST_ITEM_HEIGHT = 32;
const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
const initialValue = "blur(2px) contrast(200%) brightness(200%)";
let widget = new CSSFilterEditorWidget(container, initialValue);
let widget = new CSSFilterEditorWidget(container, initialValue, cssIsValid);
const filters = widget.el.querySelector("#filters");
function first() {

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

@ -8,6 +8,7 @@ requestLongerTimeout(2);
// Tests the Filter Editor Widget's label-dragging
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const FAST_VALUE_MULTIPLIER = 10;
const SLOW_VALUE_MULTIPLIER = 0.1;
@ -20,9 +21,10 @@ const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
let widget = new CSSFilterEditorWidget(container, "grayscale(0%) url(test.svg)");
let widget = new CSSFilterEditorWidget(container, "grayscale(0%) url(test.svg)", cssIsValid);
const filters = widget.el.querySelector("#filters");
const grayscale = filters.children[0];

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

@ -6,6 +6,7 @@
// Tests the Filter Editor Widget's add button
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const { LocalizationHelper } = require("devtools/shared/l10n");
const STRINGS_URI = "devtools/locale/filterwidget.properties";
@ -15,9 +16,10 @@ const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
let widget = new CSSFilterEditorWidget(container, "none");
let widget = new CSSFilterEditorWidget(container, "none", cssIsValid);
const select = widget.el.querySelector("select"),
add = widget.el.querySelector("#add-filter");

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

@ -6,6 +6,7 @@
// Tests the Filter Editor Widget's remove button
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const { LocalizationHelper } = require("devtools/shared/l10n");
const STRINGS_URI = "devtools/locale/filterwidget.properties";
@ -15,9 +16,10 @@ const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
let widget = new CSSFilterEditorWidget(container, "blur(2px) contrast(200%)");
let widget = new CSSFilterEditorWidget(container, "blur(2px) contrast(200%)", cssIsValid);
info("Test removing filters with remove button");
widget.el.querySelector(".filter button").click();

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

@ -7,6 +7,7 @@
// arrow keys, applying multiplier using alt/shift on number-type filters
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const FAST_VALUE_MULTIPLIER = 10;
const SLOW_VALUE_MULTIPLIER = 0.1;
@ -16,10 +17,11 @@ const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
const initialValue = "blur(2px)";
let widget = new CSSFilterEditorWidget(container, initialValue);
let widget = new CSSFilterEditorWidget(container, initialValue, cssIsValid);
let value = 2;

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

@ -7,6 +7,7 @@
// on a number using arrow keys, applying multiplier using alt/shift on strings
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const FAST_VALUE_MULTIPLIER = 10;
const SLOW_VALUE_MULTIPLIER = 0.1;
@ -16,10 +17,11 @@ const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
const initialValue = "drop-shadow(rgb(0, 0, 0) 1px 1px 0px)";
let widget = new CSSFilterEditorWidget(container, initialValue);
let widget = new CSSFilterEditorWidget(container, initialValue, cssIsValid);
widget.el.querySelector("#filters input").setSelectionRange(13, 13);
let value = 1;

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

@ -7,6 +7,7 @@
// on a number using arrow keys if cursor is behind/mid/after the number strings
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const FAST_VALUE_MULTIPLIER = 10;
const SLOW_VALUE_MULTIPLIER = 0.1;
@ -16,10 +17,11 @@ const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
const initialValue = "drop-shadow(rgb(0, 0, 0) 10px 1px 0px)";
let widget = new CSSFilterEditorWidget(container, initialValue);
let widget = new CSSFilterEditorWidget(container, initialValue, cssIsValid);
const input = widget.el.querySelector("#filters input");
let value = 10;

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

@ -6,14 +6,16 @@
// Tests saving presets
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
let widget = new CSSFilterEditorWidget(container, "none");
let widget = new CSSFilterEditorWidget(container, "none", cssIsValid);
// First render
yield widget.once("render");

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

@ -6,14 +6,16 @@
// Tests loading presets
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
let widget = new CSSFilterEditorWidget(container, "none");
let widget = new CSSFilterEditorWidget(container, "none", cssIsValid);
// First render
yield widget.once("render");

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

@ -6,14 +6,16 @@
// Tests deleting presets
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
const TEST_URI = `data:text/html,<div id="filter-container" />`;
add_task(function* () {
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const cssIsValid = getClientCssProperties().getValidityChecker(doc);
const container = doc.querySelector("#filter-container");
let widget = new CSSFilterEditorWidget(container, "none");
let widget = new CSSFilterEditorWidget(container, "none", cssIsValid);
// First render
yield widget.once("render");

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

@ -21,7 +21,7 @@ function* performTest() {
yield initCssProperties(toolbox);
let cssProperties = getCssProperties(toolbox);
let parser = new OutputParser(doc, cssProperties.supportsType);
let parser = new OutputParser(doc, cssProperties);
testParseCssProperty(doc, parser);
testParseCssVar(doc, parser);
testParseURL(doc, parser);
@ -288,4 +288,3 @@ function testParseAngle(doc, parser) {
swatchCount = frag.querySelectorAll(".test-angleswatch").length;
is(swatchCount, 1, "angle swatch was created");
}

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

@ -3,6 +3,14 @@
// Tests that the developer toolbar errors count works properly.
// Use the old webconsole since this is directly accessing old DOM, and
// the error count isn't reset when pressing the clear button in new one
// See Bug 1304794.
Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", false);
registerCleanupFunction(function* () {
Services.prefs.clearUserPref("devtools.webconsole.new-frontend-enabled");
});
function test() {
const TEST_URI = TEST_URI_ROOT + "browser_toolbar_webconsole_errors_count.html";

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

@ -115,11 +115,14 @@ const SPECIAL_VALUES = new Set(["none", "unset", "initial", "inherit"]);
* The widget container.
* @param {String} value
* CSS filter value
* @param {Function} cssIsValid
* Test whether css name / value is valid.
*/
function CSSFilterEditorWidget(el, value = "") {
function CSSFilterEditorWidget(el, value = "", cssIsValid) {
this.doc = el.ownerDocument;
this.win = this.doc.defaultView;
this.el = el;
this._cssIsValid = cssIsValid;
this._addButtonClick = this._addButtonClick.bind(this);
this._removeButtonClick = this._removeButtonClick.bind(this);
@ -768,7 +771,7 @@ CSSFilterEditorWidget.prototype = {
// If the specified value is invalid, replace it with the
// default.
if (name !== "url") {
if (!DOMUtils.cssPropertyIsValid("filter", name + "(" + value + ")")) {
if (!this._cssIsValid("filter", name + "(" + value + ")")) {
value = null;
}
}

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

@ -918,10 +918,14 @@ Heritage.extend(SwatchBasedEditorTooltip.prototype, {
*
* @param {Toolbox} toolbox
* The devtools toolbox, needed to get the devtools main window.
* @param {function} cssIsValid
* A function to check that css declaration's name and values are valid together.
* This can be obtained from "shared/fronts/css-properties.js".
*/
function SwatchFilterTooltip(toolbox) {
function SwatchFilterTooltip(toolbox, cssIsValid) {
let stylesheet = "chrome://devtools/content/shared/widgets/filter-widget.css";
SwatchBasedEditorTooltip.call(this, toolbox, stylesheet);
this._cssIsValid = cssIsValid;
// Creating a filter editor instance.
this.widget = this.setFilterContent("none");
@ -945,7 +949,7 @@ Heritage.extend(SwatchBasedEditorTooltip.prototype, {
this.tooltip.setContent(container, { width: 510, height: 200 });
return new CSSFilterEditorWidget(container, filter);
return new CSSFilterEditorWidget(container, filter, this._cssIsValid);
},
show: Task.async(function* () {

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

@ -252,6 +252,11 @@ const ViewHelpers = exports.ViewHelpers = {
// Add a class to the pane to handle min-widths, margins and animations.
pane.classList.add("generic-toggled-pane");
// Avoid toggles in the middle of animation.
if (pane.hasAttribute("animated")) {
return;
}
// Avoid useless toggles.
if (flags.visible == !pane.classList.contains("pane-collapsed")) {
if (flags.callback) {
@ -283,23 +288,36 @@ const ViewHelpers = exports.ViewHelpers = {
pane.style.marginLeft = -width + "px";
pane.style.marginRight = -width + "px";
pane.style.marginBottom = -height + "px";
pane.classList.add("pane-collapsed");
}
// Wait for the animation to end before calling afterToggle()
if (flags.animated) {
pane.addEventListener("transitionend", function onEvent() {
pane.removeEventListener("transitionend", onEvent, false);
let options = {
useCapture: false,
once: true
};
pane.addEventListener("transitionend", () => {
// Prevent unwanted transitions: if the panel is hidden and the layout
// changes margins will be updated and the panel will pop out.
pane.removeAttribute("animated");
if (!flags.visible) {
pane.classList.add("pane-collapsed");
}
if (flags.callback) {
flags.callback();
}
}, false);
} else if (flags.callback) {
}, options);
} else {
if (!flags.visible) {
pane.classList.add("pane-collapsed");
}
// Invoke the callback immediately since there's no transition.
flags.callback();
if (flags.callback) {
flags.callback();
}
}
};

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

@ -325,7 +325,7 @@
display: inline-block;
}
.ruleview-expander.theme-twisty:-moz-locale-dir(rtl) {
.ruleview-expander.theme-twisty:dir(rtl) {
/* for preventing .theme-twisty's wrong direction in rtl; Bug 1296648 */
transform: none;
}

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

@ -282,23 +282,23 @@
/* RTL support: move the images that were on the left to the right,
* and move images that were on the right to the left.
*/
.breadcrumbs-widget-item:-moz-locale-dir(rtl) {
.breadcrumbs-widget-item:dir(rtl) {
padding: 0 20px 0 8px;
}
.breadcrumbs-widget-item:-moz-locale-dir(rtl),
.breadcrumbs-widget-item[checked] + .breadcrumbs-widget-item:-moz-locale-dir(rtl) {
.breadcrumbs-widget-item:dir(rtl),
.breadcrumbs-widget-item[checked] + .breadcrumbs-widget-item:dir(rtl) {
background-position: center right;
}
#breadcrumb-separator-before:-moz-locale-dir(rtl),
#breadcrumb-separator-after:-moz-locale-dir(rtl),
#breadcrumb-separator-normal:-moz-locale-dir(rtl) {
#breadcrumb-separator-before:dir(rtl),
#breadcrumb-separator-after:dir(rtl),
#breadcrumb-separator-normal:dir(rtl) {
transform: scaleX(-1);
}
#breadcrumb-separator-before:-moz-locale-dir(rtl):after,
#breadcrumb-separator-after:-moz-locale-dir(rtl):after {
#breadcrumb-separator-before:dir(rtl):after,
#breadcrumb-separator-after:dir(rtl):after {
transform: translateX(-5px) rotate(45deg);
}

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

@ -377,8 +377,7 @@ JSTerm.prototype = {
if (this.hud.NEW_CONSOLE_OUTPUT_ENABLED) {
this.hud.newConsoleOutput.dispatchMessageAdd(response);
// @TODO figure out what to do about the callback.
callback && callback();
callback && callback(this.hud.newConsoleOutput.getLastMessage());
return;
}
let msg = new Messages.JavaScriptEvalOutput(response,
@ -426,7 +425,7 @@ JSTerm.prototype = {
let deferred = promise.defer();
let resultCallback;
if (this.hud.NEW_CONSOLE_OUTPUT_ENABLED) {
resultCallback = () => deferred.resolve();
resultCallback = (msg) => deferred.resolve(msg);
} else {
resultCallback = (msg) => {
deferred.resolve(msg);
@ -453,7 +452,7 @@ JSTerm.prototype = {
let message = new ConsoleCommand({
messageText: executeString,
});
this.hud.newConsoleOutput.dispatchMessageAdd(message);
this.hud.proxy.dispatchMessageAdd(message);
} else {
let message = new Messages.Simple(executeString, {
category: "input",

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

@ -25,6 +25,13 @@ registerCleanupFunction(() => {
Services.prefs.clearUserPref(NET_XHR_PREF, true);
});
// Use the old webconsole since the new one doesn't yet support
// XHR spy. See Bug 1304794.
Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", false);
registerCleanupFunction(function* () {
Services.prefs.clearUserPref("devtools.webconsole.new-frontend-enabled");
});
/**
* Add a new test tab in the browser and load the given url.
* @param {String} url The url to be loaded in the new tab

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

@ -17,6 +17,7 @@ const FilterBar = React.createFactory(require("devtools/client/webconsole/new-co
const store = configureStore();
function NewConsoleOutputWrapper(parentNode, jsterm, toolbox, owner) {
this.parentNode = parentNode;
this.parentNode = parentNode;
this.jsterm = jsterm;
this.toolbox = toolbox;
@ -68,6 +69,12 @@ NewConsoleOutputWrapper.prototype = {
dispatchMessagesClear: () => {
store.dispatch(actions.messagesClear());
},
getLastMessage: function() {
// Return the last message in the DOM as the message that was just dispatched. This may not
// always be correct in the case of filtered messages, but it's close enough for our tests.
let messageNodes = this.parentNode.querySelectorAll(".message");
return messageNodes[messageNodes.length - 1]
},
};
// Exports from this module

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

@ -52,16 +52,19 @@ var openNewTabAndConsole = Task.async(function* (url) {
function waitForMessages({ hud, messages }) {
return new Promise(resolve => {
let numMatched = 0;
let receivedLog = hud.ui.on("new-messages", function messagesReceieved(e, newMessage) {
let receivedLog = hud.ui.on("new-messages", function messagesReceieved(e, newMessages) {
for (let message of messages) {
if (message.matched) {
continue;
}
if (newMessage.node.querySelector(".message-body").textContent == message.text) {
numMatched++;
message.matched = true;
info("Matched a message with text: " + message.text + ", still waiting for " + (messages.length - numMatched) + " messages");
for (let newMessage of newMessages) {
if (newMessage.node.querySelector(".message-body").textContent == message.text) {
numMatched++;
message.matched = true;
info("Matched a message with text: " + message.text + ", still waiting for " + (messages.length - numMatched) + " messages");
break;
}
}
if (numMatched === messages.length) {

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

@ -321,6 +321,12 @@ var finishTest = Task.async(function* () {
finish();
});
// Always use the 'old' frontend for tests that rely on it
Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", false);
registerCleanupFunction(function* () {
Services.prefs.clearUserPref("devtools.webconsole.new-frontend-enabled");
});
registerCleanupFunction(function* () {
flags.testing = false;

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

@ -3266,14 +3266,10 @@ WebConsoleConnectionProxy.prototype = {
*/
dispatchMessageAdd: function(packet) {
this.webConsoleFrame.newConsoleOutput.dispatchMessageAdd(packet);
// Return the last message in the DOM as the message that was just dispatched. This may not
// always be true in the case of filtered messages, but it's close enough for our tests.
let messageNodes = this.webConsoleFrame.experimentalOutputNode.querySelectorAll(".message");
this.webConsoleFrame.emit("new-messages", {
this.webConsoleFrame.emit("new-messages", new Set([{
response: packet,
node: messageNodes[messageNodes.length - 1],
});
node: this.webConsoleFrame.newConsoleOutput.getLastMessage(),
}]));
},
/**

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

@ -626,14 +626,20 @@ let SourceActor = ActorClassWithSpec(sourceSpec, {
/**
* Handle a request to set a breakpoint.
*
* @param JSON request
* A JSON object representing the request.
* @param Number line
* Line to break on.
* @param Number column
* Column to break on.
* @param String condition
* A condition which must be true for breakpoint to be hit.
* @param Boolean noSliding
* If true, disables breakpoint sliding.
*
* @returns Promise
* A promise that resolves to a JSON object representing the
* response.
*/
setBreakpoint: function (line, column, condition) {
setBreakpoint: function (line, column, condition, noSliding) {
if (this.threadActor.state !== "paused") {
throw {
error: "wrongState",
@ -644,7 +650,8 @@ let SourceActor = ActorClassWithSpec(sourceSpec, {
let location = new OriginalLocation(this, line, column);
return this._getOrCreateBreakpointActor(
location,
condition
condition,
noSliding
).then((actor) => {
let response = {
actor: actor.actorID,
@ -671,11 +678,13 @@ let SourceActor = ActorClassWithSpec(sourceSpec, {
* @param String condition
* A string that is evaluated whenever the breakpoint is hit. If the
* string evaluates to false, the breakpoint is ignored.
* @param Boolean noSliding
* If true, disables breakpoint sliding.
*
* @returns BreakpointActor
* A BreakpointActor representing the breakpoint.
*/
_getOrCreateBreakpointActor: function (originalLocation, condition) {
_getOrCreateBreakpointActor: function (originalLocation, condition, noSliding) {
let actor = this.breakpointActorMap.getActor(originalLocation);
if (!actor) {
actor = new BreakpointActor(this.threadActor, originalLocation);
@ -685,7 +694,7 @@ let SourceActor = ActorClassWithSpec(sourceSpec, {
actor.condition = condition;
return this._setBreakpoint(actor);
return this._setBreakpoint(actor, noSliding);
},
/*
@ -705,18 +714,19 @@ let SourceActor = ActorClassWithSpec(sourceSpec, {
*
* @param BreakpointActor actor
* The BreakpointActor to be set as a breakpoint handler.
* @param Boolean noSliding
* If true, disables breakpoint sliding.
*
* @returns A Promise that resolves to the given BreakpointActor.
*/
_setBreakpoint: function (actor) {
_setBreakpoint: function (actor, noSliding) {
const { originalLocation } = actor;
const { originalLine, originalSourceActor } = originalLocation;
if (!this.isSourceMapped) {
if (!this._setBreakpointAtGeneratedLocation(
actor,
GeneratedLocation.fromOriginalLocation(originalLocation)
)) {
const generatedLocation = GeneratedLocation.fromOriginalLocation(originalLocation);
if (!this._setBreakpointAtGeneratedLocation(actor, generatedLocation) &&
!noSliding) {
const query = { line: originalLine };
// For most cases, we have a real source to query for. The
// only time we don't is for HTML pages. In that case we want

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

@ -94,6 +94,11 @@ window.onload = function() {
"A property with color values includes papayawhip.");
ok(bgColorValues.includes("rgb"),
"A property with color values includes non-colors.");
ok(cssProperties.isValidOnClient("margin", "0px", window.document),
"Margin and 0px are valid CSS values");
ok(!cssProperties.isValidOnClient("margin", "foo", window.document),
"Margin and foo are not valid CSS values");
});
addAsyncTest(function* setup() {

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

@ -36,40 +36,52 @@ function run_test_with_server(aServer, aCallback)
});
}
function test_skip_breakpoint()
{
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
var test_no_skip_breakpoint = Task.async(function*(source, location) {
let [aResponse, bpClient] = yield source.setBreakpoint(
Object.assign({}, location, { noSliding: true })
);
do_check_true(!aResponse.actualLocation);
do_check_eq(bpClient.location.line, gDebuggee.line0 + 3);
yield bpClient.remove();
});
var test_skip_breakpoint = function() {
gThreadClient.addOneTimeListener("paused", Task.async(function *(aEvent, aPacket) {
let location = { line: gDebuggee.line0 + 3 };
let source = gThreadClient.source(aPacket.frame.where.source);
source.setBreakpoint(location, function (aResponse, bpClient) {
// Check that the breakpoint has properly skipped forward one line.
do_check_true(!!aResponse.actualLocation);
do_check_eq(aResponse.actualLocation.source.actor, source.actor);
do_check_eq(aResponse.actualLocation.line, location.line + 1);
// First, make sure that we can disable sliding with the
// `noSliding` option.
yield test_no_skip_breakpoint(source, location);
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
// Check the return value.
do_check_eq(aPacket.type, "paused");
do_check_eq(aPacket.frame.where.source.actor, source.actor);
do_check_eq(aPacket.frame.where.line, location.line + 1);
do_check_eq(aPacket.why.type, "breakpoint");
do_check_eq(aPacket.why.actors[0], bpClient.actor);
// Check that the breakpoint worked.
do_check_eq(gDebuggee.a, 1);
do_check_eq(gDebuggee.b, undefined);
// Now make sure that the breakpoint properly slides forward one line.
const [aResponse, bpClient] = yield source.setBreakpoint(location);
do_check_true(!!aResponse.actualLocation);
do_check_eq(aResponse.actualLocation.source.actor, source.actor);
do_check_eq(aResponse.actualLocation.line, location.line + 1);
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
gClient.close().then(gCallback);
});
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
// Check the return value.
do_check_eq(aPacket.type, "paused");
do_check_eq(aPacket.frame.where.source.actor, source.actor);
do_check_eq(aPacket.frame.where.line, location.line + 1);
do_check_eq(aPacket.why.type, "breakpoint");
do_check_eq(aPacket.why.actors[0], bpClient.actor);
// Check that the breakpoint worked.
do_check_eq(gDebuggee.a, 1);
do_check_eq(gDebuggee.b, undefined);
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
gClient.close().then(gCallback);
});
});
gThreadClient.resume();
});
});
gThreadClient.resume();
}));
// Use `evalInSandbox` to make the debugger treat it as normal
// globally-scoped code, where breakpoint sliding rules apply.

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

@ -2893,7 +2893,7 @@ SourceClient.prototype = {
* @param function aOnResponse
* Called with the thread's response.
*/
setBreakpoint: function ({ line, column, condition }, aOnResponse = noop) {
setBreakpoint: function ({ line, column, condition, noSliding }, aOnResponse = noop) {
// A helper function that sets the breakpoint.
let doSetBreakpoint = aCallback => {
let root = this._client.mainRoot;
@ -2906,7 +2906,8 @@ SourceClient.prototype = {
to: this.actor,
type: "setBreakpoint",
location: location,
condition: condition
condition: condition,
noSliding: noSliding
};
// Backwards compatibility: send the breakpoint request to the

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

@ -65,6 +65,10 @@ function CssProperties(db) {
this.isKnown = this.isKnown.bind(this);
this.isInherited = this.isInherited.bind(this);
this.supportsType = this.supportsType.bind(this);
this.isValidOnClient = this.isValidOnClient.bind(this);
// A weakly held dummy HTMLDivElement to test CSS properties on the client.
this._dummyElements = new WeakMap();
}
CssProperties.prototype = {
@ -79,6 +83,45 @@ CssProperties.prototype = {
return !!this.properties[property] || isCssVariable(property);
},
/**
* Quickly check if a CSS name/value combo is valid on the client.
*
* @param {String} Property name.
* @param {String} Property value.
* @param {Document} The client's document object.
* @return {Boolean}
*/
isValidOnClient(name, value, doc) {
let dummyElement = this._dummyElements.get(doc);
if (!dummyElement) {
dummyElement = doc.createElement("div");
this._dummyElements.set(doc, dummyElement);
}
// `!important` is not a valid value when setting a style declaration in the
// CSS Object Model.
const sanitizedValue = ("" + value).replace(/!\s*important\s*$/, "");
// Test the style on the element.
dummyElement.style[name] = sanitizedValue;
const isValid = !!dummyElement.style[name];
// Reset the state of the dummy element;
dummyElement.style[name] = "";
return isValid;
},
/**
* Get a function that will check the validity of css name/values for a given document.
* Useful for injecting isValidOnClient into components when needed.
*
* @param {Document} The client's document object.
* @return {Function} this.isValidOnClient with the document pre-set.
*/
getValidityChecker(doc) {
return (name, value) => this.isValidOnClient(name, value, doc);
},
/**
* Checks to see if the property is an inherited one.
*

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

@ -29,7 +29,8 @@ const sourceSpec = generateActorSpec({
line: Arg(0, "number"),
column: Arg(1, "nullable:number")
},
condition: Arg(2, "nullable:string")
condition: Arg(2, "nullable:string"),
noSliding: Arg(3, "nullable:boolean")
},
response: RetVal("json")
},

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

@ -46,7 +46,7 @@ DocumentTimeline::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
/* static */ already_AddRefed<DocumentTimeline>
DocumentTimeline::Constructor(const GlobalObject& aGlobal,
const DOMHighResTimeStamp& aOriginTime,
const DocumentTimelineOptions& aOptions,
ErrorResult& aRv)
{
nsIDocument* doc = AnimationUtils::GetCurrentRealmDocument(aGlobal.Context());
@ -54,12 +54,11 @@ DocumentTimeline::Constructor(const GlobalObject& aGlobal,
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
TimeDuration originTime =
TimeDuration::FromMilliseconds(aOptions.mOriginTime);
TimeDuration originTime = TimeDuration::FromMilliseconds(aOriginTime);
if (originTime == TimeDuration::Forever() ||
originTime == -TimeDuration::Forever()) {
nsAutoString inputOriginTime;
inputOriginTime.AppendFloat(aOriginTime);
aRv.ThrowTypeError<dom::MSG_TIME_VALUE_OUT_OF_RANGE>(
NS_LITERAL_STRING("Origin time"));
return nullptr;

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

@ -7,6 +7,7 @@
#ifndef mozilla_dom_DocumentTimeline_h
#define mozilla_dom_DocumentTimeline_h
#include "mozilla/dom/DocumentTimelineBinding.h"
#include "mozilla/TimeStamp.h"
#include "AnimationTimeline.h"
#include "nsIDocument.h"
@ -54,7 +55,7 @@ public:
static already_AddRefed<DocumentTimeline>
Constructor(const GlobalObject& aGlobal,
const DOMHighResTimeStamp& aOriginTime,
const DocumentTimelineOptions& aOptions,
ErrorResult& aRv);
// AnimationTimeline methods

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

@ -12,13 +12,17 @@
// inside the allowed range will just mean we overflow elsewhere.
test(function(t) {
assert_throws({name: 'TypeError'},
function() { new DocumentTimeline(Number.MAX_SAFE_INTEGER); });
assert_throws({ name: 'TypeError'},
function() {
new DocumentTimeline({ originTime: Number.MAX_SAFE_INTEGER });
});
}, 'Calculated current time is positive infinity');
test(function(t) {
assert_throws({name: 'TypeError'},
function() { new DocumentTimeline(-1 * Number.MAX_SAFE_INTEGER); });
assert_throws({ name: 'TypeError'},
function() {
new DocumentTimeline({ originTime: -1 * Number.MAX_SAFE_INTEGER });
});
}, 'Calculated current time is negative infinity');
done();

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

@ -116,10 +116,8 @@
#endif
#include "mozilla/dom/ContentChild.h"
#ifdef MOZ_EME
#include "mozilla/EMEUtils.h"
#include "mozilla/DetailedPromise.h"
#endif
namespace mozilla {
namespace dom {
@ -249,9 +247,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
#ifdef MOZ_EME
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeySystemAccessManager)
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDeviceStorageAreaListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPresentation)
#ifdef MOZ_GAMEPAD
@ -386,12 +382,10 @@ Navigator::Invalidate()
mServiceWorkerContainer = nullptr;
#ifdef MOZ_EME
if (mMediaKeySystemAccessManager) {
mMediaKeySystemAccessManager->Shutdown();
mMediaKeySystemAccessManager = nullptr;
}
#endif
if (mDeviceStorageAreaListener) {
mDeviceStorageAreaListener = nullptr;
@ -2324,7 +2318,6 @@ Navigator::GetUserAgent(nsPIDOMWindowInner* aWindow, nsIURI* aURI,
return siteSpecificUA->GetUserAgentForURIAndWindow(aURI, aWindow, aUserAgent);
}
#ifdef MOZ_EME
static nsCString
ToCString(const nsString& aString)
{
@ -2450,7 +2443,6 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem,
mMediaKeySystemAccessManager->Request(promise, aKeySystem, aConfigs);
return promise.forget();
}
#endif
Presentation*
Navigator::GetPresentation(ErrorResult& aRv)

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

@ -18,9 +18,7 @@
#include "nsString.h"
#include "nsTArray.h"
#include "nsWeakPtr.h"
#ifdef MOZ_EME
#include "mozilla/dom/MediaKeySystemAccessManager.h"
#endif
class nsPluginArray;
class nsMimeTypeArray;
@ -317,14 +315,12 @@ public:
// any, else null.
static already_AddRefed<nsPIDOMWindowInner> GetWindowFromGlobal(JSObject* aGlobal);
#ifdef MOZ_EME
already_AddRefed<Promise>
RequestMediaKeySystemAccess(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfig,
ErrorResult& aRv);
private:
RefPtr<MediaKeySystemAccessManager> mMediaKeySystemAccessManager;
#endif
public:
void NotifyVRDisplaysUpdated();

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

@ -4356,7 +4356,6 @@ nsDocument::SetScopeObject(nsIGlobalObject* aGlobal)
}
}
#ifdef MOZ_EME
static void
CheckIfContainsEMEContent(nsISupports* aSupports, void* aContainsEME)
{
@ -4380,7 +4379,6 @@ nsDocument::ContainsEMEContent()
static_cast<void*>(&containsEME));
return containsEME;
}
#endif // MOZ_EME
static void
CheckIfContainsMSEContent(nsISupports* aSupports, void* aContainsMSE)
@ -8361,13 +8359,11 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
}
#endif // MOZ_WEBRTC
#ifdef MOZ_EME
// Don't save presentations for documents containing EME content, so that
// CDMs reliably shutdown upon user navigation.
if (ContainsEMEContent()) {
return false;
}
#endif
// Don't save presentations for documents containing MSE content, to
// reduce memory usage.

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

@ -1264,9 +1264,7 @@ public:
js::ExpandoAndGeneration mExpandoAndGeneration;
#ifdef MOZ_EME
bool ContainsEMEContent();
#endif
bool ContainsMSEContent();

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

@ -2228,8 +2228,6 @@ GK_ATOM(scrollbar_start_forward, "scrollbar-start-forward")
GK_ATOM(scrollbar_end_backward, "scrollbar-end-backward")
GK_ATOM(scrollbar_end_forward, "scrollbar-end-forward")
GK_ATOM(scrollbar_thumb_proportional, "scrollbar-thumb-proportional")
GK_ATOM(images_in_menus, "images-in-menus")
GK_ATOM(images_in_buttons, "images-in-buttons")
GK_ATOM(overlay_scrollbars, "overlay-scrollbars")
GK_ATOM(windows_default_theme, "windows-default-theme")
GK_ATOM(mac_graphite_theme, "mac-graphite-theme")
@ -2259,8 +2257,6 @@ GK_ATOM(_moz_scrollbar_start_forward, "-moz-scrollbar-start-forward")
GK_ATOM(_moz_scrollbar_end_backward, "-moz-scrollbar-end-backward")
GK_ATOM(_moz_scrollbar_end_forward, "-moz-scrollbar-end-forward")
GK_ATOM(_moz_scrollbar_thumb_proportional, "-moz-scrollbar-thumb-proportional")
GK_ATOM(_moz_images_in_menus, "-moz-images-in-menus")
GK_ATOM(_moz_images_in_buttons, "-moz-images-in-buttons")
GK_ATOM(_moz_overlay_scrollbars, "-moz-overlay-scrollbars")
GK_ATOM(_moz_windows_default_theme, "-moz-windows-default-theme")
GK_ATOM(_moz_mac_graphite_theme, "-moz-mac-graphite-theme")

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

@ -4785,12 +4785,10 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& aImage,
return;
}
#ifdef MOZ_EME
if (video->ContainsRestrictedContent()) {
aError.Throw(NS_ERROR_NOT_AVAILABLE);
return;
}
#endif
uint16_t readyState;
if (NS_SUCCEEDED(video->GetReadyState(&readyState)) &&

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

@ -53,6 +53,7 @@ fail-if = (os == 'android') || (os == 'win' && os_version == '5.1')
[test_backbuffer_channels.html]
fail-if = (os == 'b2g')
[test_depth_readpixels.html]
[test_canvas_size.html]
[test_capture.html]
support-files = ../captureStream_common.js
# Even though we use ../ here, in the test HTML, we need to omit this. Sub-CWD relative

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

@ -0,0 +1,54 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset='UTF-8'>
<script src='/tests/SimpleTest/SimpleTest.js'></script>
<link rel='stylesheet' href='/tests/SimpleTest/test.css'>
</head>
<title>WebGL test: Framebuffer maximum size test. (Bug 1290333)</title>
<body>
<script>
function TestSize(contextName, testSize) {
var attributes = {
antialias: false,
};
var canvas = document.createElement('canvas');
var gl = canvas.getContext(contextName, attributes);
if (!gl) {
todo(false, contextName + 'is unavailable.');
return;
}
gl.canvas.width = testSize;
gl.canvas.height = testSize;
ok(true, contextName + 'test complete.');
}
function run() {
TestSize('webgl', 16384);
TestSize('webgl2', 16384);
ok(true, 'Test complete.');
SimpleTest.finish();
}
////////////////////////////////////////
SimpleTest.waitForExplicitFinish();
try {
var prefPairList = [
['webgl.force-enabled', true],
];
var prefEnv = {'set': prefPairList};
SpecialPowers.pushPrefEnv(prefEnv, run);
} catch (e) {
warning('No SpecialPowers, but trying WebGL2 anyway...');
run();
}
</script>
</body>
</html>

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

@ -11,9 +11,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/AsyncEventDispatcher.h"
#ifdef MOZ_EME
#include "mozilla/dom/MediaEncryptedEvent.h"
#endif
#include "base/basictypes.h"
#include "nsIDOMHTMLMediaElement.h"
@ -711,9 +709,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLMediaElement, nsGenericHTM
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTextTrackManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAudioTrackList)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVideoTrackList)
#ifdef MOZ_EME
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeys)
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSelectedVideoStreamTrack)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -738,9 +734,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLMediaElement, nsGenericHTMLE
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTextTrackManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAudioTrackList)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mVideoTrackList)
#ifdef MOZ_EME
NS_IMPL_CYCLE_COLLECTION_UNLINK(mMediaKeys)
#endif
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSelectedVideoStreamTrack)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -918,14 +912,12 @@ void HTMLMediaElement::ShutdownDecoder()
void HTMLMediaElement::AbortExistingLoads()
{
#ifdef MOZ_EME
// If there is no existing decoder then we don't have anything to
// report. This prevents reporting the initial load from an
// empty video element as a failed EME load.
if (mDecoder) {
ReportEMETelemetry();
}
#endif
// Abort any already-running instance of the resource selection algorithm.
mLoadWaitStatus = NOT_WAITING;
@ -984,9 +976,7 @@ void HTMLMediaElement::AbortExistingLoads()
mDownloadSuspendedByCache = false;
mMediaInfo = MediaInfo();
mIsEncrypted = false;
#ifdef MOZ_EME
mPendingEncryptedInitData.mInitDatas.Clear();
#endif // MOZ_EME
mWaitingForKey = false;
mSourcePointer = nullptr;
@ -1627,6 +1617,18 @@ nsresult HTMLMediaElement::LoadResource()
// Set the media element's CORS mode only when loading a resource
mCORSMode = AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
bool isBlob = false;
if (mMediaKeys &&
Preferences::GetBool("media.eme.mse-only", true) &&
// We only want mediaSource URLs, but they are BlobURL, so we have to
// check the schema and if they are not MediaStream or real Blob.
(NS_FAILED(mLoadingSrc->SchemeIs(BLOBURI_SCHEME, &isBlob)) ||
!isBlob ||
IsMediaStreamURI(mLoadingSrc) ||
IsBlobURI(mLoadingSrc))) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
HTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc);
if (other && other->mDecoder) {
// Clone it.
@ -2525,11 +2527,9 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded,
if (!window) {
return nullptr;
}
#ifdef MOZ_EME
if (ContainsRestrictedContent()) {
return nullptr;
}
#endif
if (!mOutputStreams.IsEmpty() &&
aGraph != mOutputStreams[0].mStream->GetInputStream()->Graph()) {
@ -3463,7 +3463,6 @@ void HTMLMediaElement::HiddenVideoStop()
mVideoDecodeSuspendTimer = nullptr;
}
#ifdef MOZ_EME
void
HTMLMediaElement::ReportEMETelemetry()
{
@ -3475,7 +3474,6 @@ HTMLMediaElement::ReportEMETelemetry()
this, mLoadedDataFired ? "true" : "false"));
}
}
#endif
void
HTMLMediaElement::ReportTelemetry()
@ -3832,7 +3830,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
ms.mFinishWhenEnded);
}
#ifdef MOZ_EME
if (mMediaKeys) {
if (mMediaKeys->GetCDMProxy()) {
mDecoder->SetCDMProxy(mMediaKeys->GetCDMProxy());
@ -3842,7 +3839,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
return NS_ERROR_FAILURE;
}
}
#endif
MediaEventSource<void>* waitingForKeyProducer = mDecoder->WaitingForKeyEvent();
// Not every decoder will produce waitingForKey events, only add ones that can
@ -4305,11 +4301,7 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
SetMediaInfo(*aInfo);
mIsEncrypted = aInfo->IsEncrypted()
#ifdef MOZ_EME
|| mPendingEncryptedInitData.IsEncrypted()
#endif // MOZ_EME
;
mIsEncrypted = aInfo->IsEncrypted() || mPendingEncryptedInitData.IsEncrypted();
mTags = aTags.forget();
mLoadedDataFired = false;
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
@ -4335,13 +4327,11 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
return;
}
#ifdef MOZ_EME
// Dispatch a distinct 'encrypted' event for each initData we have.
for (const auto& initData : mPendingEncryptedInitData.mInitDatas) {
DispatchEncrypted(initData.mInitData, initData.mType);
}
mPendingEncryptedInitData.mInitDatas.Clear();
#endif // MOZ_EME
}
mWatchManager.ManualNotify(&HTMLMediaElement::UpdateReadyStateInternal);
@ -4871,17 +4861,14 @@ void HTMLMediaElement::ChangeReadyState(nsMediaReadyState aState)
if (oldState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
mReadyState >= nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA) {
DispatchAsyncEvent(NS_LITERAL_STRING("canplay"));
if (!mPaused) {
mWaitingForKey = false;
DispatchAsyncEvent(NS_LITERAL_STRING("playing"));
}
}
CheckAutoplayDataReady();
if (oldState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
mReadyState >= nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
IsPotentiallyPlaying()) {
mWaitingForKey = false;
DispatchAsyncEvent(NS_LITERAL_STRING("playing"));
}
if (oldState < nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA &&
mReadyState >= nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA) {
DispatchAsyncEvent(NS_LITERAL_STRING("canplaythrough"));
@ -4990,6 +4977,8 @@ void HTMLMediaElement::CheckAutoplayDataReady()
// For blocked media, the event would be pending until it is resumed.
DispatchAsyncEvent(NS_LITERAL_STRING("play"));
DispatchAsyncEvent(NS_LITERAL_STRING("playing"));
}
bool HTMLMediaElement::IsActive() const
@ -5260,11 +5249,8 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
UpdateAudioChannelPlayingState();
if (aPauseElement) {
ReportTelemetry();
#ifdef MOZ_EME
ReportEMETelemetry();
#endif
#ifdef MOZ_EME
// For EME content, force destruction of the CDM client (and CDM
// instance if this is the last client for that CDM instance) and
// the CDM's decoder. This ensures the CDM gets reliable and prompt
@ -5277,16 +5263,13 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
ShutdownDecoder();
}
}
#endif
if (mDecoder) {
mDecoder->Pause();
mDecoder->Suspend();
}
mEventDeliveryPaused = aSuspendEvents;
} else {
#ifdef MOZ_EME
MOZ_ASSERT(!mMediaKeys);
#endif
if (mDecoder) {
mDecoder->Resume();
if (!mPaused && !mDecoder->IsEnded()) {
@ -6069,7 +6052,7 @@ HTMLMediaElement::OnVisibilityChange(Visibility aNewVisibility)
}
}
#ifdef MOZ_EME
MediaKeys*
HTMLMediaElement::GetMediaKeys() const
{
@ -6275,7 +6258,6 @@ HTMLMediaElement::GetTopLevelPrincipal()
principal = doc->NodePrincipal();
return principal.forget();
}
#endif // MOZ_EME
void
HTMLMediaElement::CannotDecryptWaitingForKey()

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

@ -20,9 +20,7 @@
#include "mozilla/dom/TextTrackManager.h"
#include "mozilla/WeakPtr.h"
#include "MediaDecoder.h"
#ifdef MOZ_EME
#include "mozilla/dom/MediaKeys.h"
#endif
#include "mozilla/StateWatching.h"
#include "nsGkAtoms.h"
#include "PrincipalChangeObserver.h"
@ -626,7 +624,6 @@ public:
// XPCOM MozPreservesPitch() is OK
#ifdef MOZ_EME
MediaKeys* GetMediaKeys() const;
already_AddRefed<Promise> SetMediaKeys(MediaKeys* mediaKeys,
@ -648,7 +645,6 @@ public:
already_AddRefed<nsIPrincipal> GetTopLevelPrincipal();
bool ContainsRestrictedContent();
#endif // MOZ_EME
void CannotDecryptWaitingForKey();
@ -1191,9 +1187,8 @@ protected:
*/
void HiddenVideoStop();
#ifdef MOZ_EME
void ReportEMETelemetry();
#endif
void ReportTelemetry();
// Check the permissions for audiochannel.
@ -1452,10 +1447,8 @@ protected:
// Timer used to simulate video-suspend.
nsCOMPtr<nsITimer> mVideoDecodeSuspendTimer;
#ifdef MOZ_EME
// Encrypted Media Extension media keys.
RefPtr<MediaKeys> mMediaKeys;
#endif
// Stores the time at the start of the current 'played' range.
double mCurrentPlayRangeStart;
@ -1604,10 +1597,8 @@ protected:
// Listens for waitingForKey events from the owned decoder.
MediaEventListener mWaitingForKeyListener;
#ifdef MOZ_EME
// Init Data that needs to be sent in 'encrypted' events in MetadataLoaded().
EncryptionInfo mPendingEncryptedInitData;
#endif // MOZ_EME
// True if the media's channel's download has been suspended.
Watchable<bool> mDownloadSuspendedByCache;

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

@ -46,9 +46,7 @@
#include "mozilla/dom/ExternalHelperAppParent.h"
#include "mozilla/dom/GetFilesHelper.h"
#include "mozilla/dom/GeolocationBinding.h"
#ifdef MOZ_EME
#include "mozilla/dom/MediaKeySystemAccess.h"
#endif
#include "mozilla/dom/Notification.h"
#include "mozilla/dom/PContentBridgeParent.h"
#include "mozilla/dom/PContentPermissionRequestParent.h"
@ -975,14 +973,9 @@ ContentParent::RecvIsGMPPresentOnDisk(const nsString& aKeySystem,
bool* aIsPresent,
nsCString* aMessage)
{
#ifdef MOZ_EME
*aIsPresent = MediaKeySystemAccess::IsGMPPresentOnDisk(aKeySystem,
aVersion,
*aMessage);
#else
*aIsPresent = false;
#endif
return true;
}

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

@ -30,9 +30,7 @@ class MediaResource;
class ReentrantMonitor;
class VideoFrameContainer;
class MediaDecoderOwner;
#ifdef MOZ_EME
class CDMProxy;
#endif
typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;

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

@ -311,13 +311,10 @@ MediaDecoder::IsHeuristicDormantSupported() const
{
MOZ_ASSERT(NS_IsMainThread());
return
#if defined(MOZ_EME)
// We disallow dormant for encrypted media until bug 1181864 is fixed.
mInfo &&
!mInfo->IsEncrypted() &&
#endif
mIsHeuristicDormantSupported;
// We disallow dormant for encrypted media until bug 1181864 is fixed.
return mInfo &&
!mInfo->IsEncrypted() &&
mIsHeuristicDormantSupported;
}
void
@ -494,9 +491,7 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
, mLogicalPosition(0.0)
, mDuration(std::numeric_limits<double>::quiet_NaN())
, mResourceCallback(new ResourceCallback())
#ifdef MOZ_EME
, mCDMProxyPromise(mCDMProxyPromiseHolder.Ensure(__func__))
#endif
, mIgnoreProgressData(false)
, mInfiniteStream(false)
, mOwner(aOwner)
@ -592,9 +587,7 @@ MediaDecoder::Shutdown()
mResourceCallback->Disconnect();
#ifdef MOZ_EME
mCDMProxyPromiseHolder.RejectIfExists(true, __func__);
#endif
DiscardOngoingSeekIfExists();
@ -1707,7 +1700,6 @@ MediaDecoder::CanPlayThrough()
return GetStatistics().CanPlayThrough();
}
#ifdef MOZ_EME
RefPtr<MediaDecoder::CDMProxyPromise>
MediaDecoder::RequestCDMProxy() const
{
@ -1722,7 +1714,6 @@ MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
mCDMProxyPromiseHolder.ResolveIfExists(aProxy, __func__);
}
#endif
bool
MediaDecoder::IsOpusEnabled()

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

@ -7,11 +7,8 @@
#if !defined(MediaDecoder_h_)
#define MediaDecoder_h_
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
#include "mozilla/Atomics.h"
#include "mozilla/CDMProxy.h"
#include "mozilla/MozPromise.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/StateMirroring.h"
@ -444,7 +441,6 @@ private:
MediaDecoderOwner* GetOwner() const override;
#ifdef MOZ_EME
typedef MozPromise<RefPtr<CDMProxy>, bool /* aIgnored */, /* IsExclusive = */ true> CDMProxyPromise;
// Resolved when a CDMProxy is available and the capabilities are known or
@ -452,7 +448,6 @@ private:
RefPtr<CDMProxyPromise> RequestCDMProxy() const;
void SetCDMProxy(CDMProxy* aProxy);
#endif
void EnsureTelemetryReported();
@ -620,10 +615,8 @@ private:
RefPtr<ResourceCallback> mResourceCallback;
#ifdef MOZ_EME
MozPromiseHolder<CDMProxyPromise> mCDMProxyPromiseHolder;
RefPtr<CDMProxyPromise> mCDMProxyPromise;
#endif
protected:
// The promise resolving/rejection is queued as a "micro-task" which will be

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

@ -143,13 +143,11 @@ public:
// reference to the decoder to prevent further calls into the decoder.
virtual void NotifyXPCOMShutdown() = 0;
#ifdef MOZ_EME
// Dispatches a "encrypted" event to the HTMLMediaElement, with the
// provided init data. Actual dispatch may be delayed until HAVE_METADATA.
// Main thread only.
virtual void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
const nsAString& aInitDataType) = 0;
#endif // MOZ_EME
};
} // namespace mozilla

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

@ -186,9 +186,7 @@ public:
// when to call SetIdle().
virtual void SetIdle() {}
#ifdef MOZ_EME
virtual void SetCDMProxy(CDMProxy* aProxy) {}
#endif
// Tell the reader that the data decoded are not for direct playback, so it
// can accept more files, in particular those which have more channels than

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

@ -116,9 +116,7 @@ public:
return mReader->CanonicalIsSuspended();
}
#ifdef MOZ_EME
void SetCDMProxy(CDMProxy* aProxy) { mReader->SetCDMProxy(aProxy); }
#endif
void SetVideoBlankDecode(bool aIsBlankDecode);

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

@ -317,12 +317,7 @@ private:
// feeding in the CDM, which we need to decode the first frame (and
// thus get the metadata). We could fix this if we could compute the start
// time by demuxing without necessaring decoding.
bool waitingForCDM =
#ifdef MOZ_EME
mMaster->mInfo.IsEncrypted() && !mMaster->mCDMProxy;
#else
false;
#endif
bool waitingForCDM = mMaster->mInfo.IsEncrypted() && !mMaster->mCDMProxy;
mMaster->mNotifyMetadataBeforeFirstFrame =
mMaster->mDuration.Ref().isSome() || waitingForCDM;
@ -1346,12 +1341,10 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
mMediaSink = CreateMediaSink(mAudioCaptured);
#ifdef MOZ_EME
mCDMProxyPromise.Begin(aDecoder->RequestCDMProxy()->Then(
OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnCDMProxyReady,
&MediaDecoderStateMachine::OnCDMProxyNotReady));
#endif
nsresult rv = mReader->Init();
NS_ENSURE_SUCCESS(rv, rv);
@ -1678,9 +1671,7 @@ MediaDecoderStateMachine::Shutdown()
// dispose of the timer.
mVideoDecodeSuspendTimer.Reset();
#ifdef MOZ_EME
mCDMProxyPromise.DisconnectIfExists();
#endif
if (IsPlaying()) {
StopPlayback();
@ -2392,6 +2383,10 @@ bool MediaDecoderStateMachine::HasLowBufferedData(int64_t aUsecs)
int64_t start = endOfDecodedData;
int64_t end = std::min(GetMediaTime() + aUsecs, Duration().ToMicroseconds());
if (start >= end) {
// Duration of decoded samples is greater than our threshold.
return false;
}
media::TimeInterval interval(media::TimeUnit::FromMicroseconds(start),
media::TimeUnit::FromMicroseconds(end));
return !mBuffered.Ref().Contains(interval);
@ -2907,7 +2902,6 @@ void MediaDecoderStateMachine::OnMediaSinkAudioError(nsresult aResult)
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__));
}
#ifdef MOZ_EME
void
MediaDecoderStateMachine::OnCDMProxyReady(RefPtr<CDMProxy> aProxy)
{
@ -2924,7 +2918,6 @@ MediaDecoderStateMachine::OnCDMProxyNotReady()
MOZ_ASSERT(OnTaskQueue());
mCDMProxyPromise.Complete();
}
#endif
void
MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured)

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

@ -873,12 +873,10 @@ private:
// Playback will not start when audio is offloading.
bool mAudioOffloading;
#ifdef MOZ_EME
void OnCDMProxyReady(RefPtr<CDMProxy> aProxy);
void OnCDMProxyNotReady();
RefPtr<CDMProxy> mCDMProxy;
MozPromiseRequestHolder<MediaDecoder::CDMProxyPromise> mCDMProxyPromise;
#endif
private:
// The buffered range. Mirrored from the decoder thread.

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

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/CDMProxy.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
@ -21,10 +22,6 @@
#include <algorithm>
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
using namespace mozilla::media;
using mozilla::layers::Image;
@ -185,7 +182,6 @@ MediaFormatReader::Init()
return NS_OK;
}
#ifdef MOZ_EME
class DispatchKeyNeededEvent : public Runnable {
public:
DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder,
@ -223,16 +219,11 @@ MediaFormatReader::SetCDMProxy(CDMProxy* aProxy)
});
OwnerThread()->Dispatch(r.forget());
}
#endif // MOZ_EME
bool
MediaFormatReader::IsWaitingOnCDMResource() {
MOZ_ASSERT(OnTaskQueue());
#ifdef MOZ_EME
return IsEncrypted() && !mCDMProxy;
#else
return false;
#endif
}
RefPtr<MediaDecoderReader::MetadataPromise>
@ -337,13 +328,11 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
UniquePtr<EncryptionInfo> crypto = mDemuxer->GetCrypto();
if (mDecoder && crypto && crypto->IsEncrypted()) {
#ifdef MOZ_EME
// Try and dispatch 'encrypted'. Won't go if ready state still HAVE_NOTHING.
for (uint32_t i = 0; i < crypto->mInitDatas.Length(); i++) {
NS_DispatchToMainThread(
new DispatchKeyNeededEvent(mDecoder, crypto->mInitDatas[i].mInitData, crypto->mInitDatas[i].mType));
}
#endif // MOZ_EME
mInfo.mCrypto = *crypto;
}
@ -400,12 +389,8 @@ MediaFormatReader::EnsureDecoderCreated(TrackType aTrack)
if (!mPlatform) {
mPlatform = new PDMFactory();
if (IsEncrypted()) {
#ifdef MOZ_EME
MOZ_ASSERT(mCDMProxy);
mPlatform->SetCDMProxy(mCDMProxy);
#else
return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, "EME not supported");
#endif
}
}

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

@ -93,9 +93,7 @@ public:
return mTrackDemuxersMayBlock;
}
#ifdef MOZ_EME
void SetCDMProxy(CDMProxy* aProxy) override;
#endif
// Returns a string describing the state of the decoder data.
// Used for debugging purposes.
@ -565,9 +563,8 @@ private:
RefPtr<VideoFrameContainer> mVideoFrameContainer;
layers::ImageContainer* GetImageContainer();
#ifdef MOZ_EME
RefPtr<CDMProxy> mCDMProxy;
#endif
RefPtr<GMPCrashHelper> mCrashHelper;
void SetBlankDecode(TrackType aTrack, bool aIsBlankDecode);

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

@ -222,7 +222,9 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest)
int64_t contentLength = -1;
hc->GetContentLength(&contentLength);
if (contentLength >= 0 && responseStatus == HTTP_OK_CODE) {
if (contentLength >= 0 &&
(responseStatus == HTTP_OK_CODE ||
responseStatus == HTTP_PARTIAL_RESPONSE_CODE)) {
// "OK" status means Content-Length is for the whole resource.
// Since that's bounded, we know we have a finite-length resource.
dataIsBounded = true;

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

@ -9,9 +9,7 @@
#include "MP4Demuxer.h"
#include "mozilla/Preferences.h"
#include "nsCharSeparatedTokenizer.h"
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
#include "mozilla/Logging.h"
#include "mozilla/SharedThreadPool.h"
#include "nsMimeTypes.h"

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

@ -41,10 +41,8 @@ using CrashReporter::GetIDFromMinidump;
#include "WMFDecoderModule.h"
#endif
#ifdef MOZ_EME
#include "mozilla/dom/WidevineCDMManifestBinding.h"
#include "widevine-adapter/WidevineAdapter.h"
#endif
namespace mozilla {
@ -810,7 +808,6 @@ GMPParent::ReadGMPMetaData()
return ReadGMPInfoFile(infoFile);
}
#ifdef MOZ_EME
// Maybe this is the Widevine adapted plugin?
nsCOMPtr<nsIFile> manifestFile;
rv = mDirectory->Clone(getter_AddRefs(manifestFile));
@ -819,9 +816,6 @@ GMPParent::ReadGMPMetaData()
}
manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
return ReadChromiumManifestFile(manifestFile);
#else
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
#endif
}
RefPtr<GenericPromise>
@ -935,7 +929,6 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
LOGD("%s: for '%s'", __FUNCTION__, NS_LossyConvertUTF16toASCII(aJSON).get());
MOZ_ASSERT(NS_IsMainThread());
#ifdef MOZ_EME
mozilla::dom::WidevineCDMManifest m;
if (!m.Init(aJSON)) {
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
@ -970,10 +963,6 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
#endif
return GenericPromise::CreateAndResolve(true, __func__);
#else
MOZ_ASSERT_UNREACHABLE("don't call me if EME isn't enabled");
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
#endif
}
bool

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

@ -35,6 +35,8 @@ EXPORTS += [
'GMPAudioDecoderProxy.h',
'GMPAudioHost.h',
'GMPCallbackBase.h',
'GMPCDMCallbackProxy.h',
'GMPCDMProxy.h',
'GMPChild.h',
'GMPContentChild.h',
'GMPContentParent.h',
@ -71,12 +73,6 @@ EXPORTS += [
'GMPVideoPlaneImpl.h',
]
if CONFIG['MOZ_EME']:
EXPORTS += [
'GMPCDMCallbackProxy.h',
'GMPCDMProxy.h',
]
# We link GMPLoader into xul on B2G/Fennec as its code does not need to be
# covered by a DRM vendor's voucher.
if CONFIG['OS_TARGET'] == 'Android':
@ -91,6 +87,8 @@ UNIFIED_SOURCES += [
'GMPAudioDecoderChild.cpp',
'GMPAudioDecoderParent.cpp',
'GMPAudioHost.cpp',
'GMPCDMCallbackProxy.cpp',
'GMPCDMProxy.cpp',
'GMPChild.cpp',
'GMPContentChild.cpp',
'GMPContentParent.cpp',
@ -122,12 +120,6 @@ UNIFIED_SOURCES += [
'GMPVideoPlaneImpl.cpp',
]
if CONFIG['MOZ_EME']:
UNIFIED_SOURCES += [
'GMPCDMCallbackProxy.cpp',
'GMPCDMProxy.cpp',
]
DIRS += [
'rlz',
'widevine-adapter',

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

@ -34,10 +34,8 @@ public:
void DownloadProgressed() override {}
void UpdateReadyState() override {}
void FirstFrameLoaded() override {}
#ifdef MOZ_EME
void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
const nsAString& aInitDataType) override {}
#endif // MOZ_EME
bool IsActive() const override { return true; }
bool IsHidden() const override { return false; }
void DownloadSuspended() override {}

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

@ -7,6 +7,7 @@
UNIFIED_SOURCES += [
'MockMediaResource.cpp',
'TestAudioCompactor.cpp',
'TestEME.cpp',
'TestGMPCrossOrigin.cpp',
'TestGMPRemoveAndDelete.cpp',
'TestGMPUtils.cpp',
@ -25,11 +26,6 @@ UNIFIED_SOURCES += [
'TestWebMBuffered.cpp',
]
if CONFIG['MOZ_EME']:
UNIFIED_SOURCES += [
'TestEME.cpp',
]
if CONFIG['MOZ_WEBM_ENCODER']:
UNIFIED_SOURCES += [
'TestVideoTrackEncoder.cpp',

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше