Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2016-07-26 11:58:36 +02:00
Родитель 03def5b207 574d0d452b
Коммит dcae5b0335
308 изменённых файлов: 5679 добавлений и 1570 удалений

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

@ -66,33 +66,14 @@ tasks:
env:
# checkout-gecko uses these to check out the source; the inputs
# to `mach taskgraph decision` are all on the command line.
GECKO_BASE_REPOSITORY: 'https://hg.mozilla.org/mozilla-central'
GECKO_BASE_REPOSITORY: 'https://hg.mozilla.org/mozilla-unified'
GECKO_HEAD_REPOSITORY: '{{{url}}}'
GECKO_HEAD_REF: '{{revision}}'
GECKO_HEAD_REV: '{{revision}}'
cache:
level-{{level}}-{{project}}-tc-vcs-public-sources: /home/worker/.tc-vcs/
level-{{level}}-{{project}}-gecko-decision: /home/worker/workspace
features:
taskclusterProxy: true
# Note: This task is built server side without the context or tooling that
# exist in tree so we must hard code the version
image: 'taskcluster/decision:0.1.0'
maxRunTime: 1800
command:
- /bin/bash
- -cx
- >
mkdir -p /home/worker/artifacts &&
checkout-gecko workspace &&
cd workspace/gecko &&
ln -s /home/worker/artifacts artifacts &&
./mach taskgraph decision
# Arguments passed into `mach taskgraph decision`
# TODO use mozilla-unified for the base repository once the tc-vcs
# tar.gz archives are created or tc-vcs isn't being used.
DECISION_ARGS: >
--pushlog-id='{{pushlog_id}}'
--project='{{project}}'
--message='{{comment}}'
@ -104,6 +85,22 @@ tasks:
--head-rev='{{revision}}'
--revision-hash='{{revision_hash}}'
cache:
level-{{level}}-hg-shared: /home/worker/hg-shared
level-{{level}}-{{project}}-gecko-decision: /home/worker/workspace
features:
taskclusterProxy: true
# Note: This task is built server side without the context or tooling that
# exist in tree so we must hard code the version
image: 'taskcluster/decision:0.1.2'
maxRunTime: 1800
command:
- /home/worker/bin/run-decision
artifacts:
'public':
type: 'directory'

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

@ -1042,7 +1042,6 @@ toolbarpaletteitem[place="palette"] > #downloads-button[indicator] > #downloads-
/* Combobox dropdown renderer */
#ContentSelectDropdown > menupopup {
max-height: 350px;
/* The menupopup itself should always be rendered LTR to ensure the scrollbar aligns with
* the dropdown arrow on the dropdown widget. If a menuitem is RTL, its style will be set accordingly */
direction: ltr;

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

@ -223,8 +223,9 @@ nsContextMenu.prototype = {
this.showItem("context-sendvideo", this.onVideo);
this.showItem("context-castvideo", this.onVideo);
this.showItem("context-sendaudio", this.onAudio);
this.setItemAttr("context-sendvideo", "disabled", !this.mediaURL);
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL);
let mediaIsBlob = this.mediaURL.startsWith("blob:");
this.setItemAttr("context-sendvideo", "disabled", !this.mediaURL || mediaIsBlob);
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL || mediaIsBlob);
let shouldShowCast = Services.prefs.getBoolPref("browser.casting.enabled");
// getServicesForVideo alone would be sufficient here (it depends on
// SimpleServiceDiscovery.services), but SimpleServiceDiscovery is guaranteed
@ -382,7 +383,7 @@ nsContextMenu.prototype = {
this.showItem("context-sharelink", shareEnabled && (this.onLink || this.onPlainTextLink) && !this.onMailtoLink);
this.showItem("context-shareimage", shareEnabled && this.onImage);
this.showItem("context-sharevideo", shareEnabled && this.onVideo);
this.setItemAttr("context-sharevideo", "disabled", !this.mediaURL);
this.setItemAttr("context-sharevideo", "disabled", !this.mediaURL || this.mediaURL.startsWith("blob:"));
},
initSpellingItems: function() {
@ -1641,7 +1642,10 @@ nsContextMenu.prototype = {
},
isMediaURLReusable: function(aURL) {
return !/^(?:blob|mediasource):/.test(aURL);
if (aURL.startsWith("blob:")) {
return URL.isValidURL(aURL);
}
return true;
},
toString: function () {

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

@ -368,6 +368,7 @@ add_task(function* test_large_popup() {
select.add(new content.Option("Test" + i));
}
select.options[60].selected = true;
select.focus();
});
@ -388,6 +389,16 @@ add_task(function* test_large_popup() {
ok(rect.top >= browserRect.top, "Popup top position in within browser area");
ok(rect.bottom <= browserRect.bottom, "Popup bottom position in within browser area");
// Don't check the scroll position for the last step as the popup will be cut off.
if (positions.length == 1) {
let cs = window.getComputedStyle(selectPopup);
let bpBottom = parseFloat(cs.paddingBottom) + parseFloat(cs.borderBottomWidth);
is(selectPopup.childNodes[60].getBoundingClientRect().bottom,
selectPopup.getBoundingClientRect().bottom - bpBottom,
"Popup scroll at correct position " + bpBottom);
}
yield hideSelectPopup(selectPopup, false);
position = positions.shift();

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

@ -147,18 +147,6 @@ if test "$CLANG_CXX"; then
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-unknown-warning-option -Wno-return-type-c-linkage"
fi
AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually is a C++ compiler])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
_SAVE_LIBS=$LIBS
LIBS=
AC_TRY_LINK([#include <new>], [int *foo = new int;],,
AC_MSG_RESULT([no])
AC_MSG_ERROR([$CXX $CXXFLAGS $LDFLAGS failed to compile and link a simple C++ source.]))
LIBS=$_SAVE_LIBS
AC_LANG_RESTORE
AC_MSG_RESULT([yes])
if test -n "$DEVELOPER_OPTIONS"; then
MOZ_FORCE_GOLD=1
fi

1
config/external/nss/Makefile.in поставляемый
Просмотреть файл

@ -117,6 +117,7 @@ export MOZ_DEBUG_SYMBOLS
DEFAULT_GMAKE_FLAGS =
DEFAULT_GMAKE_FLAGS += CC='$(CC)'
DEFAULT_GMAKE_FLAGS += MT='$(MT)'
DEFAULT_GMAKE_FLAGS += SOURCE_MD_DIR=$(ABS_DIST)
DEFAULT_GMAKE_FLAGS += SOURCE_MDHEADERS_DIR=$(NSPR_INCLUDE_DIR)
DEFAULT_GMAKE_FLAGS += DIST=$(ABS_DIST)

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

@ -662,14 +662,14 @@ ifdef MSMANIFEST_TOOL
@if test -f $@.manifest; then \
if test -f '$(srcdir)/$@.manifest'; then \
echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
else \
echo 'Embedding manifest from $@.manifest'; \
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
fi; \
elif test -f '$(srcdir)/$@.manifest'; then \
echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
fi
endif # MSVC with manifest tool
ifdef MOZ_PROFILE_GENERATE
@ -697,14 +697,14 @@ ifdef MSMANIFEST_TOOL
@if test -f $@.manifest; then \
if test -f '$(srcdir)/$@.manifest'; then \
echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
else \
echo 'Embedding manifest from $@.manifest'; \
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
fi; \
elif test -f '$(srcdir)/$@.manifest'; then \
echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
fi
endif # MSVC with manifest tool
else
@ -732,7 +732,7 @@ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
$(EXPAND_LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_LIBS) $(OS_LIBS)
ifdef MSMANIFEST_TOOL
@if test -f $@.manifest; then \
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
rm -f $@.manifest; \
fi
endif # MSVC with manifest tool
@ -833,7 +833,7 @@ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
ifdef MSMANIFEST_TOOL
ifdef EMBED_MANIFEST_AT
@if test -f $@.manifest; then \
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
rm -f $@.manifest; \
fi
endif # EMBED_MANIFEST_AT

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

@ -11,5 +11,10 @@
"synthesizeKeyFromKeyTag": true,
"TargetFactory": true,
"waitForTick": true,
}
},
"rules": {
// Tests can always import anything.
"mozilla/reject-some-requires": 0,
},
}

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

@ -15,5 +15,7 @@
"block-scoped-var": 0,
// Allow run_test to be unused in xpcshell
"no-unused-vars": [2, { "varsIgnorePattern": "run_test" }],
// Tests can always import anything.
"mozilla/reject-some-requires": 0,
}
}

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

@ -0,0 +1,12 @@
{
// Extend from the devtools eslintrc.
"extends": "../../.eslintrc",
"rules": {
// The inspector is being migrated to HTML and cleaned of
// chrome-privileged code, so this rule disallows requiring chrome
// code. Some files in the inspector disable this rule still. The
// goal is to enable the rule globally on all files.
"mozilla/reject-some-requires": [2, "^(chrome|chrome:.*|resource:.*|devtools/server/.*|.*\\.jsm)$"],
},
}

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

@ -6,7 +6,9 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
const Services = require("Services");
const promise = require("promise");
const FocusManager = Services.focus;

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

@ -8,7 +8,9 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Cc, Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
const ToolDefinitions = require("devtools/client/definitions").Tools;
const CssLogic = require("devtools/shared/inspector/css-logic");
@ -20,7 +22,9 @@ const {OutputParser} = require("devtools/client/shared/output-parser");
const {PrefObserver, PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils");
const {createChild} = require("devtools/client/inspector/shared/utils");
const {gDevTools} = require("devtools/client/framework/devtools");
/* eslint-disable mozilla/reject-some-requires */
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
/* eslint-enable mozilla/reject-some-requires */
const {getCssProperties} = require("devtools/shared/fronts/css-properties");
loader.lazyRequireGetter(this, "overlays",

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

@ -6,7 +6,9 @@
const l10n = require("gcli/l10n");
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
/* eslint-disable mozilla/reject-some-requires */
const {EyeDropper, HighlighterEnvironment} = require("devtools/server/actors/highlighters");
/* eslint-enable mozilla/reject-some-requires */
const Telemetry = require("devtools/client/shared/telemetry");
exports.items = [{

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

@ -8,7 +8,9 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Cc, Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
var Services = require("Services");
var promise = require("promise");

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

@ -4,7 +4,9 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
const promise = require("promise");
const {Task} = require("devtools/shared/task");

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

@ -6,7 +6,9 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Cc, Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
const {Task} = require("devtools/shared/task");
const {InplaceEditor, editableItem} =
require("devtools/client/shared/inplace-editor");

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

@ -7,7 +7,9 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Cc, Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
// Page size for pageup/pagedown
const PAGE_SIZE = 10;
@ -54,7 +56,9 @@ const {KeyShortcuts} = require("devtools/client/shared/key-shortcuts");
const {template} = require("devtools/shared/gcli/templater");
const nodeConstants = require("devtools/shared/dom-node-constants");
const nodeFilterConstants = require("devtools/shared/dom-node-filter-constants");
/* eslint-disable mozilla/reject-some-requires */
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
/* eslint-enable mozilla/reject-some-requires */
loader.lazyRequireGetter(this, "CSS", "CSS");
loader.lazyGetter(this, "AutocompletePopup", () => {

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

@ -6,7 +6,9 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
const promise = require("promise");
const CssLogic = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/shared/specs/styles");

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

@ -6,10 +6,14 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Cc, Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
const {escapeCSSComment} = require("devtools/shared/css-parsing-utils");
const {getCssProperties} = require("devtools/shared/fronts/css-properties");
/* eslint-disable mozilla/reject-some-requires */
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
/* eslint-enable mozilla/reject-some-requires */
XPCOMUtils.defineLazyGetter(this, "domUtils", function () {
return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);

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

@ -7,11 +7,15 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Cc, Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
const promise = require("promise");
const defer = require("devtools/shared/defer");
const Services = require("Services");
/* eslint-disable mozilla/reject-some-requires */
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
/* eslint-enable mozilla/reject-some-requires */
const {Task} = require("devtools/shared/task");
const {Tools} = require("devtools/client/definitions");
const {l10n} = require("devtools/shared/inspector/css-logic");

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

@ -4,8 +4,12 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
/* eslint-disable mozilla/reject-some-requires */
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
/* eslint-enable mozilla/reject-some-requires */
const {l10n} = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/shared/specs/styles");
const {PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils");

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

@ -4,7 +4,9 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
const {l10n} = require("devtools/shared/inspector/css-logic");
const {getCssProperties} = require("devtools/shared/fronts/css-properties");
const {InplaceEditor, editableField} =

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

@ -6,7 +6,9 @@
"use strict";
/* eslint-disable mozilla/reject-some-requires */
const {Ci} = require("chrome");
/* eslint-enable mozilla/reject-some-requires */
const {parseDeclarations} = require("devtools/shared/css-parsing-utils");
const promise = require("promise");
const {getCSSLexer} = require("devtools/shared/css-lexer");

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

@ -10,7 +10,9 @@ var Services = require("Services");
var EventEmitter = require("devtools/shared/event-emitter");
var Telemetry = require("devtools/client/shared/telemetry");
var { Task } = require("devtools/shared/task");
/* eslint-disable mozilla/reject-some-requires */
var { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
/* eslint-enable mozilla/reject-some-requires */
/**
* This object represents replacement for ToolSidebar

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

@ -5,24 +5,46 @@
"use strict";
(function (factory) {
// This file can be loaded in several different ways. It can be
// require()d, either from the main thread or from a worker thread;
// or it can be imported via Cu.import. These different forms
// explain some of the hairiness of this code.
//
// It's important for the devtools-as-html project that a require()
// on the main thread not use any chrome privileged APIs. Instead,
// the body of the main function can only require() (not Cu.import)
// modules that are available in the devtools content mode. This,
// plus the lack of |console| in workers, results in some gyrations
// in the definition of |console|.
if (this.module && module.id.indexOf("event-emitter") >= 0) {
let console;
if (isWorker) {
console = {
error: () => {}
};
} else {
console = this.console;
}
// require
factory.call(this, require, exports, module);
factory.call(this, require, exports, module, console);
} else {
// Cu.import
// Cu.import. This snippet implements a sort of miniature loader,
// which is responsible for appropriately translating require()
// requests from the client function. This code can use
// Cu.import, because it is never run in the devtools-in-content
// mode.
this.isWorker = false;
const Cu = Components.utils;
let console = Cu.import("resource://gre/modules/Console.jsm", {}).console;
// Bug 1259045: This module is loaded early in firefox startup as a JSM,
// but it doesn't depends on any real module. We can save a few cycles
// and bytes by not loading Loader.jsm.
let require = function (module) {
const Cu = Components.utils;
switch (module) {
case "devtools/shared/defer":
return Cu.import("resource://gre/modules/Promise.jsm", {}).Promise.defer;
case "Services":
return Cu.import("resource://gre/modules/Services.jsm", {}).Services;
case "resource://gre/modules/Console.jsm":
return Cu.import("resource://gre/modules/Console.jsm", {});
case "chrome":
return {
Cu,
@ -31,10 +53,13 @@
}
return null;
};
factory.call(this, require, this, { exports: this });
factory.call(this, require, this, { exports: this }, console);
this.EXPORTED_SYMBOLS = ["EventEmitter"];
}
}).call(this, function (require, exports, module) {
}).call(this, function (require, exports, module, console) {
// ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠
// After this point the code may not use Cu.import, and should only
// require() modules that are "clean-for-content".
let EventEmitter = this.EventEmitter = function () {};
module.exports = EventEmitter;
@ -44,18 +69,13 @@
const defer = require("devtools/shared/defer");
let loggingEnabled = true;
let console = {};
if (!isWorker) {
console = require("resource://gre/modules/Console.jsm").console;
loggingEnabled = Services.prefs.getBoolPref("devtools.dump.emit");
Services.prefs.addObserver("devtools.dump.emit", {
observe: () => {
loggingEnabled = Services.prefs.getBoolPref("devtools.dump.emit");
}
}, false);
} else {
// Workers can't load JSMs, so we can't import Console.jsm here.
console.error = () => {};
}
/**

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

@ -507,19 +507,6 @@ KeyframeEffectReadOnly::GetAnimationOfProperty(nsCSSProperty aProperty) const
return nullptr;
}
bool
KeyframeEffectReadOnly::HasAnimationOfProperties(
const nsCSSProperty* aProperties,
size_t aPropertyCount) const
{
for (size_t i = 0; i < aPropertyCount; i++) {
if (HasAnimationOfProperty(aProperties[i])) {
return true;
}
}
return false;
}
#ifdef DEBUG
bool
SpecifiedKeyframeArraysAreEqual(const nsTArray<Keyframe>& aA,

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

@ -294,8 +294,6 @@ public:
bool HasAnimationOfProperty(nsCSSProperty aProperty) const {
return GetAnimationOfProperty(aProperty) != nullptr;
}
bool HasAnimationOfProperties(const nsCSSProperty* aProperties,
size_t aPropertyCount) const;
const InfallibleTArray<AnimationProperty>& Properties() const {
return mProperties;
}

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

@ -0,0 +1,20 @@
<!doctype html>
<html>
<head>
<title>Bug 1272475 - scale function with an extreme large value</title>
<script>
function test() {
var div = document.createElement("div");
div.setAttribute("style", "width: 1px; height: 1px; " +
"background: red;");
document.body.appendChild(div);
div.animate([ { "transform": "scale(8)" },
{ "transform": "scale(9.5e+307)" },
{ "transform": "scale(32)" } ],
{ "duration": 1000, "fill": "both" });
}
</script>
</head>
<body onload="test()">
</body>
</html>

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

@ -0,0 +1,20 @@
<!doctype html>
<html>
<head>
<title>Bug 1272475 - rotate function with an extreme large value</title>
<script>
function test() {
var div = document.createElement("div");
div.setAttribute("style", "width: 100px; height: 100px; " +
"background: red;");
document.body.appendChild(div);
div.animate([ { "transform": "rotate(8rad)" },
{ "transform": "rotate(9.5e+307rad)" },
{ "transform": "rotate(32rad)" } ],
{ "duration": 1000, "fill": "both" });
}
</script>
</head>
<body onload="test()">
</body>
</html>

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

@ -6,5 +6,7 @@ pref(dom.animations-api.core.enabled,true) load 1216842-3.html
pref(dom.animations-api.core.enabled,true) load 1216842-4.html
pref(dom.animations-api.core.enabled,true) load 1216842-5.html
pref(dom.animations-api.core.enabled,true) load 1216842-6.html
pref(dom.animations-api.core.enabled,true) load 1272475-1.html
pref(dom.animations-api.core.enabled,true) load 1272475-2.html
pref(dom.animations-api.core.enabled,true) load 1278485-1.html
pref(dom.animations-api.core.enabled,true) load 1277272-1.html

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

@ -41,6 +41,7 @@ support-files =
mozilla/file_document-timeline-origin-time-range.html
mozilla/file_hide_and_show.html
mozilla/file_partial_keyframes.html
mozilla/file_transform_limits.html
style/file_animation-seeking-with-current-time.html
style/file_animation-seeking-with-start-time.html
testcommon.js
@ -89,5 +90,6 @@ skip-if = (toolkit == 'gonk' && debug)
[mozilla/test_hide_and_show.html]
[mozilla/test_partial_keyframes.html]
[mozilla/test_set-easing.html]
[mozilla/test_transform_limits.html]
[style/test_animation-seeking-with-current-time.html]
[style/test_animation-seeking-with-start-time.html]

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

@ -0,0 +1,55 @@
<!doctype html>
<meta charset=utf-8>
<script src="../testcommon.js"></script>
<body>
<script>
'use strict';
// We clamp +infinity or -inifinity value in floating point to
// maximum floating point value or -maximum floating point value.
const max_float = 3.40282e+38;
test(function(t) {
var div = addDiv(t);
div.style = "width: 1px; height: 1px;";
var anim = div.animate([ { transform: 'scale(1)' },
{ transform: 'scale(3.5e+38)'},
{ transform: 'scale(3)' } ], 100 * MS_PER_SEC);
anim.pause();
anim.currentTime = 50 * MS_PER_SEC;
assert_equals(getComputedStyle(div).transform,
'matrix(' + max_float + ', 0, 0, ' + max_float + ', 0, 0)');
}, 'Test that the parameter of transform scale is clamped' );
test(function(t) {
var div = addDiv(t);
div.style = "width: 1px; height: 1px;";
var anim = div.animate([ { transform: 'translate(1px)' },
{ transform: 'translate(3.5e+38px)'},
{ transform: 'translate(3px)' } ], 100 * MS_PER_SEC);
anim.pause();
anim.currentTime = 50 * MS_PER_SEC;
assert_equals(getComputedStyle(div).transform,
'matrix(1, 0, 0, 1, ' + max_float + ', 0)');
}, 'Test that the parameter of transform translate is clamped' );
test(function(t) {
var div = addDiv(t);
div.style = "width: 1px; height: 1px;";
var anim = div.animate([ { transform: 'matrix(0.5, 0, 0, 0.5, 0, 0)' },
{ transform: 'matrix(2, 0, 0, 2, 3.5e+38, 0)'},
{ transform: 'matrix(0, 2, 0, -2, 0, 0)' } ],
100 * MS_PER_SEC);
anim.pause();
anim.currentTime = 50 * MS_PER_SEC;
assert_equals(getComputedStyle(div).transform,
'matrix(2, 0, 0, 2, ' + max_float + ', 0)');
}, 'Test that the parameter of transform matrix is clamped' );
done();
</script>
</body>

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

@ -0,0 +1,14 @@
<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
'use strict';
setup({explicit_done: true});
SpecialPowers.pushPrefEnv(
{ "set": [["dom.animations-api.core.enabled", true]]},
function() {
window.open("file_transform_limits.html");
});
</script>

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

@ -0,0 +1,113 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/CustomElementsRegistry.h"
#include "mozilla/dom/CustomElementsRegistryBinding.h"
#include "mozilla/dom/WebComponentsBinding.h"
namespace mozilla {
namespace dom {
// Only needed for refcounted objects.
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CustomElementsRegistry, mWindow)
NS_IMPL_CYCLE_COLLECTING_ADDREF(CustomElementsRegistry)
NS_IMPL_CYCLE_COLLECTING_RELEASE(CustomElementsRegistry)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CustomElementsRegistry)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
/* static */ bool
CustomElementsRegistry::IsCustomElementsEnabled(JSContext* aCx, JSObject* aObject)
{
JS::Rooted<JSObject*> obj(aCx, aObject);
if (Preferences::GetBool("dom.webcomponents.customelements.enabled") ||
nsDocument::IsWebComponentsEnabled(aCx, obj)) {
return true;
}
return false;
}
/* static */ already_AddRefed<CustomElementsRegistry>
CustomElementsRegistry::Create(nsPIDOMWindowInner* aWindow)
{
MOZ_ASSERT(aWindow);
MOZ_ASSERT(aWindow->IsInnerWindow());
if (!aWindow->GetDocShell()) {
return nullptr;
}
RefPtr<CustomElementsRegistry> customElementsRegistry =
new CustomElementsRegistry(aWindow);
return customElementsRegistry.forget();
}
CustomElementsRegistry::CustomElementsRegistry(nsPIDOMWindowInner* aWindow)
: mWindow(aWindow)
{
}
CustomElementsRegistry::~CustomElementsRegistry()
{
}
JSObject*
CustomElementsRegistry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return CustomElementsRegistryBinding::Wrap(aCx, this, aGivenProto);
}
nsISupports* CustomElementsRegistry::GetParentObject() const
{
return mWindow;
}
void CustomElementsRegistry::Define(const nsAString& aName,
Function& aFunctionConstructor,
const ElementDefinitionOptions& aOptions,
ErrorResult& aRv)
{
// TODO: This function will be implemented in bug 1275835
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
CustomElementsRegistry::Get(JSContext* aCx, const nsAString& aName,
JS::MutableHandle<JS::Value> aRetVal,
ErrorResult& aRv)
{
// TODO: This function will be implemented in bug 1275838
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
already_AddRefed<Promise>
CustomElementsRegistry::WhenDefined(const nsAString& name, ErrorResult& aRv)
{
// TODO: This function will be implemented in bug 1275839
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
return nullptr;
}
CustomElementDefinition::CustomElementDefinition(JSObject* aPrototype,
nsIAtom* aType,
nsIAtom* aLocalName,
LifecycleCallbacks* aCallbacks,
uint32_t aNamespaceID,
uint32_t aDocOrder)
: mPrototype(aPrototype),
mType(aType),
mLocalName(aLocalName),
mCallbacks(aCallbacks),
mNamespaceID(aNamespaceID),
mDocOrder(aDocOrder)
{
}
} // namespace dom
} // namespace mozilla

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

@ -0,0 +1,136 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_CustomElementsRegistry_h
#define mozilla_dom_CustomElementsRegistry_h
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/FunctionBinding.h"
namespace mozilla {
namespace dom {
struct ElementDefinitionOptions;
struct LifecycleCallbacks;
class Function;
class Promise;
class CustomElementHashKey : public PLDHashEntryHdr
{
public:
typedef CustomElementHashKey *KeyType;
typedef const CustomElementHashKey *KeyTypePointer;
CustomElementHashKey(int32_t aNamespaceID, nsIAtom *aAtom)
: mNamespaceID(aNamespaceID),
mAtom(aAtom)
{}
explicit CustomElementHashKey(const CustomElementHashKey* aKey)
: mNamespaceID(aKey->mNamespaceID),
mAtom(aKey->mAtom)
{}
~CustomElementHashKey()
{}
KeyType GetKey() const { return const_cast<KeyType>(this); }
bool KeyEquals(const KeyTypePointer aKey) const
{
MOZ_ASSERT(mNamespaceID != kNameSpaceID_Unknown,
"This equals method is not transitive, nor symmetric. "
"A key with a namespace of kNamespaceID_Unknown should "
"not be stored in a hashtable.");
return (kNameSpaceID_Unknown == aKey->mNamespaceID ||
mNamespaceID == aKey->mNamespaceID) &&
aKey->mAtom == mAtom;
}
static KeyTypePointer KeyToPointer(KeyType aKey) { return aKey; }
static PLDHashNumber HashKey(const KeyTypePointer aKey)
{
return aKey->mAtom->hash();
}
enum { ALLOW_MEMMOVE = true };
private:
int32_t mNamespaceID;
nsCOMPtr<nsIAtom> mAtom;
};
// The required information for a custom element as defined in:
// https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html
struct CustomElementDefinition
{
CustomElementDefinition(JSObject* aPrototype,
nsIAtom* aType,
nsIAtom* aLocalName,
mozilla::dom::LifecycleCallbacks* aCallbacks,
uint32_t aNamespaceID,
uint32_t aDocOrder);
// The prototype to use for new custom elements of this type.
JS::Heap<JSObject *> mPrototype;
// The type (name) for this custom element.
nsCOMPtr<nsIAtom> mType;
// The localname to (e.g. <button is=type> -- this would be button).
nsCOMPtr<nsIAtom> mLocalName;
// The lifecycle callbacks to call for this custom element.
nsAutoPtr<mozilla::dom::LifecycleCallbacks> mCallbacks;
// Whether we're currently calling the created callback for a custom element
// of this type.
bool mElementIsBeingCreated;
// Element namespace.
int32_t mNamespaceID;
// The document custom element order.
uint32_t mDocOrder;
};
class CustomElementsRegistry final : public nsISupports,
public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CustomElementsRegistry)
public:
static bool IsCustomElementsEnabled(JSContext* aCx, JSObject* aObject);
static already_AddRefed<CustomElementsRegistry> Create(nsPIDOMWindowInner* aWindow);
already_AddRefed<nsIDocument> GetOwnerDocument() const;
private:
explicit CustomElementsRegistry(nsPIDOMWindowInner* aWindow);
~CustomElementsRegistry();
nsCOMPtr<nsPIDOMWindowInner> mWindow;
public:
nsISupports* GetParentObject() const;
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
void Define(const nsAString& aName, Function& aFunctionConstructor,
const ElementDefinitionOptions& aOptions, ErrorResult& aRv);
void Get(JSContext* cx, const nsAString& name,
JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv);
already_AddRefed<Promise> WhenDefined(const nsAString& name, ErrorResult& aRv);
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_CustomElementsRegistry_h

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

@ -560,7 +560,7 @@ File::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
if (!nsContentUtils::ThreadsafeIsCallerChrome()) {
aRv.Throw(NS_ERROR_FAILURE);
aRv.ThrowTypeError<MSG_NOT_SEQUENCE>(NS_LITERAL_STRING("Argument 1 of File.constructor"));
return nullptr;
}

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

@ -156,6 +156,7 @@ EXPORTS.mozilla.dom += [
'ChromeNodeList.h',
'ChromeUtils.h',
'Comment.h',
'CustomElementsRegistry.h',
'DirectionalityUtils.h',
'DocumentFragment.h',
'DocumentType.h',
@ -216,6 +217,7 @@ UNIFIED_SOURCES += [
'ChromeUtils.cpp',
'Comment.cpp',
'Crypto.cpp',
'CustomElementsRegistry.cpp',
'DirectionalityUtils.cpp',
'DocumentFragment.cpp',
'DocumentType.cpp',

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

@ -30,6 +30,7 @@
#ifdef MOZ_FMP4
#include "MP4Decoder.h"
#endif
#include "CubebUtils.h"
#include "nsIScrollableFrame.h"
@ -2326,6 +2327,13 @@ nsDOMWindowUtils::GetSupportsHardwareH264Decoding(JS::MutableHandle<JS::Value> a
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetCurrentAudioBackend(nsAString& aBackend)
{
CubebUtils::GetCurrentBackend(aBackend);
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::StartFrameTimeRecording(uint32_t *startIndex)
{

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

@ -469,21 +469,6 @@ CustomElementCallback::CustomElementCallback(Element* aThisObject,
{
}
CustomElementDefinition::CustomElementDefinition(JSObject* aPrototype,
nsIAtom* aType,
nsIAtom* aLocalName,
LifecycleCallbacks* aCallbacks,
uint32_t aNamespaceID,
uint32_t aDocOrder)
: mPrototype(aPrototype),
mType(aType),
mLocalName(aLocalName),
mCallbacks(aCallbacks),
mNamespaceID(aNamespaceID),
mDocOrder(aDocOrder)
{
}
CustomElementData::CustomElementData(nsIAtom* aType)
: mType(aType),
mCurrentCallback(-1),
@ -4768,7 +4753,8 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
}
MaybeRescheduleAnimationFrameNotifications();
if (Preferences::GetBool("dom.webcomponents.enabled")) {
if (Preferences::GetBool("dom.webcomponents.enabled") ||
Preferences::GetBool("dom.webcomponents.customelements.enabled")) {
mRegistry = new Registry();
}
}

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

@ -68,6 +68,7 @@
#include "jsfriendapi.h"
#include "ImportManager.h"
#include "mozilla/LinkedList.h"
#include "CustomElementsRegistry.h"
#define XML_DECLARATION_BITS_DECLARATION_EXISTS (1 << 0)
#define XML_DECLARATION_BITS_ENCODING_EXISTS (1 << 1)
@ -132,7 +133,7 @@ public:
* and 'id' mappings of a given string. This is so that
* nsHTMLDocument::ResolveName only has to do one hash lookup instead
* of two. It's not clear whether this still matters for performance.
*
*
* We also store the document.all result list here. This is mainly so that
* when all elements with the given ID are removed and we remove
* the ID's nsIdentifierMapEntry, the document.all result is released too.
@ -263,48 +264,6 @@ private:
namespace mozilla {
namespace dom {
class CustomElementHashKey : public PLDHashEntryHdr
{
public:
typedef CustomElementHashKey *KeyType;
typedef const CustomElementHashKey *KeyTypePointer;
CustomElementHashKey(int32_t aNamespaceID, nsIAtom *aAtom)
: mNamespaceID(aNamespaceID),
mAtom(aAtom)
{}
explicit CustomElementHashKey(const CustomElementHashKey* aKey)
: mNamespaceID(aKey->mNamespaceID),
mAtom(aKey->mAtom)
{}
~CustomElementHashKey()
{}
KeyType GetKey() const { return const_cast<KeyType>(this); }
bool KeyEquals(const KeyTypePointer aKey) const
{
MOZ_ASSERT(mNamespaceID != kNameSpaceID_Unknown,
"This equals method is not transitive, nor symmetric. "
"A key with a namespace of kNamespaceID_Unknown should "
"not be stored in a hashtable.");
return (kNameSpaceID_Unknown == aKey->mNamespaceID ||
mNamespaceID == aKey->mNamespaceID) &&
aKey->mAtom == mAtom;
}
static KeyTypePointer KeyToPointer(KeyType aKey) { return aKey; }
static PLDHashNumber HashKey(const KeyTypePointer aKey)
{
return aKey->mAtom->hash();
}
enum { ALLOW_MEMMOVE = true };
private:
int32_t mNamespaceID;
nsCOMPtr<nsIAtom> mAtom;
};
struct LifecycleCallbackArgs
{
nsString name;
@ -376,40 +335,6 @@ private:
virtual ~CustomElementData() {}
};
// The required information for a custom element as defined in:
// https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html
struct CustomElementDefinition
{
CustomElementDefinition(JSObject* aPrototype,
nsIAtom* aType,
nsIAtom* aLocalName,
mozilla::dom::LifecycleCallbacks* aCallbacks,
uint32_t aNamespaceID,
uint32_t aDocOrder);
// The prototype to use for new custom elements of this type.
JS::Heap<JSObject *> mPrototype;
// The type (name) for this custom element.
nsCOMPtr<nsIAtom> mType;
// The localname to (e.g. <button is=type> -- this would be button).
nsCOMPtr<nsIAtom> mLocalName;
// The lifecycle callbacks to call for this custom element.
nsAutoPtr<mozilla::dom::LifecycleCallbacks> mCallbacks;
// Whether we're currently calling the created callback for a custom element
// of this type.
bool mElementIsBeingCreated;
// Element namespace.
int32_t mNamespaceID;
// The document custom element order.
uint32_t mDocOrder;
};
class Registry : public nsISupports
{
public:
@ -616,7 +541,7 @@ protected:
// don't hand out references to the docshell. The shims should all allow
// getInterface back on us, but other than that each one should only
// implement one interface.
// XXXbz I wish we could just derive the _allcaps thing from _i
#define DECL_SHIM(_i, _allcaps) \
class _i##Shim final : public nsIInterfaceRequestor, \
@ -655,7 +580,7 @@ protected:
nsresult AddExternalResource(nsIURI* aURI, nsIContentViewer* aViewer,
nsILoadGroup* aLoadGroup,
nsIDocument* aDisplayDocument);
nsClassHashtable<nsURIHashKey, ExternalResource> mMap;
nsRefPtrHashtable<nsURIHashKey, PendingLoad> mPendingLoads;
bool mHaveShutDown;

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

@ -1565,6 +1565,7 @@ nsGlobalWindow::CleanUp()
mScrollbars = nullptr;
mLocation = nullptr;
mHistory = nullptr;
mCustomElements = nullptr;
mFrames = nullptr;
mWindowUtils = nullptr;
mApplicationCache = nullptr;
@ -1695,6 +1696,7 @@ nsGlobalWindow::FreeInnerObjects()
mLocation = nullptr;
mHistory = nullptr;
mCustomElements = nullptr;
if (mNavigator) {
mNavigator->OnNavigation();
@ -1877,6 +1879,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLocation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mHistory)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCustomElements)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLocalStorage)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSessionStorage)
@ -1950,6 +1953,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
}
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLocation)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mHistory)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCustomElements)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLocalStorage)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSessionStorage)
if (tmp->mApplicationCache) {
@ -3832,6 +3836,17 @@ nsGlobalWindow::GetHistory(ErrorResult& aError)
return mHistory;
}
CustomElementsRegistry*
nsGlobalWindow::CustomElements()
{
MOZ_RELEASE_ASSERT(IsInnerWindow());
if (!mCustomElements) {
mCustomElements = CustomElementsRegistry::Create(AsInner());
}
return mCustomElements;
}
Performance*
nsPIDOMWindowInner::GetPerformance()
{

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

@ -106,6 +106,7 @@ class BarProp;
struct ChannelPixelLayout;
class Console;
class Crypto;
class CustomElementsRegistry;
class External;
class Function;
class Gamepad;
@ -205,7 +206,6 @@ public:
// stack depth at which timeout is firing
uint32_t mFiringDepth;
//
uint32_t mNestingLevel;
// The popup state at timeout creation time if not created from
@ -878,6 +878,7 @@ public:
nsLocation* GetLocation(mozilla::ErrorResult& aError);
nsIDOMLocation* GetLocation() override;
nsHistory* GetHistory(mozilla::ErrorResult& aError);
mozilla::dom::CustomElementsRegistry* CustomElements() override;
mozilla::dom::BarProp* GetLocationbar(mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetMenubar(mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetPersonalbar(mozilla::ErrorResult& aError);
@ -1838,6 +1839,7 @@ protected:
uint32_t mTimeoutFiringDepth;
RefPtr<nsLocation> mLocation;
RefPtr<nsHistory> mHistory;
RefPtr<mozilla::dom::CustomElementsRegistry> mCustomElements;
// These member variables are used on both inner and the outer windows.
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;

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

@ -576,6 +576,12 @@ nsHostObjectProtocolHandler::RemoveDataEntries()
gDataTable = nullptr;
}
/* static */ bool
nsHostObjectProtocolHandler::HasDataEntry(const nsACString& aUri)
{
return !!GetDataInfo(aUri);
}
nsresult
nsHostObjectProtocolHandler::GenerateURIString(const nsACString &aScheme,
nsIPrincipal* aPrincipal,

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

@ -75,6 +75,8 @@ public:
// This is for IPC only.
static void RemoveDataEntries();
static bool HasDataEntry(const nsACString& aUri);
static nsIPrincipal* GetDataEntryPrincipal(const nsACString& aUri);
static void Traverse(const nsACString& aUri, nsCycleCollectionTraversalCallback& aCallback);

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

@ -44,6 +44,7 @@ class AudioContext;
class Element;
class Performance;
class ServiceWorkerRegistration;
class CustomElementsRegistry;
} // namespace dom
namespace gfx {
class VRDeviceProxy;
@ -96,7 +97,7 @@ public:
const nsPIDOMWindowOuter* AsOuter() const;
virtual nsPIDOMWindowOuter* GetPrivateRoot() = 0;
virtual mozilla::dom::CustomElementsRegistry* CustomElements() = 0;
// Outer windows only.
virtual void ActivateOrDeactivate(bool aActivate) = 0;
@ -321,7 +322,7 @@ public:
{
return mMayHavePaintEventListener;
}
/**
* Call this to indicate that some node (this window, its document,
* or content in that document) has a touch event listener.

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

@ -87,6 +87,13 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsScriptLoadRequest)
nsScriptLoadRequest::~nsScriptLoadRequest()
{
js_free(mScriptTextBuf);
// We should always clean up any off-thread script parsing resources.
MOZ_ASSERT(!mOffThreadToken);
// But play it safe in release builds and try to clean them up here
// as a fail safe.
MaybeCancelOffThreadScript();
}
void
@ -96,6 +103,27 @@ nsScriptLoadRequest::SetReady()
mProgress = Progress::Ready;
}
void
nsScriptLoadRequest::Cancel()
{
MaybeCancelOffThreadScript();
mIsCanceled = true;
}
void
nsScriptLoadRequest::MaybeCancelOffThreadScript()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mOffThreadToken) {
return;
}
JSContext* cx = JS_GetContext(xpc::GetJSRuntime());
JS::CancelOffThreadScript(cx, mOffThreadToken);
mOffThreadToken = nullptr;
}
//////////////////////////////////////////////////////////////
// nsModuleLoadRequest
//////////////////////////////////////////////////////////////
@ -1829,9 +1857,7 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
// (disappearing window, some other error, ...). Finish the
// request to avoid leaks in the JS engine.
MOZ_ASSERT(!aRequest->IsModuleRequest());
JSContext* cx = JS_GetContext(xpc::GetJSRuntime());
JS::CancelOffThreadScript(cx, aRequest->mOffThreadToken);
aRequest->mOffThreadToken = nullptr;
aRequest->MaybeCancelOffThreadScript();
}
// Free any source data.

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

@ -118,10 +118,7 @@ public:
return mElement == nullptr;
}
virtual void Cancel()
{
mIsCanceled = true;
}
virtual void Cancel();
bool IsCanceled() const
{
@ -152,6 +149,8 @@ public:
(IsReadyToRun() && mWasCompiledOMT);
}
void MaybeCancelOffThreadScript();
using super::getNext;
using super::isInList;

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

@ -6,6 +6,7 @@
#ifndef _CANVASUTILS_H_
#define _CANVASUTILS_H_
#include "CanvasRenderingContextHelper.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/dom/ToJSValue.h"
#include "jsapi.h"

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

@ -7,11 +7,11 @@
#include "GLBlitHelper.h"
#include "GLContext.h"
#include "GLDefs.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "mozilla/RefPtr.h"
#include "nsLayoutUtils.h"
#include "WebGLBuffer.h"
#include "WebGLContext.h"
#include "WebGLTexelConversions.h"
#include "WebGLTexture.h"
@ -131,6 +131,12 @@ FormatForPackingInfo(const PackingInfo& pi)
////////////////////
static uint32_t
ZeroOn2D(TexImageTarget target, uint32_t val)
{
return (IsTarget3D(target) ? val : 0);
}
static uint32_t
FallbackOnZero(uint32_t val, uint32_t fallback)
{
@ -142,27 +148,31 @@ TexUnpackBlob::TexUnpackBlob(const WebGLContext* webgl, TexImageTarget target,
uint32_t depth, bool isSrcPremult)
: mAlignment(webgl->mPixelStore_UnpackAlignment)
, mRowLength(rowLength)
, mImageHeight(FallbackOnZero(webgl->mPixelStore_UnpackImageHeight, height))
, mImageHeight(FallbackOnZero(ZeroOn2D(target,
webgl->mPixelStore_UnpackImageHeight),
height))
, mSkipPixels(webgl->mPixelStore_UnpackSkipPixels)
, mSkipRows(webgl->mPixelStore_UnpackSkipRows)
, mSkipImages(IsTarget3D(target) ? webgl->mPixelStore_UnpackSkipImages : 0)
, mSkipImages(ZeroOn2D(target, webgl->mPixelStore_UnpackSkipImages))
, mWidth(width)
, mHeight(height)
, mDepth(depth)
, mIsSrcPremult(isSrcPremult)
, mNeedsExactUpload(false)
{
MOZ_ASSERT_IF(!IsTarget3D(target), mDepth == 1);
}
bool
TexUnpackBlob::ConvertIfNeeded(WebGLContext* webgl, const char* funcName,
const void* srcBytes, uint32_t srcStride, uint8_t srcBPP,
WebGLTexelFormat srcFormat,
const uint8_t* srcBytes, uint32_t srcStride,
uint8_t srcBPP, WebGLTexelFormat srcFormat,
const webgl::DriverUnpackInfo* dstDUI,
const void** const out_bytes,
const uint8_t** const out_bytes,
UniqueBuffer* const out_anchoredBuffer) const
{
*out_bytes = srcBytes;
@ -181,7 +191,7 @@ TexUnpackBlob::ConvertIfNeeded(WebGLContext* webgl, const char* funcName,
}
const uint32_t skipBytes = offset.value();
auto const srcBegin = (const uint8_t*)srcBytes + skipBytes;
auto const srcBegin = srcBytes + skipBytes;
//////
@ -237,13 +247,15 @@ TexUnpackBlob::ConvertIfNeeded(WebGLContext* webgl, const char* funcName,
// We need some sort of conversion, so create the dest buffer.
*out_anchoredBuffer = calloc(1, dstSize.value());
*out_bytes = out_anchoredBuffer->get();
if (!*out_bytes) {
const auto dstBytes = (uint8_t*)out_anchoredBuffer->get();
if (!dstBytes) {
webgl->ErrorOutOfMemory("%s: Unable to allocate buffer during conversion.",
funcName);
return false;
}
const auto dstBegin = (uint8_t*)(*out_bytes) + skipBytes;
*out_bytes = dstBytes;
const auto dstBegin = dstBytes + skipBytes;
//////
// Row conversion
@ -319,11 +331,12 @@ DoTexOrSubImage(bool isSubImage, gl::GLContext* gl, TexImageTarget target, GLint
TexUnpackBytes::TexUnpackBytes(const WebGLContext* webgl, TexImageTarget target,
uint32_t width, uint32_t height, uint32_t depth,
const void* bytes)
bool isClientData, const uint8_t* ptr)
: TexUnpackBlob(webgl, target,
FallbackOnZero(webgl->mPixelStore_UnpackRowLength, width), width,
height, depth, false)
, mBytes(bytes)
, mIsClientData(isClientData)
, mPtr(ptr)
{ }
bool
@ -345,16 +358,99 @@ TexUnpackBytes::TexOrSubImage(bool isSubImage, bool needsRespec, const char* fun
const auto format = FormatForPackingInfo(pi);
const void* uploadBytes;
auto uploadPtr = mPtr;
UniqueBuffer tempBuffer;
if (!ConvertIfNeeded(webgl, funcName, mBytes, rowStride.value(), bytesPerPixel,
format, dui, &uploadBytes, &tempBuffer))
if (mIsClientData &&
!ConvertIfNeeded(webgl, funcName, mPtr, rowStride.value(), bytesPerPixel, format,
dui, &uploadPtr, &tempBuffer))
{
return false;
}
*out_error = DoTexOrSubImage(isSubImage, webgl->gl, target, level, dui, xOffset,
yOffset, zOffset, mWidth, mHeight, mDepth, uploadBytes);
const auto& gl = webgl->gl;
//////
bool useParanoidHandling = false;
if (mNeedsExactUpload && webgl->mBoundPixelUnpackBuffer) {
webgl->GenerateWarning("%s: Uploads from a buffer with a final row with a byte"
" count smaller than the row stride can incur extra"
" overhead.",
funcName);
if (gl->WorkAroundDriverBugs()) {
useParanoidHandling |= (gl->Vendor() == gl::GLVendor::NVIDIA);
}
}
if (!useParanoidHandling) {
*out_error = DoTexOrSubImage(isSubImage, gl, target, level, dui, xOffset, yOffset,
zOffset, mWidth, mHeight, mDepth, uploadPtr);
return true;
}
//////
MOZ_ASSERT(webgl->mBoundPixelUnpackBuffer);
if (!isSubImage) {
// Alloc first to catch OOMs.
gl->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, 0);
*out_error = DoTexOrSubImage(false, gl, target, level, dui, xOffset, yOffset,
zOffset, mWidth, mHeight, mDepth, nullptr);
gl->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER,
webgl->mBoundPixelUnpackBuffer->mGLName);
if (*out_error)
return false;
}
//////
// Make our sometimes-implicit values explicit. Also this keeps them constant when we
// ask for height=mHeight-1 and such.
gl->fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, mRowLength);
gl->fPixelStorei(LOCAL_GL_UNPACK_IMAGE_HEIGHT, mImageHeight);
if (mDepth > 1) {
*out_error = DoTexOrSubImage(true, gl, target, level, dui, xOffset, yOffset,
zOffset, mWidth, mHeight, mDepth-1, uploadPtr);
}
// Skip the images we uploaded.
gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_IMAGES, mSkipImages + mDepth - 1);
if (mHeight > 1) {
*out_error = DoTexOrSubImage(true, gl, target, level, dui, xOffset, yOffset,
zOffset+mDepth-1, mWidth, mHeight-1, 1, uploadPtr);
}
const auto totalSkipRows = CheckedUint32(mSkipImages) * mImageHeight + mSkipRows;
const auto totalFullRows = CheckedUint32(mDepth - 1) * mImageHeight + mHeight - 1;
const auto tailOffsetRows = totalSkipRows + totalFullRows;
const auto tailOffsetBytes = tailOffsetRows * rowStride;
uploadPtr += tailOffsetBytes.value();
//////
gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 1); // No stride padding.
gl->fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, 0); // No padding in general.
gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_IMAGES, 0); // Don't skip images,
gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_ROWS, 0); // or rows.
// Keep skipping pixels though!
*out_error = DoTexOrSubImage(true, gl, target, level, dui, xOffset,
yOffset+mHeight-1, zOffset+mDepth-1, mWidth, 1, 1,
uploadPtr);
// Reset all our modified state.
gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, webgl->mPixelStore_UnpackAlignment);
gl->fPixelStorei(LOCAL_GL_UNPACK_IMAGE_HEIGHT, webgl->mPixelStore_UnpackImageHeight);
gl->fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, webgl->mPixelStore_UnpackRowLength);
gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_IMAGES, webgl->mPixelStore_UnpackSkipImages);
gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_ROWS, webgl->mPixelStore_UnpackSkipRows);
return true;
}
@ -370,6 +466,9 @@ TexUnpackImage::TexUnpackImage(const WebGLContext* webgl, TexImageTarget target,
, mImage(image)
{ }
TexUnpackImage::~TexUnpackImage()
{ }
bool
TexUnpackImage::TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
WebGLTexture* tex, TexImageTarget target, GLint level,
@ -440,9 +539,9 @@ TexUnpackImage::TexOrSubImage(bool isSubImage, bool needsRespec, const char* fun
" upload.",
funcName);
const RefPtr<SourceSurface> surf = mImage->GetAsSourceSurface();
const RefPtr<gfx::SourceSurface> surf = mImage->GetAsSourceSurface();
RefPtr<DataSourceSurface> dataSurf;
RefPtr<gfx::DataSourceSurface> dataSurf;
if (surf) {
// WARNING: OSX can lose our MakeCurrent here.
dataSurf = surf->GetDataSurface();
@ -555,7 +654,7 @@ TexUnpackSurface::TexOrSubImage(bool isSubImage, bool needsRespec, const char* f
webgl->GenerateWarning("%s: Incurred CPU-side conversion, which is very slow.",
funcName);
const void* uploadBytes;
const uint8_t* uploadBytes;
UniqueBuffer tempBuffer;
if (!ConvertIfNeeded(webgl, funcName, srcBytes, srcStride, srcBPP, srcFormat,
dstDUI, &uploadBytes, &tempBuffer))

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

@ -7,14 +7,11 @@
#define TEX_UNPACK_BLOB_H_
#include "GLContextTypes.h"
#include "GLTypes.h"
#include "mozilla/RefPtr.h"
#include "WebGLStrongTypes.h"
#include "WebGLTypes.h"
template <class T>
class RefPtr;
namespace mozilla {
class UniqueBuffer;
@ -31,10 +28,6 @@ namespace gfx {
class DataSourceSurface;
} // namespace gfx
namespace gl {
class GLContext;
} // namespace gl
namespace layers {
class Image;
class ImageContainer;
@ -59,6 +52,8 @@ public:
const uint32_t mDepth;
const bool mIsSrcPremult;
bool mNeedsExactUpload;
protected:
TexUnpackBlob(const WebGLContext* webgl, TexImageTarget target, uint32_t rowLength,
uint32_t width, uint32_t height, uint32_t depth, bool isSrcPremult);
@ -67,10 +62,11 @@ public:
virtual ~TexUnpackBlob() { }
protected:
bool ConvertIfNeeded(WebGLContext* webgl, const char* funcName, const void* srcBytes,
uint32_t srcStride, uint8_t srcBPP, WebGLTexelFormat srcFormat,
bool ConvertIfNeeded(WebGLContext* webgl, const char* funcName,
const uint8_t* srcBytes, uint32_t srcStride, uint8_t srcBPP,
WebGLTexelFormat srcFormat,
const webgl::DriverUnpackInfo* dstDUI,
const void** const out_bytes,
const uint8_t** const out_bytes,
UniqueBuffer* const out_anchoredBuffer) const;
public:
@ -86,12 +82,13 @@ public:
class TexUnpackBytes final : public TexUnpackBlob
{
public:
const void* const mBytes;
const bool mIsClientData;
const uint8_t* const mPtr;
TexUnpackBytes(const WebGLContext* webgl, TexImageTarget target, uint32_t width,
uint32_t height, uint32_t depth, const void* bytes);
uint32_t height, uint32_t depth, bool isClientData, const uint8_t* ptr);
virtual bool HasData() const override { return bool(mBytes); }
virtual bool HasData() const override { return !mIsClientData || bool(mPtr); }
virtual bool TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
WebGLTexture* tex, TexImageTarget target, GLint level,
@ -109,6 +106,8 @@ public:
uint32_t height, uint32_t depth, layers::Image* image,
bool isAlphaPremult);
~TexUnpackImage(); // Prevent needing to define layers::Image in the header.
virtual bool TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
WebGLTexture* tex, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dui, GLint xOffset,
@ -126,10 +125,10 @@ public:
bool isAlphaPremult);
virtual bool TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
WebGLTexture* tex, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dui, GLint xOffset,
GLint yOffset, GLint zOffset,
GLenum* const out_error) const override;
WebGLTexture* tex, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dui, GLint xOffset,
GLint yOffset, GLint zOffset,
GLenum* const out_error) const override;
};
} // namespace webgl

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

@ -33,7 +33,9 @@ public:
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) override;
private:
virtual bool ValidateAttribPointerType(bool integerMode, GLenum type, GLsizei* alignment, const char* info) override;
virtual bool ValidateAttribPointerType(bool integerMode, GLenum type,
uint32_t* alignment,
const char* info) override;
virtual bool ValidateBufferTarget(GLenum target, const char* info) override;
virtual bool ValidateBufferIndexedTarget(GLenum target, const char* info) override;
virtual bool ValidateBufferUsageEnum(GLenum usage, const char* info) override;

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

@ -8,7 +8,8 @@
namespace mozilla {
bool
WebGL1Context::ValidateAttribPointerType(bool /*integerMode*/, GLenum type, GLsizei* out_alignment, const char* info)
WebGL1Context::ValidateAttribPointerType(bool /*integerMode*/, GLenum type,
uint32_t* out_alignment, const char* info)
{
MOZ_ASSERT(out_alignment);
if (!out_alignment)

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

@ -122,10 +122,10 @@ public:
template<class T>
inline void
TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset, GLint zOffset,
GLenum unpackFormat, GLenum unpackType, T& elem, ErrorResult& out_rv)
GLenum unpackFormat, GLenum unpackType, T& any, ErrorResult& out_rv)
{
TexSubImage3D(target, level, xOffset, yOffset, zOffset, unpackFormat, unpackType,
&elem, &out_rv);
&any, &out_rv);
}
void CopyTexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
@ -140,6 +140,64 @@ public:
GLsizei depth, GLenum sizedUnpackFormat,
const dom::ArrayBufferView& data);
////////////////
// Texture PBOs
void TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
GLsizei width, GLsizei height, GLint border, GLenum unpackFormat,
GLenum unpackType, WebGLsizeiptr offset, ErrorResult&);
void TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
GLsizei width, GLsizei height, GLenum unpackFormat,
GLenum unpackType, WebGLsizeiptr offset, ErrorResult&);
void TexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
GLenum unpackType, WebGLsizeiptr offset);
void TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
GLint zOffset, GLsizei width, GLsizei height, GLsizei depth,
GLenum unpackFormat, GLenum unpackType, WebGLsizeiptr offset,
ErrorResult&);
////////////////
// WebGL1 overloads
void
TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat, GLsizei width,
GLsizei height, GLint border, GLenum unpackFormat, GLenum unpackType,
const dom::Nullable<dom::ArrayBufferView>& pixels, ErrorResult& out_rv)
{
WebGLContext::TexImage2D(texImageTarget, level, internalFormat, width, height,
border, unpackFormat, unpackType, pixels, out_rv);
}
template<typename T>
void
TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
GLenum unpackFormat, GLenum unpackType, T& any, ErrorResult& out_rv)
{
WebGLContext::TexImage2D(texImageTarget, level, internalFormat, unpackFormat,
unpackType, any, out_rv);
}
void
TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
GLsizei width, GLsizei height, GLenum unpackFormat, GLenum unpackType,
const dom::Nullable<dom::ArrayBufferView>& pixels, ErrorResult& out_rv)
{
WebGLContext::TexSubImage2D(texImageTarget, level, xOffset, yOffset, width,
height, unpackFormat, unpackType, pixels, out_rv);
}
template<typename T>
inline void
TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
GLenum unpackFormat, GLenum unpackType, T& any, ErrorResult& out_rv)
{
WebGLContext::TexSubImage2D(texImageTarget, level, xOffset, yOffset, unpackFormat,
unpackType, any, out_rv);
}
// -------------------------------------------------------------------------
// Programs and shaders - WebGL2ContextPrograms.cpp
@ -364,7 +422,9 @@ private:
// CreateVertexArrayImpl is assumed to be infallible.
virtual WebGLVertexArray* CreateVertexArrayImpl() override;
virtual bool ValidateAttribPointerType(bool integerMode, GLenum type, GLsizei* alignment, const char* info) override;
virtual bool ValidateAttribPointerType(bool integerMode, GLenum type,
uint32_t* alignment,
const char* info) override;
virtual bool ValidateBufferTarget(GLenum target, const char* info) override;
virtual bool ValidateBufferIndexedTarget(GLenum target, const char* info) override;
virtual bool ValidateBufferUsageEnum(GLenum usage, const char* info) override;

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

@ -20,16 +20,11 @@ WebGL2Context::ValidateBufferTarget(GLenum target, const char* funcName)
case LOCAL_GL_COPY_WRITE_BUFFER:
case LOCAL_GL_ELEMENT_ARRAY_BUFFER:
case LOCAL_GL_PIXEL_PACK_BUFFER:
case LOCAL_GL_PIXEL_UNPACK_BUFFER:
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER:
case LOCAL_GL_UNIFORM_BUFFER:
return true;
case LOCAL_GL_PIXEL_UNPACK_BUFFER:
ErrorInvalidOperation("%s: PBOs are still under development, and are currently"
" disabled.",
funcName);
return false;
default:
ErrorInvalidEnumInfo(funcName, target);
return false;

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

@ -4,7 +4,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebGL2Context.h"
#include "GLContext.h"
#include "WebGLFramebuffer.h"
namespace mozilla {

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

@ -202,6 +202,116 @@ WebGL2Context::CopyTexSubImage3D(GLenum rawTexImageTarget, GLint level, GLint xO
height);
}
////////////////////
void
WebGL2Context::TexImage2D(GLenum rawTexImageTarget, GLint level, GLenum internalFormat,
GLsizei width, GLsizei height, GLint border,
GLenum unpackFormat, GLenum unpackType, WebGLsizeiptr offset,
ErrorResult&)
{
const char funcName[] = "texImage2D";
const uint8_t funcDims = 2;
TexImageTarget target;
WebGLTexture* tex;
if (!ValidateTexImageTarget(this, funcName, funcDims, rawTexImageTarget, &target,
&tex))
{
return;
}
const bool isSubImage = false;
const GLint xOffset = 0;
const GLint yOffset = 0;
const GLint zOffset = 0;
const GLsizei depth = 1;
tex->TexOrSubImage(isSubImage, funcName, target, level, internalFormat, xOffset,
yOffset, zOffset, width, height, depth, border, unpackFormat,
unpackType, offset);
}
void
WebGL2Context::TexSubImage2D(GLenum rawTexImageTarget, GLint level, GLint xOffset,
GLint yOffset, GLsizei width, GLsizei height,
GLenum unpackFormat, GLenum unpackType, WebGLsizeiptr offset,
ErrorResult&)
{
const char funcName[] = "texSubImage2D";
const uint8_t funcDims = 2;
TexImageTarget target;
WebGLTexture* tex;
if (!ValidateTexImageTarget(this, funcName, funcDims, rawTexImageTarget, &target,
&tex))
{
return;
}
const bool isSubImage = true;
const GLenum internalFormat = 0;
const GLint zOffset = 0;
const GLsizei depth = 1;
const GLint border = 0;
tex->TexOrSubImage(isSubImage, funcName, target, level, internalFormat, xOffset,
yOffset, zOffset, width, height, depth, border, unpackFormat,
unpackType, offset);
}
//////////
void
WebGL2Context::TexImage3D(GLenum rawTexImageTarget, GLint level, GLenum internalFormat,
GLsizei width, GLsizei height, GLsizei depth, GLint border,
GLenum unpackFormat, GLenum unpackType, WebGLsizeiptr offset)
{
const char funcName[] = "texImage3D";
const uint8_t funcDims = 3;
TexImageTarget target;
WebGLTexture* tex;
if (!ValidateTexImageTarget(this, funcName, funcDims, rawTexImageTarget, &target,
&tex))
{
return;
}
const bool isSubImage = false;
const GLint xOffset = 0;
const GLint yOffset = 0;
const GLint zOffset = 0;
tex->TexOrSubImage(isSubImage, funcName, target, level, internalFormat, xOffset,
yOffset, zOffset, width, height, depth, border, unpackFormat,
unpackType, offset);
}
void
WebGL2Context::TexSubImage3D(GLenum rawTexImageTarget, GLint level, GLint xOffset,
GLint yOffset, GLint zOffset, GLsizei width, GLsizei height,
GLsizei depth, GLenum unpackFormat, GLenum unpackType,
WebGLsizeiptr offset, ErrorResult&)
{
const char funcName[] = "texSubImage3D";
const uint8_t funcDims = 3;
TexImageTarget target;
WebGLTexture* tex;
if (!ValidateTexImageTarget(this, funcName, funcDims, rawTexImageTarget, &target,
&tex))
{
return;
}
const bool isSubImage = true;
const GLenum internalFormat = 0;
const GLint border = 0;
tex->TexOrSubImage(isSubImage, funcName, target, level, internalFormat, xOffset,
yOffset, zOffset, width, height, depth, border, unpackFormat,
unpackType, offset);
}
////////////////////
/*virtual*/ bool
WebGL2Context::IsTexParamValid(GLenum pname) const
{

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

@ -16,7 +16,7 @@ namespace mozilla {
bool
WebGL2Context::ValidateAttribPointerType(bool integerMode, GLenum type,
GLsizei* out_alignment, const char* info)
uint32_t* out_alignment, const char* info)
{
MOZ_ASSERT(out_alignment);

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

@ -32,7 +32,7 @@ public:
OtherData
};
explicit WebGLBuffer(WebGLContext* webgl, GLuint buf);
WebGLBuffer(WebGLContext* webgl, GLuint buf);
void BindTo(GLenum target);
Kind Content() const { return mContent; }

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

@ -896,7 +896,7 @@ public:
// WebGLTextureUpload.cpp
public:
bool ValidateUnpackPixels(const char* funcName, uint32_t fullRows,
uint32_t tailPixels, const webgl::TexUnpackBlob* blob);
uint32_t tailPixels, webgl::TexUnpackBlob* blob);
protected:
bool ValidateTexImageSpecification(const char* funcName, uint8_t funcDims,
@ -914,8 +914,8 @@ protected:
WebGLTexture** const out_texture,
WebGLTexture::ImageInfo** const out_imageInfo);
bool ValidateUnpackInfo(const char* funcName, GLenum format, GLenum type,
webgl::PackingInfo* const out);
bool ValidateUnpackInfo(const char* funcName, bool usePBOs, GLenum format,
GLenum type, webgl::PackingInfo* const out);
// -----------------------------------------------------------------------------
// Vertices Feature (WebGLContextVertices.cpp)
@ -1311,7 +1311,7 @@ private:
// Context customization points
virtual WebGLVertexArray* CreateVertexArrayImpl();
virtual bool ValidateAttribPointerType(bool integerMode, GLenum type, GLsizei* alignment, const char* info) = 0;
virtual bool ValidateAttribPointerType(bool integerMode, GLenum type, uint32_t* alignment, const char* info) = 0;
virtual bool ValidateBufferTarget(GLenum target, const char* info) = 0;
virtual bool ValidateBufferIndexedTarget(GLenum target, const char* info) = 0;
virtual bool ValidateBufferForTarget(GLenum target, WebGLBuffer* buffer, const char* info);

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

@ -8,6 +8,7 @@
#include "GLContext.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/UniquePtrExtensions.h"
#include "nsPrintfCString.h"
#include "WebGLBuffer.h"
#include "WebGLContextUtils.h"
#include "WebGLFramebuffer.h"

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

@ -6,6 +6,7 @@
#include "WebGLContext.h"
#include "GLContext.h"
#include "GLScreenBuffer.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/Preferences.h"
#include "nsString.h"

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

@ -7,7 +7,6 @@
#ifndef WEBGLCONTEXTUNCHECKED_H
#define WEBGLCONTEXTUNCHECKED_H
#include "GLDefs.h"
#include "mozilla/RefPtr.h"
#include "WebGLTypes.h"
@ -15,9 +14,6 @@ namespace mozilla {
class WebGLBuffer;
class WebGLSampler;
namespace gl {
class GLContext;
} // namespace gl
class WebGLContextUnchecked
{

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

@ -15,6 +15,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "nsIObserverService.h"
#include "nsPrintfCString.h"
#include "WebGLActiveInfo.h"
#include "WebGLBuffer.h"
#include "WebGLContextUtils.h"
@ -571,7 +572,7 @@ WebGLContext::ValidateAttribPointer(bool integerMode, GLuint index, GLint size,
return false;
}
GLsizei requiredAlignment = 0;
uint32_t requiredAlignment = 0;
if (!ValidateAttribPointerType(integerMode, type, &requiredAlignment, info))
return false;

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

@ -4,6 +4,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"

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

@ -4,6 +4,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"

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

@ -4,6 +4,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"

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

@ -4,6 +4,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"

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

@ -4,6 +4,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"

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

@ -5,6 +5,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"

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

@ -6,13 +6,13 @@
#include "WebGLExtensions.h"
#include "gfxPrefs.h"
#include "GLContext.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "mozilla/dom/BindingUtils.h"
#include "GLContext.h"
#include "WebGLContext.h"
#include "WebGLTimerQuery.h"
#include "gfxPrefs.h"
namespace mozilla {

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

@ -5,6 +5,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"

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

@ -5,6 +5,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"

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

@ -5,6 +5,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"

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

@ -5,6 +5,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"

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

@ -4,6 +4,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"
#include "WebGLFormats.h"

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

@ -4,6 +4,7 @@
#include "WebGLExtensions.h"
#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"
#include "WebGLFormats.h"

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

@ -7,9 +7,7 @@
#define WEBGL_EXTENSIONS_H_
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Attributes.h"
#include "nsWrapperCache.h"
#include "WebGLObjectModel.h"
#include "WebGLTypes.h"

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

@ -6,7 +6,9 @@
#include "WebGLFormats.h"
#include "gfxPrefs.h"
#include "GLContext.h"
#include "GLDefs.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/StaticMutex.h"
#ifdef FOO

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

@ -9,8 +9,8 @@
#include <map>
#include <set>
#include "GLTypes.h"
#include "mozilla/UniquePtr.h"
#include "WebGLTypes.h"
namespace mozilla {
namespace webgl {

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

@ -6,14 +6,17 @@
#ifndef WEBGL_FRAMEBUFFER_H_
#define WEBGL_FRAMEBUFFER_H_
#include <vector>
#include "mozilla/LinkedList.h"
#include "mozilla/WeakPtr.h"
#include "nsWrapperCache.h"
#include "WebGLObjectModel.h"
#include "WebGLStrongTypes.h"
#include "WebGLRenderbuffer.h"
#include "WebGLStrongTypes.h"
#include "WebGLTexture.h"
#include "WebGLTypes.h"
namespace mozilla {
@ -24,10 +27,6 @@ class WebGLTexture;
template<typename T>
class PlacementArray;
namespace gl {
class GLContext;
} // namespace gl
class WebGLFBAttachPoint
{
public:

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

@ -17,9 +17,9 @@
#include "nsString.h"
#include "nsWrapperCache.h"
#include "WebGLContext.h"
#include "WebGLObjectModel.h"
namespace mozilla {
class ErrorResult;
class WebGLActiveInfo;

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

@ -9,6 +9,7 @@
#include "mozilla/LinkedList.h"
#include "nsWrapperCache.h"
#include "WebGLObjectModel.h"
#include "WebGLStrongTypes.h"
namespace mozilla {
@ -22,7 +23,7 @@ class WebGLSampler final
friend class WebGLTexture;
public:
explicit WebGLSampler(WebGLContext* webgl, GLuint sampler);
WebGLSampler(WebGLContext* webgl, GLuint sampler);
const GLuint mGLName;

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

@ -6,6 +6,7 @@
#ifndef WEBGL_SHADER_H_
#define WEBGL_SHADER_H_
#include <map>
#include <string>
#include <vector>

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

@ -43,6 +43,12 @@ ChooseValidatorCompileOptions(const ShBuiltInResources& resources,
options |= SH_LIMIT_EXPRESSION_COMPLEXITY;
}
// Sampler arrays indexed with non-constant expressions are forbidden in
// GLSL 1.30 and later.
// ESSL 3 requires constant-integral-expressions for this as well.
// Just do it universally.
options |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX;
if (gfxPrefs::WebGLAllANGLEOptions()) {
return options |
SH_VALIDATE_LOOP_INDEXING |
@ -78,11 +84,6 @@ ChooseValidatorCompileOptions(const ShBuiltInResources& resources,
options |= SH_EMULATE_BUILT_IN_FUNCTIONS;
}
// Work around bug 636926
if (gl->Vendor() == gl::GLVendor::NVIDIA) {
options |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX;
}
// Work around that Mac drivers handle struct scopes incorrectly.
options |= SH_REGENERATE_STRUCT_NAMES;
}
@ -129,13 +130,8 @@ WebGLContext::CreateShaderValidator(GLenum shaderType) const
if (mBypassShaderValidation)
return nullptr;
ShShaderSpec spec = IsWebGL2() ? SH_WEBGL2_SPEC : SH_WEBGL_SPEC;
ShShaderOutput outputLanguage = gl->IsGLES() ? SH_ESSL_OUTPUT
: SH_GLSL_COMPATIBILITY_OUTPUT;
// If we're using WebGL2 we want a more specific version of GLSL
if (IsWebGL2())
outputLanguage = ShaderOutput(gl);
const auto spec = (IsWebGL2() ? SH_WEBGL2_SPEC : SH_WEBGL_SPEC);
const auto outputLanguage = ShaderOutput(gl);
ShBuiltInResources resources;
memset(&resources, 0, sizeof(resources));
@ -253,7 +249,8 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log
return false;
}
if (ShGetShaderVersion(prev->mHandle) != ShGetShaderVersion(mHandle)) {
const auto shaderVersion = ShGetShaderVersion(mHandle);
if (ShGetShaderVersion(prev->mHandle) != shaderVersion) {
nsPrintfCString error("Vertex shader version %d does not match"
" fragment shader version %d.",
ShGetShaderVersion(prev->mHandle),
@ -319,7 +316,7 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log
if (vertVarying.name != fragVarying.name)
continue;
if (!vertVarying.isSameVaryingAtLinkTime(fragVarying)) {
if (!vertVarying.isSameVaryingAtLinkTime(fragVarying, shaderVersion)) {
nsPrintfCString error("Varying `%s`is not linkable between"
" attached shaders.",
fragVarying.name.c_str());
@ -355,7 +352,8 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log
}
}
{
if (shaderVersion == 100) {
// Enforce ESSL1 invariant linking rules.
bool isInvariant_Position = false;
bool isInvariant_PointSize = false;
bool isInvariant_FragCoord = false;

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

@ -16,6 +16,7 @@
#include "WebGLContext.h"
#include "WebGLContextUtils.h"
#include "WebGLFramebuffer.h"
#include "WebGLSampler.h"
#include "WebGLTexelConversions.h"
namespace mozilla {

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

@ -8,6 +8,8 @@
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include "mozilla/Assertions.h"
#include "mozilla/CheckedInt.h"
@ -18,6 +20,7 @@
#include "WebGLFramebufferAttachable.h"
#include "WebGLObjectModel.h"
#include "WebGLStrongTypes.h"
#include "WebGLTypes.h"
namespace mozilla {
class ErrorResult;
@ -25,11 +28,19 @@ class WebGLContext;
namespace dom {
class Element;
class HTMLVideoElement;
class ImageData;
class ArrayBufferViewOrSharedArrayBufferView;
} // namespace dom
namespace layers {
class Image;
} // namespace layers
namespace webgl {
struct DriverUnpackInfo;
struct FormatUsageInfo;
struct PackingInfo;
class TexUnpackBlob;
} // namespace webgl
@ -190,7 +201,7 @@ public:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLTexture)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLTexture)
explicit WebGLTexture(WebGLContext* webgl, GLuint tex);
WebGLTexture(WebGLContext* webgl, GLuint tex);
void Delete();
@ -237,6 +248,12 @@ public:
GLint zOffset, GLenum unpackFormat, GLenum unpackType,
dom::Element* elem, ErrorResult* const out_error);
void TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarget target,
GLint level, GLenum internalFormat, GLint xOffset, GLint yOffset,
GLint zOffset, GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum unpackFormat, GLenum unpackType,
WebGLsizeiptr offset);
protected:
void TexOrSubImageBlob(bool isSubImage, const char* funcName, TexImageTarget target,
GLint level, GLenum internalFormat, GLint xOffset,

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

@ -8,6 +8,7 @@
#include <algorithm>
#include "CanvasUtils.h"
#include "gfxPrefs.h"
#include "GLBlitHelper.h"
#include "GLContext.h"
#include "mozilla/gfx/2D.h"
@ -127,36 +128,35 @@ DoesJSTypeMatchUnpackType(GLenum unpackType, js::Scalar::Type jsType)
bool
WebGLContext::ValidateUnpackPixels(const char* funcName, uint32_t fullRows,
uint32_t tailPixels, const webgl::TexUnpackBlob* blob)
uint32_t tailPixels, webgl::TexUnpackBlob* blob)
{
auto skipPixels = CheckedUint32(blob->mSkipPixels);
skipPixels += CheckedUint32(blob->mSkipRows);
const auto usedPixelsPerRow = CheckedUint32(blob->mSkipPixels) + blob->mWidth;
const auto usedRowsPerImage = CheckedUint32(blob->mSkipRows) + blob->mHeight;
const auto usedImages = CheckedUint32(blob->mSkipImages) + blob->mDepth;
if (!usedPixelsPerRow.isValid() ||
!usedRowsPerImage.isValid() ||
!usedImages.isValid())
{
ErrorOutOfMemory("%s: Invalid calculation for e.g. UNPACK_SKIP_PIXELS + width.",
funcName);
return false;
}
//////
if (usedPixelsPerRow.value() > blob->mRowLength ||
usedRowsPerImage.value() > blob->mImageHeight)
{
ErrorInvalidOperation("%s: UNPACK_ROW_LENGTH or UNPACK_IMAGE_HEIGHT too small.",
if (!usedPixelsPerRow.isValid() || usedPixelsPerRow.value() > blob->mRowLength) {
ErrorInvalidOperation("%s: UNPACK_SKIP_PIXELS + height > UNPACK_ROW_LENGTH.",
funcName);
return false;
}
if (blob->mHeight > blob->mImageHeight) {
ErrorInvalidOperation("%s: height > UNPACK_IMAGE_HEIGHT.", funcName);
return false;
}
//////
auto fullRowsNeeded = (usedImages - 1) * blob->mImageHeight;
fullRowsNeeded += usedRowsPerImage - 1;
// The spec doesn't bound SKIP_ROWS + height <= IMAGE_HEIGHT, unfortunately.
auto skipFullRows = CheckedUint32(blob->mSkipImages) * blob->mImageHeight;
skipFullRows += blob->mSkipRows;
MOZ_ASSERT(blob->mDepth >= 1);
MOZ_ASSERT(blob->mHeight >= 1);
auto usedFullRows = CheckedUint32(blob->mDepth - 1) * blob->mImageHeight;
usedFullRows += blob->mHeight - 1; // Full rows in the final image, excluding the tail.
const auto fullRowsNeeded = skipFullRows + usedFullRows;
if (!fullRowsNeeded.isValid()) {
ErrorOutOfMemory("%s: Invalid calculation for required row count.",
funcName);
@ -166,8 +166,10 @@ WebGLContext::ValidateUnpackPixels(const char* funcName, uint32_t fullRows,
if (fullRows > fullRowsNeeded.value())
return true;
if (fullRows == fullRowsNeeded.value() && tailPixels >= usedPixelsPerRow.value())
if (fullRows == fullRowsNeeded.value() && tailPixels >= usedPixelsPerRow.value()) {
blob->mNeedsExactUpload = true;
return true;
}
ErrorInvalidOperation("%s: Desired upload requires more data than is available: (%u"
" rows plus %u pixels needed, %u rows plus %u pixels"
@ -177,68 +179,37 @@ WebGLContext::ValidateUnpackPixels(const char* funcName, uint32_t fullRows,
return false;
}
static UniquePtr<webgl::TexUnpackBlob>
BlobFromView(WebGLContext* webgl, const char* funcName, TexImageTarget target,
uint32_t width, uint32_t height, uint32_t depth,
const webgl::PackingInfo& pi,
const dom::Nullable<dom::ArrayBufferView>& maybeView)
static bool
ValidateUnpackBytes(WebGLContext* webgl, const char* funcName, uint32_t width,
uint32_t height, uint32_t depth, const webgl::PackingInfo& pi,
uint32_t byteCount, webgl::TexUnpackBlob* blob)
{
const uint8_t* bytes = nullptr;
uint32_t byteCount = 0;
const auto bytesPerPixel = webgl::BytesPerPixel(pi);
const auto bytesPerRow = CheckedUint32(blob->mRowLength) * bytesPerPixel;
const auto rowStride = RoundUpToMultipleOf(bytesPerRow, blob->mAlignment);
if (!maybeView.IsNull()) {
const auto& view = maybeView.Value();
const auto jsType = JS_GetArrayBufferViewType(view.Obj());
if (!DoesJSTypeMatchUnpackType(pi.type, jsType)) {
webgl->ErrorInvalidOperation("%s: `pixels` must be compatible with `type`.",
funcName);
return nullptr;
}
if (width && height && depth) {
view.ComputeLengthAndData();
bytes = view.DataAllowShared();
byteCount = view.LengthAllowShared();
}
const auto fullRows = byteCount / rowStride;
if (!fullRows.isValid()) {
webgl->ErrorOutOfMemory("%s: Unacceptable upload size calculated.");
return false;
}
UniquePtr<webgl::TexUnpackBlob> blob(new webgl::TexUnpackBytes(webgl, target, width,
height, depth, bytes));
const auto bodyBytes = fullRows.value() * rowStride.value();
const auto tailPixels = (byteCount - bodyBytes) / bytesPerPixel;
//////
if (bytes) {
const auto bytesPerPixel = webgl::BytesPerPixel(pi);
const auto bytesPerRow = CheckedUint32(blob->mRowLength) * bytesPerPixel;
const auto rowStride = RoundUpToMultipleOf(bytesPerRow, blob->mAlignment);
const auto fullRows = byteCount / rowStride;
if (!fullRows.isValid()) {
webgl->ErrorOutOfMemory("%s: Unacceptable upload size calculated.");
return nullptr;
}
const auto bodyBytes = fullRows.value() * rowStride.value();
const auto tailPixels = (byteCount - bodyBytes) / bytesPerPixel;
if (!webgl->ValidateUnpackPixels(funcName, fullRows.value(), tailPixels,
blob.get()))
{
return nullptr;
}
}
//////
return Move(blob);
return webgl->ValidateUnpackPixels(funcName, fullRows.value(), tailPixels, blob);
}
bool
WebGLContext::ValidateUnpackInfo(const char* funcName, GLenum format, GLenum type,
webgl::PackingInfo* const out)
WebGLContext::ValidateUnpackInfo(const char* funcName, bool usePBOs, GLenum format,
GLenum type, webgl::PackingInfo* const out)
{
if (usePBOs != bool(mBoundPixelUnpackBuffer)) {
ErrorInvalidOperation("%s: PACK_BUFFER must be %s.", funcName,
(usePBOs ? "non-null" : "null"));
return false;
}
if (!mFormatUsage->AreUnpackEnumsValid(format, type)) {
ErrorInvalidEnum("%s: Invalid unpack format/type: 0x%04x/0x%04x", funcName,
format, type);
@ -265,17 +236,96 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
return;
}
const bool usePBOs = false;
webgl::PackingInfo pi;
if (!mContext->ValidateUnpackInfo(funcName, unpackFormat, unpackType, &pi))
if (!mContext->ValidateUnpackInfo(funcName, usePBOs, unpackFormat, unpackType, &pi))
return;
const auto blob = BlobFromView(mContext, funcName, target, width, height, depth, pi,
maybeView);
if (!blob)
////
const uint8_t* bytes = nullptr;
uint32_t byteCount = 0;
if (!maybeView.IsNull()) {
const auto& view = maybeView.Value();
const auto jsType = JS_GetArrayBufferViewType(view.Obj());
if (!DoesJSTypeMatchUnpackType(pi.type, jsType)) {
mContext->ErrorInvalidOperation("%s: `pixels` not compatible with `type`.",
funcName);
return;
}
if (width && height && depth) {
view.ComputeLengthAndData();
bytes = view.DataAllowShared();
byteCount = view.LengthAllowShared();
}
}
const bool isClientData = true;
webgl::TexUnpackBytes blob(mContext, target, width, height, depth, isClientData,
bytes);
if (bytes &&
!ValidateUnpackBytes(mContext, funcName, width, height, depth, pi, byteCount,
&blob))
{
return;
}
TexOrSubImageBlob(isSubImage, funcName, target, level, internalFormat, xOffset,
yOffset, zOffset, pi, blob.get());
yOffset, zOffset, pi, &blob);
}
void
WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarget target,
GLint level, GLenum internalFormat, GLint xOffset,
GLint yOffset, GLint zOffset, GLsizei rawWidth,
GLsizei rawHeight, GLsizei rawDepth, GLint border,
GLenum unpackFormat, GLenum unpackType,
WebGLsizeiptr offset)
{
uint32_t width, height, depth;
if (!ValidateExtents(mContext, funcName, rawWidth, rawHeight, rawDepth, border,
&width, &height, &depth))
{
return;
}
const bool usePBOs = true;
webgl::PackingInfo pi;
if (!mContext->ValidateUnpackInfo(funcName, usePBOs, unpackFormat, unpackType, &pi))
return;
////
if (offset < 0) {
mContext->ErrorInvalidValue("%s: offset cannot be negative.", funcName);
return;
}
const bool isClientData = false;
const auto ptr = (const uint8_t*)offset;
webgl::TexUnpackBytes blob(mContext, target, width, height, depth, isClientData, ptr);
const auto& packBuffer = mContext->mBoundPixelUnpackBuffer;
const auto bufferByteCount = packBuffer->ByteLength();
uint32_t byteCount = 0;
if (bufferByteCount >= offset) {
byteCount = bufferByteCount - offset;
}
if (!ValidateUnpackBytes(mContext, funcName, width, height, depth, pi, byteCount,
&blob))
{
return;
}
TexOrSubImageBlob(isSubImage, funcName, target, level, internalFormat, xOffset,
yOffset, zOffset, pi, &blob);
}
////////////////////////////////////////
@ -319,8 +369,9 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
GLint yOffset, GLint zOffset, GLenum unpackFormat,
GLenum unpackType, dom::ImageData* imageData)
{
const bool usePBOs = false;
webgl::PackingInfo pi;
if (!mContext->ValidateUnpackInfo(funcName, unpackFormat, unpackType, &pi))
if (!mContext->ValidateUnpackInfo(funcName, usePBOs, unpackFormat, unpackType, &pi))
return;
if (!imageData) {
@ -346,8 +397,8 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
// non-premultiplied alpha values."
const bool isAlphaPremult = false;
const webgl::TexUnpackSurface blob(mContext, target, width, height, depth, surf,
isAlphaPremult);
webgl::TexUnpackSurface blob(mContext, target, width, height, depth, surf,
isAlphaPremult);
const uint32_t fullRows = imageData->Height();
const uint32_t tailPixels = 0;
@ -368,8 +419,9 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
GLenum unpackType, dom::Element* elem,
ErrorResult* const out_error)
{
const bool usePBOs = false;
webgl::PackingInfo pi;
if (!mContext->ValidateUnpackInfo(funcName, unpackFormat, unpackType, &pi))
if (!mContext->ValidateUnpackInfo(funcName, usePBOs, unpackFormat, unpackType, &pi))
return;
//////
@ -415,7 +467,9 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
const uint32_t depth = 1;
if (!layersImage && !dataSurf) {
const webgl::TexUnpackBytes blob(mContext, target, width, height, depth, nullptr);
const bool isClientData = true;
const webgl::TexUnpackBytes blob(mContext, target, width, height, depth,
isClientData, nullptr);
TexOrSubImageBlob(isSubImage, funcName, target, level, internalFormat, xOffset,
yOffset, zOffset, pi, &blob);
return;
@ -453,7 +507,7 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
//////
// Ok, we're good!
UniquePtr<const webgl::TexUnpackBlob> blob;
UniquePtr<webgl::TexUnpackBlob> blob;
const bool isAlphaPremult = sfer.mIsPremultiplied;
if (layersImage) {

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

@ -40,7 +40,7 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLTimerQuery)
private:
explicit WebGLTimerQuery(WebGLContext* webgl, GLuint name);
WebGLTimerQuery(WebGLContext* webgl, GLuint name);
~WebGLTimerQuery();
GLenum mTarget;

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

@ -22,7 +22,7 @@ class WebGLTransformFeedback final
friend class WebGL2Context;
public:
explicit WebGLTransformFeedback(WebGLContext* webgl, GLuint tf);
WebGLTransformFeedback(WebGLContext* webgl, GLuint tf);
void Delete();
WebGLContext* GetParentObject() const;

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

@ -16,6 +16,9 @@ typedef int64_t WebGLintptr;
typedef bool WebGLboolean;
namespace mozilla {
namespace gl {
class GLContext; // This is going to be needed a lot.
} // namespace gl
/*
* WebGLTextureFakeBlackStatus is an enum to track what needs to use a dummy 1x1 black

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

@ -23,6 +23,7 @@ class WebGLProgram;
namespace webgl {
struct LinkedProgramInfo;
struct UniformInfo;
} // namespace webgl
class WebGLUniformLocation final

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

@ -4464,15 +4464,12 @@ skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.
[generated/test_2_conformance2__buffers__bound-buffer-size-change-test.html]
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1') || (os == 'win' && os_version == '6.2'))
[generated/test_2_conformance2__buffers__buffer-copying-contents.html]
fail-if = (os == 'mac') || (os == 'win')
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1') || (os == 'win' && os_version == '6.2'))
[generated/test_2_conformance2__buffers__buffer-copying-restrictions.html]
fail-if = (os == 'mac') || (os == 'win')
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1') || (os == 'win' && os_version == '6.2'))
[generated/test_2_conformance2__buffers__buffer-overflow-test.html]
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1') || (os == 'win' && os_version == '6.2'))
[generated/test_2_conformance2__buffers__buffer-type-restrictions.html]
fail-if = (os == 'mac') || (os == 'win')
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1') || (os == 'win' && os_version == '6.2'))
[generated/test_2_conformance2__buffers__getBufferSubData.html]
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1') || (os == 'win' && os_version == '6.2'))
@ -5839,7 +5836,6 @@ skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.
fail-if = (os == 'mac')
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1') || (os == 'win' && os_version == '6.2'))
[generated/test_2_conformance__textures__misc__tex-image-with-invalid-data.html]
fail-if = (os == 'mac') || (os == 'win')
skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1') || (os == 'win' && os_version == '6.2'))
[generated/test_2_conformance__textures__misc__tex-sub-image-2d-bad-args.html]
fail-if = (os == 'mac') || (os == 'win')

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

@ -133,18 +133,12 @@ fail-if = (os == 'mac')
skip-if = (os == 'win')
[generated/test_2_conformance__extensions__webgl-compressed-texture-s3tc.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance__textures__misc__tex-image-with-invalid-data.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance2__buffers__buffer-type-restrictions.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance2__rendering__draw-buffers.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance__textures__misc__tex-image-with-format-and-type.html]
fail-if = (os == 'mac')
[generated/test_2_conformance__attribs__gl-vertexattribpointer.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance2__buffers__buffer-copying-restrictions.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance2__glsl3__forbidden-operators.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_conformance__textures__misc__tex-sub-image-2d-bad-args.html]
@ -155,8 +149,6 @@ fail-if = (os == 'mac') || (os == 'win')
fail-if = (os == 'mac') || (os == 'win')
[generated/test_conformance__extensions__oes-texture-half-float.html]
fail-if = (os == 'mac') || (os == 'win') || (os == 'android') || (os == 'linux')
[generated/test_2_conformance2__buffers__buffer-copying-contents.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance2__reading__read-pixels-pack-parameters.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_conformance__attribs__gl-vertexattribpointer.html]

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

@ -32,12 +32,11 @@ public:
{
return static_cast<HTMLTableCaptionElement*>(GetChild(nsGkAtoms::caption));
}
void SetCaption(HTMLTableCaptionElement* aCaption)
void SetCaption(HTMLTableCaptionElement* aCaption, ErrorResult& aError)
{
DeleteCaption();
if (aCaption) {
mozilla::ErrorResult rv;
nsINode::AppendChild(*aCaption, rv);
nsINode::AppendChild(*aCaption, aError);
}
}

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

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom() {
var table = document.createElement("table");
var cap = document.createElement("caption");
cap.appendChild(table)
table.caption = cap;
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -76,3 +76,4 @@ load 1228876.html
load 1230110.html
load 1237633.html
load 1281972-1.html
load 1282894.html

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

@ -1400,6 +1400,11 @@ interface nsIDOMWindowUtils : nsISupports {
*/
readonly attribute jsval supportsHardwareH264Decoding;
/**
* Returns the current audio backend as a free-form string.
*/
readonly attribute AString currentAudioBackend;
/**
* Record (and return) frame-intervals for frames which were presented
* between calling StartFrameTimeRecording and StopFrameTimeRecording.

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

@ -2010,11 +2010,11 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
mPuppetWidget->GetDefaultScale());
if (localEvent.mMessage == eTouchStart && AsyncPanZoomEnabled()) {
nsCOMPtr<nsIDocument> document = GetDocument();
if (gfxPrefs::TouchActionEnabled()) {
APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(mPuppetWidget,
localEvent, aInputBlockId, mSetAllowedTouchBehaviorCallback);
document, localEvent, aInputBlockId, mSetAllowedTouchBehaviorCallback);
}
nsCOMPtr<nsIDocument> document = GetDocument();
APZCCallbackHelper::SendSetTargetAPZCNotification(mPuppetWidget, document,
localEvent, aGuid, aInputBlockId);
}

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

@ -2118,6 +2118,9 @@ TabParent::RecvReplyKeyEvent(const WidgetKeyboardEvent& event)
nsPresContext* presContext = presShell->GetPresContext();
NS_ENSURE_TRUE(presContext, true);
AutoHandlingUserInputStatePusher userInpStatePusher(localEvent.IsTrusted(),
&localEvent, doc);
EventDispatcher::Dispatch(mFrameElement, presContext, &localEvent);
return true;
}

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

@ -296,5 +296,15 @@ cubeb_stream_type ConvertChannelToCubebType(dom::AudioChannel aChannel)
}
#endif
void GetCurrentBackend(nsAString& aBackend)
{
const char* backend = cubeb_get_backend_id(GetCubebContext());
if (!backend) {
aBackend.AssignLiteral("unknown");
return;
}
aBackend.AssignASCII(backend);
}
} // namespace CubebUtils
} // namespace mozilla

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