зеркало из https://github.com/mozilla/gecko-dev.git
Merge latest green b2g-inbound changeset and mozilla-central
This commit is contained in:
Коммит
23e525166f
|
@ -10,16 +10,6 @@ GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c
|
|||
|
||||
FORCE_SHARED_LIB = 1
|
||||
|
||||
CSRCS = \
|
||||
dlldata.c \
|
||||
ISimpleDOMNode_p.c \
|
||||
ISimpleDOMNode_i.c \
|
||||
ISimpleDOMDocument_p.c \
|
||||
ISimpleDOMDocument_i.c \
|
||||
ISimpleDOMText_p.c \
|
||||
ISimpleDOMText_i.c \
|
||||
$(NULL)
|
||||
|
||||
MIDL_GENERATED_FILES = \
|
||||
ISimpleDOMNode.h \
|
||||
ISimpleDOMNode_p.c \
|
||||
|
|
|
@ -8,3 +8,12 @@ MODULE = 'accessibility'
|
|||
|
||||
LIBRARY_NAME = 'AccessibleMarshal'
|
||||
|
||||
GENERATED_SOURCES += [
|
||||
'dlldata.c',
|
||||
'ISimpleDOMDocument_i.c',
|
||||
'ISimpleDOMDocument_p.c',
|
||||
'ISimpleDOMNode_i.c',
|
||||
'ISimpleDOMNode_p.c',
|
||||
'ISimpleDOMText_i.c',
|
||||
'ISimpleDOMText_p.c',
|
||||
]
|
||||
|
|
|
@ -881,10 +881,11 @@ HyperTextAccessible::GetTextBeforeOffset(int32_t aOffset,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
int32_t adjustedOffset = ConvertMagicOffset(aOffset);
|
||||
if (adjustedOffset < 0)
|
||||
int32_t convertedOffset = ConvertMagicOffset(aOffset);
|
||||
if (convertedOffset < 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
int32_t adjustedOffset = convertedOffset;
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)
|
||||
adjustedOffset = AdjustCaretOffset(adjustedOffset);
|
||||
|
||||
|
@ -913,7 +914,7 @@ HyperTextAccessible::GetTextBeforeOffset(int32_t aOffset,
|
|||
|
||||
case BOUNDARY_WORD_END: {
|
||||
// Move word backward twice to find start and end offsets.
|
||||
*aEndOffset = FindWordBoundary(adjustedOffset, eDirPrevious, eEndWord);
|
||||
*aEndOffset = FindWordBoundary(convertedOffset, eDirPrevious, eEndWord);
|
||||
*aStartOffset = FindWordBoundary(*aEndOffset, eDirPrevious, eEndWord);
|
||||
return GetText(*aStartOffset, *aEndOffset, aText);
|
||||
}
|
||||
|
@ -1009,10 +1010,11 @@ HyperTextAccessible::GetTextAfterOffset(int32_t aOffset,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
int32_t adjustedOffset = ConvertMagicOffset(aOffset);
|
||||
if (adjustedOffset < 0)
|
||||
int32_t convertedOffset = ConvertMagicOffset(aOffset);
|
||||
if (convertedOffset < 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
int32_t adjustedOffset = convertedOffset;
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)
|
||||
adjustedOffset = AdjustCaretOffset(adjustedOffset);
|
||||
|
||||
|
@ -1031,13 +1033,13 @@ HyperTextAccessible::GetTextAfterOffset(int32_t aOffset,
|
|||
// If the offset is a word end (except 0 offset) then move forward to find
|
||||
// end offset (start offset is the given offset). Otherwise move forward
|
||||
// twice to find both start and end offsets.
|
||||
if (adjustedOffset == 0) {
|
||||
*aStartOffset = FindWordBoundary(adjustedOffset, eDirNext, eEndWord);
|
||||
if (convertedOffset == 0) {
|
||||
*aStartOffset = FindWordBoundary(convertedOffset, eDirNext, eEndWord);
|
||||
*aEndOffset = FindWordBoundary(*aStartOffset, eDirNext, eEndWord);
|
||||
} else {
|
||||
*aEndOffset = FindWordBoundary(adjustedOffset, eDirNext, eEndWord);
|
||||
*aEndOffset = FindWordBoundary(convertedOffset, eDirNext, eEndWord);
|
||||
*aStartOffset = FindWordBoundary(*aEndOffset, eDirPrevious, eEndWord);
|
||||
if (*aStartOffset != adjustedOffset) {
|
||||
if (*aStartOffset != convertedOffset) {
|
||||
*aStartOffset = *aEndOffset;
|
||||
*aEndOffset = FindWordBoundary(*aStartOffset, eDirNext, eEndWord);
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ xpcaccevents_FILES := xpcAccEvents.h
|
|||
xpcaccevents_DEST = $(DIST)/include
|
||||
xpcaccevents_TARGET := export
|
||||
|
||||
CPPSRCS += xpcAccEvents.cpp
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifneq ($(A11Y_LOG),0)
|
||||
|
|
|
@ -12,6 +12,10 @@ SOURCES += [
|
|||
'xpcAccessibleTableCell.cpp',
|
||||
]
|
||||
|
||||
GENERATED_SOURCES += [
|
||||
'xpcAccEvents.cpp',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_xpcom_s'
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
|
|
@ -29,93 +29,144 @@
|
|||
|
||||
function traverseTextByLines(aQueue, aID, aLines)
|
||||
{
|
||||
var baseInvoker = new synthFocus(aID);
|
||||
var baseInvokerID = "move to last line end";
|
||||
|
||||
var wholeText = "";
|
||||
for (var i = 0; i < aLines.length ; i++)
|
||||
wholeText += aLines[i][0] + aLines[i][1];
|
||||
|
||||
for (var i = aLines.length - 1; i >= 0 ; i--) {
|
||||
var cLine = new line(wholeText, aLines, i);
|
||||
var pLine = cLine.prevLine;
|
||||
var ppLine = pLine.prevLine;
|
||||
var nLine = cLine.nextLine;
|
||||
var nnLine = nLine.nextLine;
|
||||
|
||||
// Shared line tests.
|
||||
var lineTests = [
|
||||
[ testTextBeforeOffset, BOUNDARY_LINE_START, pLine.start, cLine.start],
|
||||
[ testTextBeforeOffset, BOUNDARY_LINE_END, ppLine.end, pLine.end],
|
||||
[ testTextAtOffset, BOUNDARY_LINE_START, cLine.start, nLine.start],
|
||||
[ testTextAtOffset, BOUNDARY_LINE_END, pLine.end, cLine.end],
|
||||
[ testTextAfterOffset, BOUNDARY_LINE_START, nLine.start, nnLine.start],
|
||||
[ testTextAfterOffset, BOUNDARY_LINE_END, cLine.end, nLine.end]
|
||||
];
|
||||
|
||||
// Word tests for "caret at the end of the line".
|
||||
var lastWord = cLine.lastWord;
|
||||
var pLastWord = lastWord.prevWord;
|
||||
var ppLastWord = pLastWord.prevWord;
|
||||
var nLastWord = lastWord.nextWord;
|
||||
var nnLastWord = nLastWord.nextWord;
|
||||
var isAtEnd = (cLine.end == wholeText.length);
|
||||
var isAtWordEnd = (cLine.end = lastWord.end);
|
||||
|
||||
var lineEndWordTests = [
|
||||
[ testTextBeforeOffset, BOUNDARY_WORD_START, pLastWord.start, lastWord.start ],
|
||||
[ testTextBeforeOffset, BOUNDARY_WORD_END, ppLastWord.end, pLastWord.end ],
|
||||
[ testTextAtOffset, BOUNDARY_WORD_START, lastWord.start, nLastWord.start ],
|
||||
[ testTextAtOffset, BOUNDARY_WORD_END,
|
||||
(isAtEnd ? pLastWord : lastWord).end,
|
||||
(isAtEnd ? lastWord : nLastWord).end ],
|
||||
[ testTextAfterOffset, BOUNDARY_WORD_START, nLastWord.start, nnLastWord.start ],
|
||||
[ testTextAfterOffset, BOUNDARY_WORD_END,
|
||||
(isAtWordEnd ? lastWord : nLastWord).end,
|
||||
(isAtWordEnd ? nLastWord : nnLastWord).end ]
|
||||
];
|
||||
|
||||
// Add "caret at the end of the line" tests.
|
||||
aQueue.push(new tmpl_moveTo(aID, baseInvoker, baseInvokerID, wholeText,
|
||||
lineTests.concat(lineEndWordTests),
|
||||
cLine.lineEndFailures));
|
||||
|
||||
// Word tests for "caret at the end of the line".
|
||||
var firstWord = cLine.firstWord;
|
||||
var pFirstWord = firstWord.prevWord;
|
||||
var ppFirstWord = pFirstWord.prevWord;
|
||||
var nFirstWord = firstWord.nextWord;
|
||||
var nnFirstWord = nFirstWord.nextWord;
|
||||
var isAtWordBegin = (cLine.start == firstWord.start);
|
||||
var lineStartWordTests = [
|
||||
[ testTextBeforeOffset, BOUNDARY_WORD_START,
|
||||
(isAtWordBegin ? pFirstWord : ppFirstWord).start,
|
||||
(isAtWordBegin ? firstWord : pFirstWord).start ],
|
||||
[ testTextBeforeOffset, BOUNDARY_WORD_END, ppFirstWord.end, pFirstWord.end ],
|
||||
[ testTextAtOffset, BOUNDARY_WORD_START,
|
||||
(isAtWordBegin ? firstWord : pFirstWord).start,
|
||||
(isAtWordBegin ? nFirstWord : firstWord).start ],
|
||||
[ testTextAtOffset, BOUNDARY_WORD_END, pFirstWord.end, firstWord.end ],
|
||||
[ testTextAfterOffset, BOUNDARY_WORD_START,
|
||||
(isAtWordBegin ? nFirstWord : firstWord).start,
|
||||
(isAtWordBegin ? nnFirstWord : nFirstWord).start ],
|
||||
[ testTextAfterOffset, BOUNDARY_WORD_END, firstWord.end, nFirstWord.end ],
|
||||
];
|
||||
|
||||
baseInvoker = new moveToLineStart(aID, cLine.start);
|
||||
baseInvokerID = "move to " + i + "th line start";
|
||||
|
||||
// Add "caret at the start of the line" tests.
|
||||
aQueue.push(new tmpl_moveTo(aID, baseInvoker, baseInvokerID, wholeText,
|
||||
lineTests.concat(lineStartWordTests),
|
||||
cLine.lineStartFailures));
|
||||
|
||||
// Next loop invoker to move caret at the end of prev line.
|
||||
baseInvoker = new moveToPrevLineEnd(aID, pLine.end);
|
||||
baseInvokerID = "move to " + (i - 1) + "th line end";
|
||||
var baseInvokerFunc = synthClick;
|
||||
var charIter = new charIterator(wholeText, aLines);
|
||||
//charIter.debugOffset = 0;
|
||||
while (charIter.next()) {
|
||||
aQueue.push(new tmpl_moveTo(aID, baseInvokerFunc, wholeText, charIter));
|
||||
baseInvokerFunc = synthRightKey;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get test list for each traversed character.
|
||||
*/
|
||||
function charIterator(aWholeText, aLines)
|
||||
{
|
||||
this.next = function charIterator_next()
|
||||
{
|
||||
// Don't increment offset if we are at end of the wrapped line
|
||||
// (offset is shared between end of this line and start of next line).
|
||||
if (this.mAtWrappedLineEnd) {
|
||||
this.mAtWrappedLineEnd = false;
|
||||
this.mLine = this.mLine.nextLine;
|
||||
return true;
|
||||
}
|
||||
|
||||
this.mOffset++;
|
||||
if (this.mOffset > aWholeText.length)
|
||||
return false;
|
||||
|
||||
var nextLine = this.mLine.nextLine;
|
||||
if (!nextLine.isFakeLine() && this.mOffset == nextLine.start) {
|
||||
if (nextLine.start == this.mLine.end)
|
||||
this.mAtWrappedLineEnd = true;
|
||||
else
|
||||
this.mLine = nextLine;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Object.defineProperty(this, "offset", { get: function()
|
||||
{ return this.mOffset; }
|
||||
});
|
||||
|
||||
Object.defineProperty(this, "offsetDescr", { get: function()
|
||||
{
|
||||
return this.mOffset + " offset (" + this.mLine.number + " line, " +
|
||||
(this.mOffset - this.mLine.start) + " offset on the line)";
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(this, "tests", { get: function()
|
||||
{
|
||||
// Line boundary tests.
|
||||
var cLine = this.mLine;
|
||||
var pLine = cLine.prevLine;
|
||||
var ppLine = pLine.prevLine;
|
||||
var nLine = cLine.nextLine;
|
||||
var nnLine = nLine.nextLine;
|
||||
|
||||
var lineTests = [
|
||||
[ testTextBeforeOffset, BOUNDARY_LINE_START, pLine.start, cLine.start],
|
||||
[ testTextBeforeOffset, BOUNDARY_LINE_END, ppLine.end, pLine.end],
|
||||
[ testTextAtOffset, BOUNDARY_LINE_START, cLine.start, nLine.start],
|
||||
[ testTextAtOffset, BOUNDARY_LINE_END, pLine.end, cLine.end],
|
||||
[ testTextAfterOffset, BOUNDARY_LINE_START, nLine.start, nnLine.start],
|
||||
[ testTextAfterOffset, BOUNDARY_LINE_END, cLine.end, nLine.end]
|
||||
];
|
||||
|
||||
// Word boundary tests.
|
||||
var cWord = this.mLine.firstWord;
|
||||
var nWord = cWord.nextWord, pWord = cWord.prevWord;
|
||||
|
||||
// The current word is a farthest word starting at or after the offset.
|
||||
if (this.mOffset >= nWord.start) {
|
||||
while (this.mOffset >= nWord.start && !this.mLine.isLastWord(cWord)) {
|
||||
cWord = nWord;
|
||||
nWord = nWord.nextWord;
|
||||
}
|
||||
pWord = cWord.prevWord;
|
||||
|
||||
} else if (this.mOffset < cWord.start) {
|
||||
while (this.mOffset < cWord.start) {
|
||||
cWord = pWord;
|
||||
pWord = pWord.prevWord;
|
||||
}
|
||||
nWord = cWord.nextWord;
|
||||
}
|
||||
|
||||
var nnWord = nWord.nextWord, ppWord = pWord.prevWord;
|
||||
|
||||
var isAfterWordEnd =
|
||||
this.mOffset > cWord.end || cWord.line != this.mLine;
|
||||
var isAtOrAfterWordEnd = (this.mOffset >= cWord.end);
|
||||
var useNextWordForAtWordEnd =
|
||||
isAtOrAfterWordEnd && this.mOffset != aWholeText.length;
|
||||
|
||||
var wordTests = [
|
||||
[ testTextBeforeOffset, BOUNDARY_WORD_START,
|
||||
pWord.start, cWord.start ],
|
||||
[ testTextBeforeOffset, BOUNDARY_WORD_END,
|
||||
(isAfterWordEnd ? pWord : ppWord).end,
|
||||
(isAfterWordEnd ? cWord : pWord).end ],
|
||||
[ testTextAtOffset, BOUNDARY_WORD_START,
|
||||
cWord.start, nWord.start ],
|
||||
[ testTextAtOffset, BOUNDARY_WORD_END,
|
||||
(useNextWordForAtWordEnd ? cWord : pWord).end,
|
||||
(useNextWordForAtWordEnd ? nWord : cWord).end ],
|
||||
[ testTextAfterOffset, BOUNDARY_WORD_START,
|
||||
nWord.start, nnWord.start ],
|
||||
[ testTextAfterOffset, BOUNDARY_WORD_END,
|
||||
(isAfterWordEnd ? nWord : cWord).end,
|
||||
(isAfterWordEnd ? nnWord : nWord).end ]
|
||||
];
|
||||
|
||||
return lineTests.concat(wordTests);
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(this, "failures", { get: function()
|
||||
{
|
||||
if (this.mOffset == this.mLine.start)
|
||||
return this.mLine.lineStartFailures;
|
||||
if (this.mOffset == this.mLine.end)
|
||||
return this.mLine.lineEndFailures;
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
this.mOffset = -1;
|
||||
this.mLine = new line(aWholeText, aLines, 0);
|
||||
this.mAtWrappedLineEnd = false;
|
||||
this.mWord = this.mLine.firstWord;
|
||||
}
|
||||
|
||||
/**
|
||||
* A line object. Allows to navigate by lines and by words.
|
||||
*/
|
||||
|
@ -155,6 +206,17 @@
|
|||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(this, "number", { get: function()
|
||||
{ return aIndex; }
|
||||
});
|
||||
Object.defineProperty(this, "wholeText", { get: function()
|
||||
{ return aWholeText; }
|
||||
});
|
||||
this.isFakeLine = function line_isFakeLine()
|
||||
{
|
||||
return aIndex < 0 || aIndex >= aLines.length;
|
||||
}
|
||||
|
||||
Object.defineProperty(this, "lastWord", { get: function()
|
||||
{
|
||||
if (aIndex < 0)
|
||||
|
@ -178,6 +240,12 @@
|
|||
}
|
||||
});
|
||||
|
||||
this.isLastWord = function line_isLastWord(aWord)
|
||||
{
|
||||
var lastWord = this.lastWord;
|
||||
return lastWord.start == aWord.start && lastWord.end == aWord.end;
|
||||
}
|
||||
|
||||
Object.defineProperty(this, "lineStartFailures", { get: function()
|
||||
{
|
||||
if (aIndex < 0 || aIndex >= aLines.length)
|
||||
|
@ -212,7 +280,6 @@
|
|||
return prevLineLastWord;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(this, "nextWord", { get: function()
|
||||
{
|
||||
if (aIndex + 2 < aWords.length)
|
||||
|
@ -225,6 +292,8 @@
|
|||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(this, "line", { get: function() { return aLine; } });
|
||||
|
||||
Object.defineProperty(this, "start", { get: function()
|
||||
{
|
||||
if (this.isFakeStartWord())
|
||||
|
@ -244,6 +313,13 @@
|
|||
}
|
||||
});
|
||||
|
||||
this.toString = function word_toString()
|
||||
{
|
||||
var start = this.start, end = this.end;
|
||||
return "'" + aLine.wholeText.substring(start, end) +
|
||||
"' at [" + start + ", " + end + "]";
|
||||
}
|
||||
|
||||
this.isFakeStartWord = function() { return aIndex < 0; }
|
||||
this.isFakeEndWord = function() { return aIndex >= aWords.length; }
|
||||
}
|
||||
|
@ -251,23 +327,28 @@
|
|||
/**
|
||||
* A template invoker to move through the text.
|
||||
*/
|
||||
function tmpl_moveTo(aID, aInvoker, aInvokerID, aWholeText, aTests,
|
||||
aFailures)
|
||||
function tmpl_moveTo(aID, aInvokerFunc, aWholeText, aCharIter)
|
||||
{
|
||||
this.__proto__ = aInvoker;
|
||||
this.offset = aCharIter.offset;
|
||||
|
||||
var checker = new caretMoveChecker(this.offset, aID);
|
||||
this.__proto__ = new (aInvokerFunc)(aID, checker);
|
||||
|
||||
this.finalCheck = function genericMoveTo_finalCheck()
|
||||
{
|
||||
for (var i = 0; i < aTests.length; i++) {
|
||||
var func = aTests[i][0];
|
||||
var boundary = aTests[i][1];
|
||||
var startOffset = aTests[i][2];
|
||||
var endOffset = aTests[i][3];
|
||||
if (this.noTests())
|
||||
return;
|
||||
|
||||
for (var i = 0; i < this.tests.length; i++) {
|
||||
var func = this.tests[i][0];
|
||||
var boundary = this.tests[i][1];
|
||||
var startOffset = this.tests[i][2];
|
||||
var endOffset = this.tests[i][3];
|
||||
var text = aWholeText.substring(startOffset, endOffset);
|
||||
|
||||
var isOk1 = kOk, isOk2 = kOk, isOk3 = kOk;
|
||||
for (var fIdx = 0; fIdx < aFailures.length; fIdx++) {
|
||||
var failure = aFailures[fIdx];
|
||||
for (var fIdx = 0; fIdx < this.failures.length; fIdx++) {
|
||||
var failure = this.failures[fIdx];
|
||||
if (func.name.indexOf(failure[0]) != -1 && boundary == failure[1]) {
|
||||
isOk1 = failure[2];
|
||||
isOk2 = failure[3];
|
||||
|
@ -282,8 +363,18 @@
|
|||
|
||||
this.getID = function genericMoveTo_getID()
|
||||
{
|
||||
return aInvokerID;
|
||||
return "move to " + this.offsetDescr;
|
||||
}
|
||||
|
||||
this.noTests = function tmpl_moveTo_noTests()
|
||||
{
|
||||
return ("debugOffset" in aCharIter) &&
|
||||
(aCharIter.debugOffset != this.offset);
|
||||
}
|
||||
|
||||
this.offsetDescr = aCharIter.offsetDescr;
|
||||
this.tests = this.noTests() ? null : aCharIter.tests;
|
||||
this.failures = aCharIter.failures;
|
||||
}
|
||||
|
||||
var gQueue = null;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"use strict"
|
||||
|
||||
function debug(str) {
|
||||
//dump("-*- ContentPermissionPrompt: " + str + "\n");
|
||||
//dump("-*- ContentPermissionPrompt: " + s + "\n");
|
||||
}
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
|
@ -13,14 +13,11 @@ const Cr = Components.results;
|
|||
const Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
|
||||
const PROMPT_FOR_UNKNOWN = ["audio-capture",
|
||||
"desktop-notification",
|
||||
"geolocation",
|
||||
"video-capture"];
|
||||
const PROMPT_FOR_UNKNOWN = ["geolocation", "desktop-notification",
|
||||
"audio-capture"];
|
||||
// Due to privary issue, permission requests like GetUserMedia should prompt
|
||||
// every time instead of providing session persistence.
|
||||
const PERMISSION_NO_SESSION = ["audio-capture", "video-capture"];
|
||||
const ALLOW_MULTIPLE_REQUESTS = ["audio-capture", "video-capture"];
|
||||
const PERMISSION_NO_SESSION = ["audio-capture"];
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
@ -44,21 +41,7 @@ XPCOMUtils.defineLazyServiceGetter(this,
|
|||
"@mozilla.org/telephony/audiomanager;1",
|
||||
"nsIAudioManager");
|
||||
|
||||
/**
|
||||
* aTypesInfo is an array of {permission, access, action, deny} which keeps
|
||||
* the information of each permission. This arrary is initialized in
|
||||
* ContentPermissionPrompt.prompt and used among functions.
|
||||
*
|
||||
* aTypesInfo[].permission : permission name
|
||||
* aTypesInfo[].access : permission name + request.access
|
||||
* aTypesInfo[].action : the default action of this permission
|
||||
* aTypesInfo[].deny : true if security manager denied this app's origin
|
||||
* principal.
|
||||
* Note:
|
||||
* aTypesInfo[].permission will be sent to prompt only when
|
||||
* aTypesInfo[].action is PROMPT_ACTION and aTypesInfo[].deny is false.
|
||||
*/
|
||||
function rememberPermission(aTypesInfo, aPrincipal, aSession)
|
||||
function rememberPermission(aPermission, aPrincipal, aSession)
|
||||
{
|
||||
function convertPermToAllow(aPerm, aPrincipal)
|
||||
{
|
||||
|
@ -66,13 +49,12 @@ function rememberPermission(aTypesInfo, aPrincipal, aSession)
|
|||
permissionManager.testExactPermissionFromPrincipal(aPrincipal, aPerm);
|
||||
if (type == Ci.nsIPermissionManager.PROMPT_ACTION ||
|
||||
(type == Ci.nsIPermissionManager.UNKNOWN_ACTION &&
|
||||
PROMPT_FOR_UNKNOWN.indexOf(aPerm) >= 0)) {
|
||||
debug("add " + aPerm + " to permission manager with ALLOW_ACTION");
|
||||
PROMPT_FOR_UNKNOWN.indexOf(aPermission) >= 0)) {
|
||||
if (!aSession) {
|
||||
permissionManager.addFromPrincipal(aPrincipal,
|
||||
aPerm,
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
} else if (PERMISSION_NO_SESSION.indexOf(aPerm) < 0) {
|
||||
} else if (PERMISSION_NO_SESSION.indexOf(aPermission) < 0) {
|
||||
permissionManager.addFromPrincipal(aPrincipal,
|
||||
aPerm,
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION,
|
||||
|
@ -81,18 +63,14 @@ function rememberPermission(aTypesInfo, aPrincipal, aSession)
|
|||
}
|
||||
}
|
||||
|
||||
for (let i in aTypesInfo) {
|
||||
// Expand the permission to see if we have multiple access properties
|
||||
// to convert
|
||||
let perm = aTypesInfo[i].permission;
|
||||
let access = PermissionsTable[perm].access;
|
||||
if (access) {
|
||||
for (let idx in access) {
|
||||
convertPermToAllow(perm + "-" + access[idx], aPrincipal);
|
||||
}
|
||||
} else {
|
||||
convertPermToAllow(perm, aPrincipal);
|
||||
// Expand the permission to see if we have multiple access properties to convert
|
||||
let access = PermissionsTable[aPermission].access;
|
||||
if (access) {
|
||||
for (let idx in access) {
|
||||
convertPermToAllow(aPermission + "-" + access[idx], aPrincipal);
|
||||
}
|
||||
} else {
|
||||
convertPermToAllow(aPermission, aPrincipal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,63 +78,23 @@ function ContentPermissionPrompt() {}
|
|||
|
||||
ContentPermissionPrompt.prototype = {
|
||||
|
||||
handleExistingPermission: function handleExistingPermission(request,
|
||||
typesInfo) {
|
||||
typesInfo.forEach(function(type) {
|
||||
type.action =
|
||||
Services.perms.testExactPermissionFromPrincipal(request.principal,
|
||||
type.access);
|
||||
});
|
||||
|
||||
// If all permissions are allowed already, call allow() without prompting.
|
||||
let checkAllowPermission = function(type) {
|
||||
if (type.action == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (typesInfo.every(checkAllowPermission)) {
|
||||
debug("all permission requests are allowed");
|
||||
handleExistingPermission: function handleExistingPermission(request) {
|
||||
let access = (request.access && request.access !== "unused") ? request.type + "-" + request.access :
|
||||
request.type;
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(request.principal, access);
|
||||
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
request.allow();
|
||||
return true;
|
||||
}
|
||||
|
||||
// If all permissions are DENY_ACTION or UNKNOWN_ACTION, call cancel()
|
||||
// without prompting.
|
||||
let checkDenyPermission = function(type) {
|
||||
if (type.action == Ci.nsIPermissionManager.DENY_ACTION ||
|
||||
type.action == Ci.nsIPermissionManager.UNKNOWN_ACTION &&
|
||||
PROMPT_FOR_UNKNOWN.indexOf(type.access) < 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (typesInfo.every(checkDenyPermission)) {
|
||||
debug("all permission requests are denied");
|
||||
if (result == Ci.nsIPermissionManager.DENY_ACTION ||
|
||||
result == Ci.nsIPermissionManager.UNKNOWN_ACTION && PROMPT_FOR_UNKNOWN.indexOf(access) < 0) {
|
||||
request.cancel();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
// multiple requests should be audio and video
|
||||
checkMultipleRequest: function checkMultipleRequest(typesInfo) {
|
||||
if (typesInfo.length == 1) {
|
||||
return true;
|
||||
} else if (typesInfo.length > 1) {
|
||||
let checkIfAllowMultiRequest = function(type) {
|
||||
return (ALLOW_MULTIPLE_REQUESTS.indexOf(type.access) !== -1);
|
||||
}
|
||||
if (typesInfo.every(checkIfAllowMultiRequest)) {
|
||||
debug("legal multiple requests");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
handledByApp: function handledByApp(request, typesInfo) {
|
||||
handledByApp: function handledByApp(request) {
|
||||
if (request.principal.appId == Ci.nsIScriptSecurityManager.NO_APP_ID ||
|
||||
request.principal.appId == Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID) {
|
||||
// This should not really happen
|
||||
|
@ -168,94 +106,49 @@ ContentPermissionPrompt.prototype = {
|
|||
.getService(Ci.nsIAppsService);
|
||||
let app = appsService.getAppByLocalId(request.principal.appId);
|
||||
|
||||
// Check each permission if it's denied by permission manager with app's
|
||||
// URL.
|
||||
let checkIfDenyAppPrincipal = function(type) {
|
||||
let url = Services.io.newURI(app.origin, null, null);
|
||||
let principal = secMan.getAppCodebasePrincipal(url,
|
||||
request.principal.appId,
|
||||
/*mozbrowser*/false);
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(principal,
|
||||
type.access);
|
||||
let url = Services.io.newURI(app.origin, null, null);
|
||||
let principal = secMan.getAppCodebasePrincipal(url, request.principal.appId,
|
||||
/*mozbrowser*/false);
|
||||
let access = (request.access && request.access !== "unused") ? request.type + "-" + request.access :
|
||||
request.type;
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(principal, access);
|
||||
|
||||
if (result == Ci.nsIPermissionManager.ALLOW_ACTION ||
|
||||
result == Ci.nsIPermissionManager.PROMPT_ACTION) {
|
||||
type.deny = false;
|
||||
}
|
||||
return type.deny;
|
||||
}
|
||||
if (typesInfo.every(checkIfDenyAppPrincipal)) {
|
||||
request.cancel();
|
||||
return true;
|
||||
if (result == Ci.nsIPermissionManager.ALLOW_ACTION ||
|
||||
result == Ci.nsIPermissionManager.PROMPT_ACTION) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
request.cancel();
|
||||
return true;
|
||||
},
|
||||
|
||||
handledByPermissionType: function handledByPermissionType(request, typesInfo) {
|
||||
for (let i in typesInfo) {
|
||||
if (permissionSpecificChecker.hasOwnProperty(typesInfo[i].permission) &&
|
||||
permissionSpecificChecker[typesInfo[i].permission](request)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
handledByPermissionType: function handledByPermissionType(request) {
|
||||
return permissionSpecificChecker.hasOwnProperty(request.type)
|
||||
? permissionSpecificChecker[request.type](request)
|
||||
: false;
|
||||
},
|
||||
|
||||
_id: 0,
|
||||
prompt: function(request) {
|
||||
if (secMan.isSystemPrincipal(request.principal)) {
|
||||
request.allow();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Initialize the typesInfo and set the default value.
|
||||
let typesInfo = [];
|
||||
let perms = request.types.QueryInterface(Ci.nsIArray);
|
||||
for (let idx = 0; idx < perms.length; idx++) {
|
||||
let perm = perms.queryElementAt(idx, Ci.nsIContentPermissionType);
|
||||
let tmp = {
|
||||
permission: perm.type,
|
||||
access: (perm.access && perm.access !== "unused") ?
|
||||
perm.type + "-" + perm.access : perm.type,
|
||||
deny: true,
|
||||
action: Ci.nsIPermissionManager.UNKNOWN_ACTION
|
||||
};
|
||||
typesInfo.push(tmp);
|
||||
}
|
||||
if (typesInfo.length == 0) {
|
||||
request.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!this.checkMultipleRequest(typesInfo)) {
|
||||
request.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.handledByApp(request, typesInfo) ||
|
||||
this.handledByPermissionType(request, typesInfo)) {
|
||||
if (this.handledByApp(request) ||
|
||||
this.handledByPermissionType(request)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// returns true if the request was handled
|
||||
if (this.handleExistingPermission(request, typesInfo)) {
|
||||
if (this.handleExistingPermission(request))
|
||||
return;
|
||||
}
|
||||
|
||||
// prompt PROMPT_ACTION request only.
|
||||
typesInfo.forEach(function(aType, aIndex) {
|
||||
if (aType.action != Ci.nsIPermissionManager.PROMPT_ACTION || aType.deny) {
|
||||
typesInfo.splice(aIndex);
|
||||
}
|
||||
});
|
||||
|
||||
let frame = request.element;
|
||||
let requestId = this._id++;
|
||||
|
||||
if (!frame) {
|
||||
this.delegatePrompt(request, requestId, typesInfo);
|
||||
this.delegatePrompt(request, requestId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -270,7 +163,7 @@ ContentPermissionPrompt.prototype = {
|
|||
if (evt.detail.visible === true)
|
||||
return;
|
||||
|
||||
self.cancelPrompt(request, requestId, typesInfo);
|
||||
self.cancelPrompt(request, requestId);
|
||||
cancelRequest();
|
||||
}
|
||||
|
||||
|
@ -287,7 +180,7 @@ ContentPermissionPrompt.prototype = {
|
|||
// away but the request is still here.
|
||||
frame.addEventListener("mozbrowservisibilitychange", onVisibilityChange);
|
||||
|
||||
self.delegatePrompt(request, requestId, typesInfo, function onCallback() {
|
||||
self.delegatePrompt(request, requestId, function onCallback() {
|
||||
frame.removeEventListener("mozbrowservisibilitychange", onVisibilityChange);
|
||||
});
|
||||
};
|
||||
|
@ -298,17 +191,22 @@ ContentPermissionPrompt.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
cancelPrompt: function(request, requestId, typesInfo) {
|
||||
this.sendToBrowserWindow("cancel-permission-prompt", request, requestId,
|
||||
typesInfo);
|
||||
cancelPrompt: function(request, requestId) {
|
||||
this.sendToBrowserWindow("cancel-permission-prompt", request, requestId);
|
||||
},
|
||||
|
||||
delegatePrompt: function(request, requestId, typesInfo, callback) {
|
||||
delegatePrompt: function(request, requestId, callback) {
|
||||
let access = (request.access && request.access !== "unused") ? request.type + "-" + request.access :
|
||||
request.type;
|
||||
let principal = request.principal;
|
||||
|
||||
this.sendToBrowserWindow("permission-prompt", request, requestId, typesInfo,
|
||||
function(type, remember) {
|
||||
this._permission = access;
|
||||
this._uri = principal.URI.spec;
|
||||
this._origin = principal.origin;
|
||||
|
||||
this.sendToBrowserWindow("permission-prompt", request, requestId, function(type, remember) {
|
||||
if (type == "permission-allow") {
|
||||
rememberPermission(typesInfo, request.principal, !remember);
|
||||
rememberPermission(request.type, principal, !remember);
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
@ -316,20 +214,14 @@ ContentPermissionPrompt.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let addDenyPermission = function(type) {
|
||||
debug("add " + type.permission +
|
||||
" to permission manager with DENY_ACTION");
|
||||
if (remember) {
|
||||
Services.perms.addFromPrincipal(request.principal, type.access,
|
||||
Ci.nsIPermissionManager.DENY_ACTION);
|
||||
} else {
|
||||
Services.perms.addFromPrincipal(request.principal, type.access,
|
||||
Ci.nsIPermissionManager.DENY_ACTION,
|
||||
Ci.nsIPermissionManager.EXPIRE_SESSION,
|
||||
0);
|
||||
}
|
||||
if (remember) {
|
||||
Services.perms.addFromPrincipal(principal, access,
|
||||
Ci.nsIPermissionManager.DENY_ACTION);
|
||||
} else {
|
||||
Services.perms.addFromPrincipal(principal, access,
|
||||
Ci.nsIPermissionManager.DENY_ACTION,
|
||||
Ci.nsIPermissionManager.EXPIRE_SESSION, 0);
|
||||
}
|
||||
typesInfo.forEach(addDenyPermission);
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
|
@ -338,7 +230,7 @@ ContentPermissionPrompt.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
sendToBrowserWindow: function(type, request, requestId, typesInfo, callback) {
|
||||
sendToBrowserWindow: function(type, request, requestId, callback) {
|
||||
let browser = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let content = browser.getContentWindow();
|
||||
if (!content)
|
||||
|
@ -361,15 +253,10 @@ ContentPermissionPrompt.prototype = {
|
|||
principal.appStatus == Ci.nsIPrincipal.APP_STATUS_CERTIFIED)
|
||||
? true
|
||||
: request.remember;
|
||||
let permissions = [];
|
||||
for (let i in typesInfo) {
|
||||
debug("prompt " + typesInfo[i].permission);
|
||||
permissions.push(typesInfo[i].permission);
|
||||
}
|
||||
|
||||
let details = {
|
||||
type: type,
|
||||
permissions: permissions,
|
||||
permission: request.type,
|
||||
id: requestId,
|
||||
origin: principal.origin,
|
||||
isApp: isApp,
|
||||
|
@ -402,5 +289,6 @@ ContentPermissionPrompt.prototype = {
|
|||
};
|
||||
})();
|
||||
|
||||
|
||||
//module initialization
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPermissionPrompt]);
|
||||
|
|
|
@ -10,7 +10,6 @@ DEFINES += \
|
|||
-DGAIA_PATH=L\"$(subst /,\\\\,$(GAIA_PATH))\" \
|
||||
$(NULL)
|
||||
else # Non-windows machines use the same wrapper program
|
||||
CSRCS = run-b2g.c
|
||||
DEFINES += \
|
||||
-DB2G_NAME=\"$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)\" \
|
||||
-DGAIA_PATH=\"$(GAIA_PATH)\" \
|
||||
|
|
|
@ -10,3 +10,7 @@ if CONFIG['OS_ARCH'] == 'WINNT':
|
|||
SOURCES += [
|
||||
'run-b2g.cpp',
|
||||
]
|
||||
else:
|
||||
SOURCES += [
|
||||
'run-b2g.c',
|
||||
]
|
||||
|
|
|
@ -1963,21 +1963,13 @@ ContentPermissionPrompt.prototype = {
|
|||
|
||||
prompt: function CPP_prompt(request) {
|
||||
|
||||
// Only allow exactly one permission rquest here.
|
||||
let types = request.types.QueryInterface(Ci.nsIArray);
|
||||
if (types.length != 1) {
|
||||
request.cancel();
|
||||
return;
|
||||
}
|
||||
let perm = types.queryElementAt(0, Ci.nsIContentPermissionType);
|
||||
|
||||
const kFeatureKeys = { "geolocation" : "geo",
|
||||
"desktop-notification" : "desktop-notification",
|
||||
"pointerLock" : "pointerLock",
|
||||
};
|
||||
|
||||
// Make sure that we support the request.
|
||||
if (!(perm.type in kFeatureKeys)) {
|
||||
if (!(request.type in kFeatureKeys)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1989,7 +1981,7 @@ ContentPermissionPrompt.prototype = {
|
|||
return;
|
||||
|
||||
var autoAllow = false;
|
||||
var permissionKey = kFeatureKeys[perm.type];
|
||||
var permissionKey = kFeatureKeys[request.type];
|
||||
var result = Services.perms.testExactPermissionFromPrincipal(requestingPrincipal, permissionKey);
|
||||
|
||||
if (result == Ci.nsIPermissionManager.DENY_ACTION) {
|
||||
|
@ -2000,14 +1992,14 @@ ContentPermissionPrompt.prototype = {
|
|||
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
autoAllow = true;
|
||||
// For pointerLock, we still want to show a warning prompt.
|
||||
if (perm.type != "pointerLock") {
|
||||
if (request.type != "pointerLock") {
|
||||
request.allow();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Show the prompt.
|
||||
switch (perm.type) {
|
||||
switch (request.type) {
|
||||
case "geolocation":
|
||||
this._promptGeo(request);
|
||||
break;
|
||||
|
|
|
@ -443,6 +443,7 @@ TabTarget.prototype = {
|
|||
|
||||
if (this._inspector) {
|
||||
this._inspector.destroy();
|
||||
this._inspector = null;
|
||||
}
|
||||
|
||||
// First of all, do cleanup tasks that pertain to both remoted and
|
||||
|
|
|
@ -675,6 +675,8 @@ InspectorPanel.prototype = {
|
|||
this._markupFrame.parentNode.removeChild(this._markupFrame);
|
||||
delete this._markupFrame;
|
||||
}
|
||||
|
||||
this._markupBox = null;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -84,6 +84,7 @@ function test() {
|
|||
function finishUp() {
|
||||
let h = require("devtools/inspector/highlighter");
|
||||
h._forceBasic.value = false;
|
||||
inspector = doc = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -30,8 +30,9 @@ function test() {
|
|||
}
|
||||
|
||||
function endTests() {
|
||||
executeSoon(() => {
|
||||
toolbox.destroy();
|
||||
inspector.destroy().then(() =>
|
||||
toolbox.destroy()
|
||||
).then(() => {
|
||||
toolbox = inspector = page1 = page2 = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
|
@ -40,7 +41,7 @@ function test() {
|
|||
|
||||
function loadPageAnd(page, callback) {
|
||||
inspector.once("markuploaded", () => {
|
||||
executeSoon(callback);
|
||||
callback();
|
||||
});
|
||||
|
||||
if (page) {
|
||||
|
@ -58,7 +59,7 @@ function test() {
|
|||
|
||||
loadPageAnd(false, () => {
|
||||
is(inspector.selection.node.id, id, "Node re-selected after reload");
|
||||
executeSoon(callback);
|
||||
callback();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -85,14 +86,12 @@ function test() {
|
|||
// Last node selected was id4, go to a different page and check body is
|
||||
// selected
|
||||
loadPageAnd(page2, () => {
|
||||
executeSoon(() => {
|
||||
is(
|
||||
inspector.selection.node.tagName.toLowerCase(),
|
||||
"body",
|
||||
"Node not found, body selected"
|
||||
);
|
||||
executeSoon(testSameNodeSelectedOnNavigateAwayAndBack);
|
||||
});
|
||||
is(
|
||||
inspector.selection.node.tagName.toLowerCase(),
|
||||
"body",
|
||||
"Node not found, body selected"
|
||||
);
|
||||
testSameNodeSelectedOnNavigateAwayAndBack();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -106,17 +105,12 @@ function test() {
|
|||
inspector.once("inspector-updated", () => {
|
||||
is(inspector.selection.node.id, id);
|
||||
|
||||
executeSoon(() => {
|
||||
// go to page1 but do not select anything
|
||||
loadPageAnd(page1, () => {
|
||||
|
||||
executeSoon(() => {
|
||||
// go back to page2 and check id5 is still the current selection
|
||||
loadPageAnd(page2, () => {
|
||||
is(inspector.selection.node.id, id, "Node re-selected after navigation");
|
||||
executeSoon(endTests);
|
||||
});
|
||||
});
|
||||
// go to page1 but do not select anything
|
||||
loadPageAnd(page1, () => {
|
||||
// go back to page2 and check id5 is still the current selection
|
||||
loadPageAnd(page2, () => {
|
||||
is(inspector.selection.node.id, id, "Node re-selected after navigation");
|
||||
endTests();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -25,10 +25,7 @@ function inspectorRuleViewOpened()
|
|||
|
||||
gDevTools.once("toolbox-destroyed", inspectorClosed);
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
let toolbox = gDevTools.getToolbox(target);
|
||||
executeSoon(function() {
|
||||
toolbox.destroy();
|
||||
});
|
||||
gDevTools.getToolbox(target).destroy();
|
||||
}
|
||||
|
||||
function inspectorClosed()
|
||||
|
@ -55,6 +52,7 @@ function testNewDefaultTab()
|
|||
|
||||
function finishTest()
|
||||
{
|
||||
doc = inspector = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ function test() {
|
|||
}
|
||||
|
||||
function finishUp() {
|
||||
doc = inspector = null;
|
||||
doc = inspector = markup = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -1350,6 +1350,7 @@ var Scratchpad = {
|
|||
}
|
||||
|
||||
PreferenceObserver.uninit();
|
||||
CloseObserver.uninit();
|
||||
|
||||
this.editor.off("change", this._onChanged);
|
||||
this.editor.destroy();
|
||||
|
|
|
@ -28,8 +28,9 @@ support-files = head.js
|
|||
[browser_scratchpad_long_string.js]
|
||||
[browser_scratchpad_open.js]
|
||||
[browser_scratchpad_open_error_console.js]
|
||||
[browser_scratchpad_pprint-02.js]
|
||||
[browser_scratchpad_pprint.js]
|
||||
# Disabled, as escodegen is being replaced - bug 930141
|
||||
# [browser_scratchpad_pprint-02.js]
|
||||
# [browser_scratchpad_pprint.js]
|
||||
[browser_scratchpad_restore.js]
|
||||
[browser_scratchpad_tab_switch.js]
|
||||
[browser_scratchpad_ui.js]
|
||||
|
|
|
@ -75,6 +75,7 @@ function createDummyDocument() {
|
|||
eventTarget.addEventListener("DOMContentLoaded", function handler(event) {
|
||||
eventTarget.removeEventListener("DOMContentLoaded", handler, false);
|
||||
deferred.resolve(window.document);
|
||||
frame.remove();
|
||||
}, false);
|
||||
gDummyPromise = deferred.promise;
|
||||
return gDummyPromise;
|
||||
|
@ -1251,6 +1252,7 @@ CssRuleView.prototype = {
|
|||
{
|
||||
this.clear();
|
||||
|
||||
gDummyPromise = null;
|
||||
gDevTools.off("pref-changed", this._handlePrefChange);
|
||||
|
||||
this.element.removeEventListener("copy", this._onCopy);
|
||||
|
|
|
@ -174,7 +174,7 @@ function testIncrement( aEditor, aOptions )
|
|||
|
||||
function finishTest()
|
||||
{
|
||||
doc = null;
|
||||
doc = view = inspector = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ function failedClipboard(aExpectedPattern, aCallback)
|
|||
function finishup()
|
||||
{
|
||||
gBrowser.removeCurrentTab();
|
||||
doc = inspector = null;
|
||||
doc = inspector = win = null;
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ function elementStyleInherit()
|
|||
|
||||
function finishTest()
|
||||
{
|
||||
doc = null;
|
||||
doc = inspector = view = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ function disableOverride()
|
|||
|
||||
function finishTest()
|
||||
{
|
||||
doc = null;
|
||||
doc = inspector = view = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ function testNode(node, cb)
|
|||
|
||||
function finishTest()
|
||||
{
|
||||
doc = null;
|
||||
doc = inspector = view = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -44,8 +44,6 @@ let IndexedDB = {
|
|||
}
|
||||
|
||||
let prompt = Cc["@mozilla.org/content-permission/prompt;1"].createInstance(Ci.nsIContentPermissionPrompt);
|
||||
let types = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
|
||||
types.appendElement({type: type, access: "unused"}, false);
|
||||
|
||||
// If the user waits a long time before responding, we default to UNKNOWN_ACTION.
|
||||
let timeoutId = setTimeout(function() {
|
||||
|
@ -62,7 +60,7 @@ let IndexedDB = {
|
|||
}
|
||||
|
||||
prompt.prompt({
|
||||
types: types,
|
||||
type: type,
|
||||
uri: Services.io.newURI(payload.location, null, null),
|
||||
window: null,
|
||||
element: aMessage.target,
|
||||
|
|
|
@ -56,8 +56,8 @@ ContentPermissionPrompt.prototype = {
|
|||
return chromeWin.Browser.getNotificationBox(request.element);
|
||||
},
|
||||
|
||||
handleExistingPermission: function handleExistingPermission(request, type) {
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(request.principal, type);
|
||||
handleExistingPermission: function handleExistingPermission(request) {
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(request.principal, request.type);
|
||||
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
request.allow();
|
||||
return true;
|
||||
|
@ -70,28 +70,20 @@ ContentPermissionPrompt.prototype = {
|
|||
},
|
||||
|
||||
prompt: function(request) {
|
||||
// Only allow exactly one permission rquest here.
|
||||
let types = request.types.QueryInterface(Ci.nsIArray);
|
||||
if (types.length != 1) {
|
||||
request.cancel();
|
||||
return;
|
||||
}
|
||||
let perm = types.queryElementAt(0, Ci.nsIContentPermissionType);
|
||||
|
||||
// returns true if the request was handled
|
||||
if (this.handleExistingPermission(request, perm.type))
|
||||
if (this.handleExistingPermission(request))
|
||||
return;
|
||||
|
||||
let pm = Services.perms;
|
||||
let notificationBox = this.getNotificationBoxForRequest(request);
|
||||
let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
|
||||
|
||||
let notification = notificationBox.getNotificationWithValue(perm.type);
|
||||
let notification = notificationBox.getNotificationWithValue(request.type);
|
||||
if (notification)
|
||||
return;
|
||||
|
||||
let entityName = kEntities[perm.type];
|
||||
let icon = kIcons[perm.type] || "";
|
||||
let entityName = kEntities[request.type];
|
||||
let icon = kIcons[request.type] || "";
|
||||
|
||||
let buttons = [{
|
||||
label: browserBundle.GetStringFromName(entityName + ".allow"),
|
||||
|
@ -104,7 +96,7 @@ ContentPermissionPrompt.prototype = {
|
|||
label: browserBundle.GetStringFromName("contentPermissions.alwaysForSite"),
|
||||
accessKey: "",
|
||||
callback: function(notification) {
|
||||
Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
Services.perms.addFromPrincipal(request.principal, request.type, Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
request.allow();
|
||||
}
|
||||
},
|
||||
|
@ -112,7 +104,7 @@ ContentPermissionPrompt.prototype = {
|
|||
label: browserBundle.GetStringFromName("contentPermissions.neverForSite"),
|
||||
accessKey: "",
|
||||
callback: function(notification) {
|
||||
Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.DENY_ACTION);
|
||||
Services.perms.addFromPrincipal(request.principal, request.type, Ci.nsIPermissionManager.DENY_ACTION);
|
||||
request.cancel();
|
||||
}
|
||||
}];
|
||||
|
@ -120,12 +112,12 @@ ContentPermissionPrompt.prototype = {
|
|||
let message = browserBundle.formatStringFromName(entityName + ".wantsTo",
|
||||
[request.principal.URI.host], 1);
|
||||
let newBar = notificationBox.appendNotification(message,
|
||||
perm.type,
|
||||
request.type,
|
||||
icon,
|
||||
notificationBox.PRIORITY_WARNING_MEDIUM,
|
||||
buttons);
|
||||
|
||||
if (perm.type == "geolocation") {
|
||||
if (request.type == "geolocation") {
|
||||
// Add the "learn more" link.
|
||||
let link = newBar.ownerDocument.createElement("label");
|
||||
link.setAttribute("value", browserBundle.GetStringFromName("geolocation.learnMore"));
|
||||
|
|
|
@ -192,6 +192,18 @@ if test "$CLANG_CXX"; then
|
|||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-mismatched-tags"
|
||||
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 -z "$GNU_CC"; then
|
||||
case "$target" in
|
||||
*-mingw*)
|
||||
|
|
|
@ -9,11 +9,6 @@ STL_FLAGS =
|
|||
# installing it in dist/lib.
|
||||
LIBRARY = $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
|
||||
|
||||
VPATH += $(srcdir)/src
|
||||
|
||||
CPPSRCS += $(notdir $(wildcard $(srcdir)/src/*.cpp))
|
||||
CSRCS = $(notdir $(wildcard $(srcdir)/src/*.c))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_GNU_SOURCE
|
||||
|
|
|
@ -7,3 +7,41 @@
|
|||
LIBRARY_NAME = 'stlport_static'
|
||||
|
||||
FORCE_STATIC_LIB = True
|
||||
|
||||
SOURCES += [
|
||||
'src/allocators.cpp',
|
||||
'src/bitset.cpp',
|
||||
'src/codecvt.cpp',
|
||||
'src/collate.cpp',
|
||||
'src/complex.cpp',
|
||||
'src/complex_io.cpp',
|
||||
'src/complex_trig.cpp',
|
||||
'src/ctype.cpp',
|
||||
'src/dll_main.cpp',
|
||||
'src/facets_byname.cpp',
|
||||
'src/fstream.cpp',
|
||||
'src/ios.cpp',
|
||||
'src/iostream.cpp',
|
||||
'src/istream.cpp',
|
||||
'src/locale.cpp',
|
||||
'src/locale_catalog.cpp',
|
||||
'src/locale_impl.cpp',
|
||||
'src/messages.cpp',
|
||||
'src/monetary.cpp',
|
||||
'src/num_get.cpp',
|
||||
'src/num_get_float.cpp',
|
||||
'src/num_put.cpp',
|
||||
'src/num_put_float.cpp',
|
||||
'src/numpunct.cpp',
|
||||
'src/ostream.cpp',
|
||||
'src/sstream.cpp',
|
||||
'src/stdio_streambuf.cpp',
|
||||
'src/string.cpp',
|
||||
'src/strstream.cpp',
|
||||
'src/time_facets.cpp',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'src/c_locale.c',
|
||||
'src/cxa.c',
|
||||
]
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
gcc_version=4.7.3
|
||||
binutils_version=2.23.1
|
||||
gcc_bt_patch=$(readlink -f $(dirname $0))/gcc-bt.patch
|
||||
make_flags='-j12'
|
||||
|
||||
root_dir=$(mktemp -d)
|
||||
cd $root_dir
|
||||
|
||||
if test -z $TMPDIR; then
|
||||
TMPDIR=/tmp/
|
||||
fi
|
||||
|
||||
wget -c -P $TMPDIR ftp://ftp.gnu.org/gnu/binutils/binutils-$binutils_version.tar.bz2 || exit 1
|
||||
tar xjf $TMPDIR/binutils-$binutils_version.tar.bz2
|
||||
mkdir binutils-objdir
|
||||
cd binutils-objdir
|
||||
../binutils-$binutils_version/configure --prefix /tools/gcc/ --enable-gold --enable-plugins --disable-nls || exit 1
|
||||
make $make_flags || exit 1
|
||||
make install $make_flags DESTDIR=$root_dir || exit 1
|
||||
cd ..
|
||||
|
||||
wget -c -P $TMPDIR ftp://ftp.gnu.org/gnu/gcc/gcc-$gcc_version/gcc-$gcc_version.tar.bz2 || exit 1
|
||||
tar xjf $TMPDIR/gcc-$gcc_version.tar.bz2
|
||||
cd gcc-$gcc_version
|
||||
|
||||
./contrib/download_prerequisites
|
||||
|
||||
# gcc 4.7 doesn't dump a stack on ICE so hack that in
|
||||
patch -p1 < $gcc_bt_patch || exit 1
|
||||
|
||||
cd ..
|
||||
mkdir gcc-objdir
|
||||
cd gcc-objdir
|
||||
../gcc-$gcc_version/configure --prefix=/tools/gcc --enable-languages=c,c++ --disable-nls --disable-gnu-unique-object --enable-__cxa_atexit --with-arch-32=pentiumpro || exit 1
|
||||
make $make_flags || exit 1
|
||||
make $make_flags install DESTDIR=$root_dir || exit 1
|
||||
|
||||
cd $root_dir/tools
|
||||
tar caf $root_dir/gcc.tar.xz gcc/
|
|
@ -0,0 +1,25 @@
|
|||
--- gcc-4.7.3/gcc/diagnostic.c 2012-02-02 15:46:06.000000000 -0500
|
||||
+++ gcc-patched/gcc/diagnostic.c 2013-05-23 14:07:10.756527912 -0400
|
||||
@@ -31,6 +31,10 @@
|
||||
#include "intl.h"
|
||||
#include "diagnostic.h"
|
||||
|
||||
+#include <execinfo.h>
|
||||
+#include <unistd.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <stdio.h>
|
||||
#define pedantic_warning_kind(DC) \
|
||||
((DC)->pedantic_errors ? DK_ERROR : DK_WARNING)
|
||||
#define permissive_error_kind(DC) ((DC)->permissive ? DK_WARNING : DK_ERROR)
|
||||
@@ -237,6 +241,11 @@
|
||||
if (context->abort_on_error)
|
||||
real_abort ();
|
||||
|
||||
+ {
|
||||
+ void *stack[100];
|
||||
+ int count = backtrace(stack, 100);
|
||||
+ backtrace_symbols_fd(stack, count, STDERR_FILENO);
|
||||
+ }
|
||||
fnotice (stderr, "Please submit a full bug report,\n"
|
||||
"with preprocessed source if appropriate.\n"
|
||||
"See %s for instructions.\n", bug_report_url);
|
|
@ -1,22 +0,0 @@
|
|||
diff -ru a/binutils/ar.c b/binutils/ar.c
|
||||
--- a/binutils/ar.c 2011-03-16 04:35:58.000000000 -0400
|
||||
+++ b/binutils/ar.c 2012-01-19 15:44:46.211226017 -0500
|
||||
@@ -98,7 +98,7 @@
|
||||
/* Operate in deterministic mode: write zero for timestamps, uids,
|
||||
and gids for archive members and the archive symbol table, and write
|
||||
consistent file modes. */
|
||||
-int deterministic = 0;
|
||||
+int deterministic = TRUE;
|
||||
|
||||
/* Nonzero means it's the name of an existing member; position new or moved
|
||||
files with respect to this one. */
|
||||
@@ -634,9 +634,6 @@
|
||||
if (newer_only && operation != replace)
|
||||
fatal (_("`u' is only meaningful with the `r' option."));
|
||||
|
||||
- if (newer_only && deterministic)
|
||||
- fatal (_("`u' is not meaningful with the `D' option."));
|
||||
-
|
||||
if (postype != pos_default)
|
||||
posname = argv[arg_index++];
|
||||
|
|
@ -1,315 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# 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/.
|
||||
|
||||
|
||||
# The directories end up in the debug info, so the easy way of getting
|
||||
# a reproducible build is to run it in a know absolute directory.
|
||||
# We use a directory in /builds/slave because the mozilla infrastructure
|
||||
# cleans it up automatically.
|
||||
base_dir = "/builds/slave/moz-toolchain"
|
||||
|
||||
source_dir = base_dir + "/src"
|
||||
build_dir = base_dir + "/build"
|
||||
aux_inst_dir = build_dir + '/aux_inst'
|
||||
old_make = aux_inst_dir + '/bin/make'
|
||||
|
||||
##############################################
|
||||
|
||||
import urllib
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import tarfile
|
||||
import subprocess
|
||||
|
||||
def download_uri(uri):
|
||||
fname = uri.split('/')[-1]
|
||||
if (os.path.exists(fname)):
|
||||
return fname
|
||||
urllib.urlretrieve(uri, fname)
|
||||
return fname
|
||||
|
||||
def extract(tar, path):
|
||||
t = tarfile.open(tar)
|
||||
t.extractall(path)
|
||||
|
||||
def check_run(args):
|
||||
r = subprocess.call(args)
|
||||
assert r == 0
|
||||
|
||||
def run_in(path, args):
|
||||
d = os.getcwd()
|
||||
os.chdir(path)
|
||||
check_run(args)
|
||||
os.chdir(d)
|
||||
|
||||
def patch(patch, plevel, srcdir):
|
||||
patch = os.path.realpath(patch)
|
||||
check_run(['patch', '-d', srcdir, '-p%s' % plevel, '-i', patch, '--fuzz=0',
|
||||
'-s'])
|
||||
|
||||
def build_package(package_source_dir, package_build_dir, configure_args,
|
||||
make = old_make):
|
||||
if not os.path.exists(package_build_dir):
|
||||
os.mkdir(package_build_dir)
|
||||
run_in(package_build_dir,
|
||||
["%s/configure" % package_source_dir] + configure_args)
|
||||
run_in(package_build_dir, [make, "-j8"])
|
||||
run_in(package_build_dir, [make, "install"])
|
||||
|
||||
def build_aux_tools(base_dir):
|
||||
make_build_dir = base_dir + '/make_build'
|
||||
build_package(make_source_dir, make_build_dir,
|
||||
["--prefix=%s" % aux_inst_dir], "make")
|
||||
|
||||
run_in(unifdef_source_dir, ["make"])
|
||||
run_in(unifdef_source_dir, ["make", "prefix=%s" % aux_inst_dir, "install"])
|
||||
|
||||
tar_build_dir = base_dir + '/tar_build'
|
||||
build_package(tar_source_dir, tar_build_dir,
|
||||
["--prefix=%s" % aux_inst_dir])
|
||||
|
||||
gawk_build_dir = base_dir + '/gawk_build'
|
||||
build_package(gawk_source_dir, gawk_build_dir,
|
||||
["--prefix=%s" % aux_inst_dir])
|
||||
|
||||
def with_env(env, f):
|
||||
old_env = os.environ.copy()
|
||||
os.environ.update(env)
|
||||
f()
|
||||
os.environ.clear()
|
||||
os.environ.update(old_env)
|
||||
|
||||
def build_glibc(env, stage_dir, inst_dir):
|
||||
def f():
|
||||
build_glibc_aux(stage_dir, inst_dir)
|
||||
with_env(env, f)
|
||||
|
||||
def build_glibc_aux(stage_dir, inst_dir):
|
||||
glibc_build_dir = stage_dir + '/glibc'
|
||||
build_package(glibc_source_dir, glibc_build_dir,
|
||||
["--disable-profile",
|
||||
"--enable-add-ons=nptl",
|
||||
"--without-selinux",
|
||||
"--enable-kernel=%s" % linux_version,
|
||||
"--libdir=%s/lib64" % inst_dir,
|
||||
"--prefix=%s" % inst_dir])
|
||||
|
||||
def build_linux_headers_aux(inst_dir):
|
||||
run_in(linux_source_dir, [old_make, "headers_check"])
|
||||
run_in(linux_source_dir, [old_make, "INSTALL_HDR_PATH=dest",
|
||||
"headers_install"])
|
||||
shutil.move(linux_source_dir + "/dest/include", inst_dir + '/include')
|
||||
|
||||
def build_linux_headers(inst_dir):
|
||||
def f():
|
||||
build_linux_headers_aux(inst_dir)
|
||||
with_env({"PATH" : aux_inst_dir + "/bin:%s" % os.environ["PATH"]}, f)
|
||||
|
||||
def build_gcc(stage_dir, is_stage_one):
|
||||
gcc_build_dir = stage_dir + '/gcc'
|
||||
tool_inst_dir = stage_dir + '/inst'
|
||||
lib_inst_dir = stage_dir + '/libinst'
|
||||
gcc_configure_args = ["--prefix=%s" % tool_inst_dir,
|
||||
"--enable-__cxa_atexit",
|
||||
"--with-gmp=%s" % lib_inst_dir,
|
||||
"--with-mpfr=%s" % lib_inst_dir,
|
||||
"--with-mpc=%s" % lib_inst_dir,
|
||||
"--enable-languages=c,c++",
|
||||
"--disable-lto",
|
||||
"--disable-multilib",
|
||||
"--disable-bootstrap"]
|
||||
if is_stage_one:
|
||||
# We build the stage1 gcc without shared libraries. Otherwise its
|
||||
# libgcc.so would depend on the system libc.so, which causes problems
|
||||
# when it tries to use that libgcc.so and the libc we are about to
|
||||
# build.
|
||||
gcc_configure_args.append("--disable-shared")
|
||||
|
||||
build_package(gcc_source_dir, gcc_build_dir, gcc_configure_args)
|
||||
|
||||
if is_stage_one:
|
||||
# The glibc build system uses -lgcc_eh, but at least in this setup
|
||||
# libgcc.a has all it needs.
|
||||
d = tool_inst_dir + "/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/"
|
||||
os.symlink(d + "libgcc.a", d + "libgcc_eh.a")
|
||||
|
||||
def build_one_stage(env, stage_dir, is_stage_one):
|
||||
def f():
|
||||
build_one_stage_aux(stage_dir, is_stage_one)
|
||||
with_env(env, f)
|
||||
|
||||
def build_one_stage_aux(stage_dir, is_stage_one):
|
||||
os.mkdir(stage_dir)
|
||||
|
||||
lib_inst_dir = stage_dir + '/libinst'
|
||||
|
||||
gmp_build_dir = stage_dir + '/gmp'
|
||||
build_package(gmp_source_dir, gmp_build_dir,
|
||||
["--prefix=%s" % lib_inst_dir, "--disable-shared"])
|
||||
mpfr_build_dir = stage_dir + '/mpfr'
|
||||
build_package(mpfr_source_dir, mpfr_build_dir,
|
||||
["--prefix=%s" % lib_inst_dir, "--disable-shared",
|
||||
"--with-gmp=%s" % lib_inst_dir])
|
||||
mpc_build_dir = stage_dir + '/mpc'
|
||||
build_package(mpc_source_dir, mpc_build_dir,
|
||||
["--prefix=%s" % lib_inst_dir, "--disable-shared",
|
||||
"--with-gmp=%s" % lib_inst_dir,
|
||||
"--with-mpfr=%s" % lib_inst_dir])
|
||||
|
||||
tool_inst_dir = stage_dir + '/inst'
|
||||
os.mkdir(tool_inst_dir)
|
||||
os.mkdir(tool_inst_dir + '/lib64')
|
||||
os.symlink('lib64', tool_inst_dir + '/lib')
|
||||
|
||||
build_linux_headers(tool_inst_dir)
|
||||
|
||||
# zlib's configure only works if run from the source dir, copy the source
|
||||
zlib_build_dir = stage_dir + '/zlib'
|
||||
shutil.copytree(zlib_source_dir, zlib_build_dir)
|
||||
build_package(zlib_build_dir, zlib_build_dir,
|
||||
["--prefix=%s" % tool_inst_dir])
|
||||
|
||||
binutils_build_dir = stage_dir + '/binutils'
|
||||
build_package(binutils_source_dir, binutils_build_dir,
|
||||
["--prefix=%s" % tool_inst_dir,
|
||||
"--without-zlib"])
|
||||
|
||||
# During stage one we have to build gcc first, this glibc doesn't even
|
||||
# build with gcc 4.6. During stage two, we have to build glibc first.
|
||||
# The problem is that libstdc++ is built with xgcc and if glibc has
|
||||
# not been built yet xgcc will use the system one.
|
||||
if is_stage_one:
|
||||
build_gcc(stage_dir, is_stage_one)
|
||||
build_glibc({"CC" : tool_inst_dir + "/bin/gcc",
|
||||
"CXX" : tool_inst_dir + "/bin/g++"},
|
||||
stage_dir, tool_inst_dir)
|
||||
else:
|
||||
build_glibc({}, stage_dir, tool_inst_dir)
|
||||
build_gcc(stage_dir, is_stage_one)
|
||||
|
||||
def build_tar_package(tar, name, base, directory):
|
||||
name = os.path.realpath(name)
|
||||
run_in(base, [tar, "-cf", name, "--mtime=2012-01-01", "--owner=root",
|
||||
directory])
|
||||
|
||||
##############################################
|
||||
|
||||
def build_source_dir(prefix, version):
|
||||
return source_dir + '/' + prefix + version
|
||||
|
||||
binutils_version = "2.21.1"
|
||||
glibc_version = "2.5.1"
|
||||
linux_version = "2.6.18"
|
||||
tar_version = "1.26"
|
||||
gawk_version = "3.1.5"
|
||||
make_version = "3.81"
|
||||
gcc_version = "4.5.2"
|
||||
mpfr_version = "2.4.2"
|
||||
zlib_version = "1.2.3"
|
||||
gmp_version = "5.0.1"
|
||||
mpc_version = "0.8.1"
|
||||
unifdef_version = "2.6"
|
||||
|
||||
binutils_source_uri = "http://ftp.gnu.org/gnu/binutils/binutils-%sa.tar.bz2" % \
|
||||
binutils_version
|
||||
glibc_source_uri = "http://ftp.gnu.org/gnu/glibc/glibc-%s.tar.bz2" % \
|
||||
glibc_version
|
||||
linux_source_uri = "http://www.kernel.org/pub/linux/kernel/v2.6/linux-%s.tar.bz2" % \
|
||||
linux_version
|
||||
tar_source_uri = "http://ftp.gnu.org/gnu/tar/tar-%s.tar.bz2" % \
|
||||
tar_version
|
||||
gawk_source_uri = "http://ftp.gnu.org/gnu/gawk/gawk-%s.tar.bz2" % \
|
||||
gawk_version
|
||||
make_source_uri = "http://ftp.gnu.org/gnu/make/make-%s.tar.bz2" % \
|
||||
make_version
|
||||
unifdef_source_uri = "http://dotat.at/prog/unifdef/unifdef-%s.tar.gz" % \
|
||||
unifdef_version
|
||||
gcc_source_uri = "http://ftp.gnu.org/gnu/gcc/gcc-%s/gcc-%s.tar.bz2" % \
|
||||
(gcc_version, gcc_version)
|
||||
mpfr_source_uri = "http://www.mpfr.org/mpfr-%s/mpfr-%s.tar.bz2" % \
|
||||
(mpfr_version, mpfr_version)
|
||||
zlib_source_uri = "http://iweb.dl.sourceforge.net/project/libpng/zlib/%s/zlib-%s.tar.bz2" % (zlib_version, zlib_version)
|
||||
gmp_source_uri = "http://ftp.gnu.org/gnu/gmp/gmp-%s.tar.bz2" % gmp_version
|
||||
mpc_source_uri = "http://www.multiprecision.org/mpc/download/mpc-%s.tar.gz" % \
|
||||
mpc_version
|
||||
|
||||
binutils_source_tar = download_uri(binutils_source_uri)
|
||||
glibc_source_tar = download_uri(glibc_source_uri)
|
||||
linux_source_tar = download_uri(linux_source_uri)
|
||||
tar_source_tar = download_uri(tar_source_uri)
|
||||
gawk_source_tar = download_uri(gawk_source_uri)
|
||||
make_source_tar = download_uri(make_source_uri)
|
||||
unifdef_source_tar = download_uri(unifdef_source_uri)
|
||||
mpc_source_tar = download_uri(mpc_source_uri)
|
||||
mpfr_source_tar = download_uri(mpfr_source_uri)
|
||||
zlib_source_tar = download_uri(zlib_source_uri)
|
||||
gmp_source_tar = download_uri(gmp_source_uri)
|
||||
gcc_source_tar = download_uri(gcc_source_uri)
|
||||
|
||||
binutils_source_dir = build_source_dir('binutils-', binutils_version)
|
||||
glibc_source_dir = build_source_dir('glibc-', glibc_version)
|
||||
linux_source_dir = build_source_dir('linux-', linux_version)
|
||||
tar_source_dir = build_source_dir('tar-', tar_version)
|
||||
gawk_source_dir = build_source_dir('gawk-', gawk_version)
|
||||
make_source_dir = build_source_dir('make-', make_version)
|
||||
unifdef_source_dir = build_source_dir('unifdef-', unifdef_version)
|
||||
mpc_source_dir = build_source_dir('mpc-', mpc_version)
|
||||
mpfr_source_dir = build_source_dir('mpfr-', mpfr_version)
|
||||
zlib_source_dir = build_source_dir('zlib-', zlib_version)
|
||||
gmp_source_dir = build_source_dir('gmp-', gmp_version)
|
||||
gcc_source_dir = build_source_dir('gcc-', gcc_version)
|
||||
|
||||
if not os.path.exists(source_dir):
|
||||
os.makedirs(source_dir)
|
||||
extract(binutils_source_tar, source_dir)
|
||||
patch('binutils-deterministic.patch', 1, binutils_source_dir)
|
||||
extract(glibc_source_tar, source_dir)
|
||||
extract(linux_source_tar, source_dir)
|
||||
patch('glibc-deterministic.patch', 1, glibc_source_dir)
|
||||
run_in(glibc_source_dir, ["autoconf"])
|
||||
extract(tar_source_tar, source_dir)
|
||||
extract(gawk_source_tar, source_dir)
|
||||
extract(make_source_tar, source_dir)
|
||||
extract(unifdef_source_tar, source_dir)
|
||||
extract(mpc_source_tar, source_dir)
|
||||
extract(mpfr_source_tar, source_dir)
|
||||
extract(zlib_source_tar, source_dir)
|
||||
extract(gmp_source_tar, source_dir)
|
||||
extract(gcc_source_tar, source_dir)
|
||||
patch('plugin_finish_decl.diff', 0, gcc_source_dir)
|
||||
patch('libtool-74c8993c178a1386ea5e2363a01d919738402f30.patch', 1, gcc_source_dir)
|
||||
patch('pr49911.diff', 1, gcc_source_dir)
|
||||
patch('r159628-r163231-r171807.patch', 1, gcc_source_dir)
|
||||
patch('gcc-fixinc.patch', 1, gcc_source_dir)
|
||||
patch('gcc-include.patch', 1, gcc_source_dir)
|
||||
|
||||
if os.path.exists(build_dir):
|
||||
shutil.rmtree(build_dir)
|
||||
os.makedirs(build_dir)
|
||||
|
||||
build_aux_tools(build_dir)
|
||||
|
||||
basic_path = aux_inst_dir + "/bin:/bin:/usr/bin"
|
||||
|
||||
stage1_dir = build_dir + '/stage1'
|
||||
build_one_stage({"PATH" : basic_path,
|
||||
"CC" : "gcc",
|
||||
"CXX" : "g++" },
|
||||
stage1_dir, True)
|
||||
|
||||
for stage_num in range(2, 4):
|
||||
prev_stage_dir = build_dir + '/stage' + str(stage_num - 1)
|
||||
prev_stage_inst_dir = prev_stage_dir + '/inst'
|
||||
cur_stage_dir = build_dir + '/stage' + str(stage_num)
|
||||
build_one_stage({"PATH" : prev_stage_inst_dir + "/bin:" + basic_path,
|
||||
"CC" : "gcc -fgnu89-inline",
|
||||
"CXX" : "g++",
|
||||
"RANLIB" : "true" },
|
||||
cur_stage_dir, False)
|
||||
|
||||
stage3_dir = build_dir + '/stage3'
|
||||
build_tar_package(aux_inst_dir + "/bin/tar",
|
||||
"toolchain.tar", stage3_dir, "inst")
|
|
@ -1,12 +0,0 @@
|
|||
diff -ru a/fixincludes/Makefile.in b/fixincludes/Makefile.in
|
||||
--- a/fixincludes/Makefile.in 2009-07-30 18:33:49.000000000 -0400
|
||||
+++ b/fixincludes/Makefile.in 2012-02-27 14:59:09.371875951 -0500
|
||||
@@ -126,7 +126,7 @@
|
||||
fixlib.o : fixlib.c
|
||||
|
||||
fixinc.sh : fixinc.in mkfixinc.sh Makefile
|
||||
- srcdir="$(srcdir)" $(SHELL) $(srcdir)/mkfixinc.sh $(target)
|
||||
+ echo "#!/bin/sh" > $@
|
||||
|
||||
$(srcdir)/fixincl.x: @MAINT@ fixincl.tpl inclhack.def
|
||||
cd $(srcdir) ; $(SHELL) ./genfixes
|
|
@ -1,24 +0,0 @@
|
|||
diff -ru a/configure b/configure
|
||||
--- a/configure 2010-10-06 06:29:55.000000000 -0400
|
||||
+++ b/configure 2012-02-27 20:46:26.303460301 -0500
|
||||
@@ -8047,7 +8047,7 @@
|
||||
# being built; programs in there won't even run.
|
||||
if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
|
||||
# Search for pre-installed headers if nothing else fits.
|
||||
- FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
|
||||
+ FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(exec_prefix)/bin/ -B$(exec_prefix)/lib/ -isystem $(exec_prefix)/include -isystem $(exec_prefix)/sys-include'
|
||||
fi
|
||||
|
||||
if test "x${use_gnu_ld}" = x &&
|
||||
diff -ru a/configure.ac b/configure.ac
|
||||
--- a/configure.ac 2010-10-06 06:29:55.000000000 -0400
|
||||
+++ b/configure.ac 2012-02-27 20:46:22.587442745 -0500
|
||||
@@ -3100,7 +3100,7 @@
|
||||
# being built; programs in there won't even run.
|
||||
if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
|
||||
# Search for pre-installed headers if nothing else fits.
|
||||
- FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
|
||||
+ FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(exec_prefix)/bin/ -B$(exec_prefix)/lib/ -isystem $(exec_prefix)/include -isystem $(exec_prefix)/sys-include'
|
||||
fi
|
||||
|
||||
if test "x${use_gnu_ld}" = x &&
|
|
@ -1,115 +0,0 @@
|
|||
diff -ru a/configure.in b/configure.in
|
||||
--- a/configure.in 2011-01-17 23:34:07.000000000 -0500
|
||||
+++ b/configure.in 2012-01-25 20:40:27.919485606 -0500
|
||||
@@ -841,14 +841,6 @@
|
||||
LIBC_PROG_BINUTILS
|
||||
AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
|
||||
|
||||
-# Accept binutils 2.13 or newer.
|
||||
-AC_CHECK_PROG_VER(AS, $AS, --version,
|
||||
- [GNU assembler.* \([0-9]*\.[0-9.]*\)],
|
||||
- [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
|
||||
-AC_CHECK_PROG_VER(LD, $LD, --version,
|
||||
- [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
|
||||
- [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
|
||||
-
|
||||
# We need the physical current working directory. We cannot use the
|
||||
# "pwd -P" shell builtin since that's not portable. Instead we try to
|
||||
# find a pwd binary. Note that assigning to the PWD environment
|
||||
@@ -2175,6 +2167,7 @@
|
||||
fi
|
||||
AC_SUBST(old_glibc_headers)
|
||||
|
||||
+libc_cv_slibdir=${prefix}/lib64
|
||||
AC_SUBST(libc_cv_slibdir)
|
||||
AC_SUBST(libc_cv_localedir)
|
||||
AC_SUBST(libc_cv_sysconfdir)
|
||||
diff -ru a/csu/Makefile b/csu/Makefile
|
||||
--- a/csu/Makefile 2011-01-17 23:34:07.000000000 -0500
|
||||
+++ b/csu/Makefile 2012-01-23 13:58:28.957792633 -0500
|
||||
@@ -223,8 +223,7 @@
|
||||
if [ -z "$$os" ]; then \
|
||||
os=Linux; \
|
||||
fi; \
|
||||
- printf '"Compiled on a %s %s system on %s.\\n"\n' \
|
||||
- "$$os" "$$version" "`date +%Y-%m-%d`";; \
|
||||
+ ;; \
|
||||
*) ;; \
|
||||
esac; \
|
||||
files="$(all-Banner-files)"; \
|
||||
diff -ru a/elf/Makefile b/elf/Makefile
|
||||
--- a/elf/Makefile 2008-10-31 16:35:11.000000000 -0400
|
||||
+++ b/elf/Makefile 2012-02-16 12:20:00.038593752 -0500
|
||||
@@ -295,18 +295,11 @@
|
||||
z-now-yes = -Wl,-z,now
|
||||
|
||||
$(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
|
||||
- @rm -f $@.lds
|
||||
- $(LINK.o) -nostdlib -nostartfiles -shared $(z-now-$(bind-now)) \
|
||||
- $(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 | \
|
||||
- LC_ALL=C \
|
||||
- sed -e '/^=========/,/^=========/!d;/^=========/d' \
|
||||
- -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
|
||||
- > $@.lds
|
||||
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
|
||||
$(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
|
||||
$(filter-out $(map-file),$^) $(load-map-file) \
|
||||
- -Wl,-soname=$(rtld-installed-name) -T $@.lds
|
||||
- rm -f $@.lds
|
||||
+ -Wl,-soname=$(rtld-installed-name) \
|
||||
+ -Wl,-defsym=_begin=0
|
||||
|
||||
# interp.c exists just to get this string into the libraries.
|
||||
CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
|
||||
diff -ru a/localedata/Makefile b/localedata/Makefile
|
||||
--- a/localedata/Makefile 2006-04-26 01:14:03.000000000 -0400
|
||||
+++ b/localedata/Makefile 2012-02-17 10:31:24.592345047 -0500
|
||||
@@ -113,7 +113,7 @@
|
||||
$(make-target-directory)
|
||||
rm -f $(@:.gz=) $@
|
||||
$(INSTALL_DATA) $< $(@:.gz=)
|
||||
- gzip -9 $(@:.gz=)
|
||||
+ gzip -9n $(@:.gz=)
|
||||
|
||||
# Install the locale source files in the appropriate directory.
|
||||
$(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
|
||||
diff -ru a/Makeconfig b/Makeconfig
|
||||
--- a/Makeconfig 2006-07-10 17:42:27.000000000 -0400
|
||||
+++ b/Makeconfig 2012-02-17 08:28:31.859584817 -0500
|
||||
@@ -674,7 +674,7 @@
|
||||
$(foreach lib,$(libof-$(basename $(@F))) \
|
||||
$(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
|
||||
$(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
|
||||
-override CFLAGS = -std=gnu99 \
|
||||
+override CFLAGS = -std=gnu99 -fgnu89-inline \
|
||||
$(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
|
||||
$(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
|
||||
$(CFLAGS-$(@F))
|
||||
diff -ru a/Makerules b/Makerules
|
||||
--- a/Makerules 2011-01-17 23:34:07.000000000 -0500
|
||||
+++ b/Makerules 2012-01-30 08:47:56.565068903 -0500
|
||||
@@ -977,9 +977,9 @@
|
||||
echo ' Use the shared library, but some functions are only in';\
|
||||
echo ' the static library, so try that secondarily. */';\
|
||||
cat $<; \
|
||||
- echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
|
||||
- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
|
||||
- ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \
|
||||
+ echo 'GROUP ( libc.so$(libc.so-version)' \
|
||||
+ '$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
|
||||
+ ' AS_NEEDED (' $(rtld-installed-name) ') )' \
|
||||
) > $@.new
|
||||
mv -f $@.new $@
|
||||
|
||||
diff -ru a/nscd/nscd_stat.c b/nscd/nscd_stat.c
|
||||
--- a/nscd/nscd_stat.c 2011-01-17 23:34:07.000000000 -0500
|
||||
+++ b/nscd/nscd_stat.c 2012-01-23 15:54:45.231607606 -0500
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
|
||||
/* We use this to make sure the receiver is the same. */
|
||||
-static const char compilation[21] = __DATE__ " " __TIME__;
|
||||
+static const char compilation[21] = "don't need this";
|
||||
|
||||
/* Statistic data for one database. */
|
||||
struct dbstat
|
|
@ -1,12 +0,0 @@
|
|||
diff -ruN a/ltmain.sh b/ltmain.sh
|
||||
--- a/ltmain.sh 2009-12-05 12:18:53.000000000 -0500
|
||||
+++ b/ltmain.sh 2012-05-07 16:19:31.871827967 -0400
|
||||
@@ -2932,7 +2932,7 @@
|
||||
func_extract_an_archive "$my_xdir" "$my_xabs"
|
||||
;;
|
||||
esac
|
||||
- my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
|
||||
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
|
||||
done
|
||||
|
||||
func_extract_archives_result="$my_oldobjs"
|
|
@ -1,179 +0,0 @@
|
|||
Index: gcc/doc/plugins.texi
|
||||
===================================================================
|
||||
--- gcc/doc/plugins.texi (revision 162126)
|
||||
+++ gcc/doc/plugins.texi (working copy)
|
||||
@@ -144,6 +144,7 @@
|
||||
@{
|
||||
PLUGIN_PASS_MANAGER_SETUP, /* To hook into pass manager. */
|
||||
PLUGIN_FINISH_TYPE, /* After finishing parsing a type. */
|
||||
+ PLUGIN_FINISH_DECL, /* After finishing parsing a declaration. */
|
||||
PLUGIN_FINISH_UNIT, /* Useful for summary processing. */
|
||||
PLUGIN_PRE_GENERICIZE, /* Allows to see low level AST in C and C++ frontends. */
|
||||
PLUGIN_FINISH, /* Called before GCC exits. */
|
||||
Index: gcc/plugin.def
|
||||
===================================================================
|
||||
--- gcc/plugin.def (revision 162126)
|
||||
+++ gcc/plugin.def (working copy)
|
||||
@@ -24,6 +24,9 @@
|
||||
/* After finishing parsing a type. */
|
||||
DEFEVENT (PLUGIN_FINISH_TYPE)
|
||||
|
||||
+/* After finishing parsing a declaration. */
|
||||
+DEFEVENT (PLUGIN_FINISH_DECL)
|
||||
+
|
||||
/* Useful for summary processing. */
|
||||
DEFEVENT (PLUGIN_FINISH_UNIT)
|
||||
|
||||
Index: gcc/testsuite/g++.dg/plugin/plugin.exp
|
||||
===================================================================
|
||||
--- gcc/testsuite/g++.dg/plugin/plugin.exp (revision 162126)
|
||||
+++ gcc/testsuite/g++.dg/plugin/plugin.exp (working copy)
|
||||
@@ -51,7 +51,8 @@
|
||||
{ pragma_plugin.c pragma_plugin-test-1.C } \
|
||||
{ selfassign.c self-assign-test-1.C self-assign-test-2.C self-assign-test-3.C } \
|
||||
{ dumb_plugin.c dumb-plugin-test-1.C } \
|
||||
- { header_plugin.c header-plugin-test.C } ]
|
||||
+ { header_plugin.c header-plugin-test.C } \
|
||||
+ { decl_plugin.c decl-plugin-test.C } ]
|
||||
|
||||
foreach plugin_test $plugin_test_list {
|
||||
# Replace each source file with its full-path name
|
||||
Index: gcc/testsuite/g++.dg/plugin/decl-plugin-test.C
|
||||
===================================================================
|
||||
--- gcc/testsuite/g++.dg/plugin/decl-plugin-test.C (revision 0)
|
||||
+++ gcc/testsuite/g++.dg/plugin/decl-plugin-test.C (revision 0)
|
||||
@@ -0,0 +1,32 @@
|
||||
+
|
||||
+
|
||||
+extern int global; // { dg-warning "Decl Global global" }
|
||||
+int global_array[] = { 1, 2, 3 }; // { dg-warning "Decl Global global_array" }
|
||||
+
|
||||
+int takes_args(int arg1, int arg2)
|
||||
+{
|
||||
+ int local = arg1 + arg2 + global; // { dg-warning "Decl Local local" }
|
||||
+ return local + 1;
|
||||
+}
|
||||
+
|
||||
+int global = 12; // { dg-warning "Decl Global global" }
|
||||
+
|
||||
+struct test_str {
|
||||
+ int field; // { dg-warning "Decl Field field" }
|
||||
+};
|
||||
+
|
||||
+class test_class {
|
||||
+ int class_field1; // { dg-warning "Decl Field class_field1" }
|
||||
+ int class_field2; // { dg-warning "Decl Field class_field2" }
|
||||
+
|
||||
+ test_class() // { dg-warning "Decl Function test_class" }
|
||||
+ : class_field1(0), class_field2(0)
|
||||
+ {}
|
||||
+
|
||||
+ void swap_fields(int bias) // { dg-warning "Decl Function swap_fields" }
|
||||
+ {
|
||||
+ int temp = class_field1 + bias; // { dg-warning "Decl Local temp" }
|
||||
+ class_field1 = class_field2 - bias;
|
||||
+ class_field2 = temp;
|
||||
+ }
|
||||
+};
|
||||
Index: gcc/testsuite/g++.dg/plugin/decl_plugin.c
|
||||
===================================================================
|
||||
--- gcc/testsuite/g++.dg/plugin/decl_plugin.c (revision 0)
|
||||
+++ gcc/testsuite/g++.dg/plugin/decl_plugin.c (revision 0)
|
||||
@@ -0,0 +1,51 @@
|
||||
+/* A plugin example that shows which declarations are caught by FINISH_DECL */
|
||||
+
|
||||
+#include "gcc-plugin.h"
|
||||
+#include <stdlib.h>
|
||||
+#include "config.h"
|
||||
+#include "system.h"
|
||||
+#include "coretypes.h"
|
||||
+#include "tree.h"
|
||||
+#include "tree-pass.h"
|
||||
+#include "intl.h"
|
||||
+
|
||||
+int plugin_is_GPL_compatible;
|
||||
+
|
||||
+/* Callback function to invoke after GCC finishes a declaration. */
|
||||
+
|
||||
+void plugin_finish_decl (void *event_data, void *data)
|
||||
+{
|
||||
+ tree decl = (tree) event_data;
|
||||
+
|
||||
+ const char *kind = NULL;
|
||||
+ switch (TREE_CODE(decl)) {
|
||||
+ case FUNCTION_DECL:
|
||||
+ kind = "Function"; break;
|
||||
+ case PARM_DECL:
|
||||
+ kind = "Parameter"; break;
|
||||
+ case VAR_DECL:
|
||||
+ if (DECL_CONTEXT(decl) != NULL)
|
||||
+ kind = "Local";
|
||||
+ else
|
||||
+ kind = "Global";
|
||||
+ break;
|
||||
+ case FIELD_DECL:
|
||||
+ kind = "Field"; break;
|
||||
+ default:
|
||||
+ kind = "Unknown";
|
||||
+ }
|
||||
+
|
||||
+ warning (0, G_("Decl %s %s"),
|
||||
+ kind, IDENTIFIER_POINTER (DECL_NAME (decl)));
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+plugin_init (struct plugin_name_args *plugin_info,
|
||||
+ struct plugin_gcc_version *version)
|
||||
+{
|
||||
+ const char *plugin_name = plugin_info->base_name;
|
||||
+
|
||||
+ register_callback (plugin_name, PLUGIN_FINISH_DECL,
|
||||
+ plugin_finish_decl, NULL);
|
||||
+ return 0;
|
||||
+}
|
||||
Index: gcc/cp/decl.c
|
||||
===================================================================
|
||||
--- gcc/cp/decl.c (revision 162126)
|
||||
+++ gcc/cp/decl.c (working copy)
|
||||
@@ -5967,6 +5967,8 @@
|
||||
/* If this was marked 'used', be sure it will be output. */
|
||||
if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
|
||||
mark_decl_referenced (decl);
|
||||
+
|
||||
+ invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl);
|
||||
}
|
||||
|
||||
/* Returns a declaration for a VAR_DECL as if:
|
||||
Index: gcc/c-decl.c
|
||||
===================================================================
|
||||
--- gcc/c-decl.c (revision 162126)
|
||||
+++ gcc/c-decl.c (working copy)
|
||||
@@ -4392,6 +4392,8 @@
|
||||
&& DECL_INITIAL (decl) == NULL_TREE)
|
||||
warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat,
|
||||
"uninitialized const %qD is invalid in C++", decl);
|
||||
+
|
||||
+ invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl);
|
||||
}
|
||||
|
||||
/* Given a parsed parameter declaration, decode it into a PARM_DECL. */
|
||||
Index: gcc/plugin.c
|
||||
===================================================================
|
||||
--- gcc/plugin.c (revision 162126)
|
||||
+++ gcc/plugin.c (working copy)
|
||||
@@ -400,6 +400,7 @@
|
||||
}
|
||||
/* Fall through. */
|
||||
case PLUGIN_FINISH_TYPE:
|
||||
+ case PLUGIN_FINISH_DECL:
|
||||
case PLUGIN_START_UNIT:
|
||||
case PLUGIN_FINISH_UNIT:
|
||||
case PLUGIN_PRE_GENERICIZE:
|
||||
@@ -481,6 +482,7 @@
|
||||
gcc_assert (event < event_last);
|
||||
/* Fall through. */
|
||||
case PLUGIN_FINISH_TYPE:
|
||||
+ case PLUGIN_FINISH_DECL:
|
||||
case PLUGIN_START_UNIT:
|
||||
case PLUGIN_FINISH_UNIT:
|
||||
case PLUGIN_PRE_GENERICIZE:
|
|
@ -1,274 +0,0 @@
|
|||
diff -ru gcc-4.5.2/gcc/double-int.c gcc-4.5.2-new/gcc/double-int.c
|
||||
--- gcc-4.5.2/gcc/double-int.c 2009-11-25 05:55:54.000000000 -0500
|
||||
+++ gcc-4.5.2-new/gcc/double-int.c 2011-11-29 10:20:27.625583810 -0500
|
||||
@@ -296,7 +296,12 @@
|
||||
tree
|
||||
double_int_to_tree (tree type, double_int cst)
|
||||
{
|
||||
- cst = double_int_ext (cst, TYPE_PRECISION (type), TYPE_UNSIGNED (type));
|
||||
+ /* Size types *are* sign extended. */
|
||||
+ bool sign_extended_type = (!TYPE_UNSIGNED (type)
|
||||
+ || (TREE_CODE (type) == INTEGER_TYPE
|
||||
+ && TYPE_IS_SIZETYPE (type)));
|
||||
+
|
||||
+ cst = double_int_ext (cst, TYPE_PRECISION (type), !sign_extended_type);
|
||||
|
||||
return build_int_cst_wide (type, cst.low, cst.high);
|
||||
}
|
||||
diff -ru gcc-4.5.2/gcc/tree.c gcc-4.5.2-new/gcc/tree.c
|
||||
--- gcc-4.5.2/gcc/tree.c 2010-07-07 11:24:27.000000000 -0400
|
||||
+++ gcc-4.5.2-new/gcc/tree.c 2011-11-29 10:20:27.626583813 -0500
|
||||
@@ -9750,7 +9750,7 @@
|
||||
tree
|
||||
upper_bound_in_type (tree outer, tree inner)
|
||||
{
|
||||
- unsigned HOST_WIDE_INT lo, hi;
|
||||
+ double_int high;
|
||||
unsigned int det = 0;
|
||||
unsigned oprec = TYPE_PRECISION (outer);
|
||||
unsigned iprec = TYPE_PRECISION (inner);
|
||||
@@ -9797,18 +9797,18 @@
|
||||
/* Compute 2^^prec - 1. */
|
||||
if (prec <= HOST_BITS_PER_WIDE_INT)
|
||||
{
|
||||
- hi = 0;
|
||||
- lo = ((~(unsigned HOST_WIDE_INT) 0)
|
||||
+ high.high = 0;
|
||||
+ high.low = ((~(unsigned HOST_WIDE_INT) 0)
|
||||
>> (HOST_BITS_PER_WIDE_INT - prec));
|
||||
}
|
||||
else
|
||||
{
|
||||
- hi = ((~(unsigned HOST_WIDE_INT) 0)
|
||||
+ high.high = ((~(unsigned HOST_WIDE_INT) 0)
|
||||
>> (2 * HOST_BITS_PER_WIDE_INT - prec));
|
||||
- lo = ~(unsigned HOST_WIDE_INT) 0;
|
||||
+ high.low = ~(unsigned HOST_WIDE_INT) 0;
|
||||
}
|
||||
|
||||
- return build_int_cst_wide (outer, lo, hi);
|
||||
+ return double_int_to_tree (outer, high);
|
||||
}
|
||||
|
||||
/* Returns the smallest value obtainable by casting something in INNER type to
|
||||
diff -ru gcc-4.5.2/gcc/tree-vrp.c gcc-4.5.2-new/gcc/tree-vrp.c
|
||||
--- gcc-4.5.2/gcc/tree-vrp.c 2010-06-14 11:23:31.000000000 -0400
|
||||
+++ gcc-4.5.2-new/gcc/tree-vrp.c 2011-11-29 10:20:27.628583820 -0500
|
||||
@@ -127,10 +127,10 @@
|
||||
static inline tree
|
||||
vrp_val_max (const_tree type)
|
||||
{
|
||||
- if (!INTEGRAL_TYPE_P (type))
|
||||
- return NULL_TREE;
|
||||
+ if (INTEGRAL_TYPE_P (type))
|
||||
+ return upper_bound_in_type (CONST_CAST_TREE (type), CONST_CAST_TREE (type));
|
||||
|
||||
- return TYPE_MAX_VALUE (type);
|
||||
+ return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Return the minimum value for TYPE. */
|
||||
@@ -138,10 +138,10 @@
|
||||
static inline tree
|
||||
vrp_val_min (const_tree type)
|
||||
{
|
||||
- if (!INTEGRAL_TYPE_P (type))
|
||||
- return NULL_TREE;
|
||||
+ if (INTEGRAL_TYPE_P (type))
|
||||
+ return lower_bound_in_type (CONST_CAST_TREE (type), CONST_CAST_TREE (type));
|
||||
|
||||
- return TYPE_MIN_VALUE (type);
|
||||
+ return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Return whether VAL is equal to the maximum value of its type. This
|
||||
@@ -539,7 +539,7 @@
|
||||
set_value_range (vr, VR_RANGE, zero,
|
||||
(overflow_infinity
|
||||
? positive_overflow_infinity (type)
|
||||
- : TYPE_MAX_VALUE (type)),
|
||||
+ : vrp_val_max (type)),
|
||||
vr->equiv);
|
||||
}
|
||||
|
||||
@@ -1595,7 +1595,7 @@
|
||||
}
|
||||
else if (cond_code == LE_EXPR || cond_code == LT_EXPR)
|
||||
{
|
||||
- min = TYPE_MIN_VALUE (type);
|
||||
+ min = vrp_val_min (type);
|
||||
|
||||
if (limit_vr == NULL || limit_vr->type == VR_ANTI_RANGE)
|
||||
max = limit;
|
||||
@@ -1630,7 +1630,7 @@
|
||||
}
|
||||
else if (cond_code == GE_EXPR || cond_code == GT_EXPR)
|
||||
{
|
||||
- max = TYPE_MAX_VALUE (type);
|
||||
+ max = vrp_val_max (type);
|
||||
|
||||
if (limit_vr == NULL || limit_vr->type == VR_ANTI_RANGE)
|
||||
min = limit;
|
||||
@@ -2047,11 +2047,11 @@
|
||||
|| code == ROUND_DIV_EXPR)
|
||||
return (needs_overflow_infinity (TREE_TYPE (res))
|
||||
? positive_overflow_infinity (TREE_TYPE (res))
|
||||
- : TYPE_MAX_VALUE (TREE_TYPE (res)));
|
||||
+ : vrp_val_max (TREE_TYPE (res)));
|
||||
else
|
||||
return (needs_overflow_infinity (TREE_TYPE (res))
|
||||
? negative_overflow_infinity (TREE_TYPE (res))
|
||||
- : TYPE_MIN_VALUE (TREE_TYPE (res)));
|
||||
+ : vrp_val_min (TREE_TYPE (res)));
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -2750,8 +2750,8 @@
|
||||
&& TYPE_PRECISION (inner_type) < TYPE_PRECISION (outer_type))
|
||||
{
|
||||
vr0.type = VR_RANGE;
|
||||
- vr0.min = TYPE_MIN_VALUE (inner_type);
|
||||
- vr0.max = TYPE_MAX_VALUE (inner_type);
|
||||
+ vr0.min = vrp_val_min (inner_type);
|
||||
+ vr0.max = vrp_val_max (inner_type);
|
||||
}
|
||||
|
||||
/* If VR0 is a constant range or anti-range and the conversion is
|
||||
@@ -2836,7 +2836,7 @@
|
||||
}
|
||||
}
|
||||
else
|
||||
- min = TYPE_MIN_VALUE (type);
|
||||
+ min = vrp_val_min (type);
|
||||
|
||||
if (is_positive_overflow_infinity (vr0.min))
|
||||
max = negative_overflow_infinity (type);
|
||||
@@ -2855,7 +2855,7 @@
|
||||
}
|
||||
}
|
||||
else
|
||||
- max = TYPE_MIN_VALUE (type);
|
||||
+ max = vrp_val_min (type);
|
||||
}
|
||||
else if (code == NEGATE_EXPR
|
||||
&& TYPE_UNSIGNED (type))
|
||||
@@ -2897,7 +2897,7 @@
|
||||
else if (!vrp_val_is_min (vr0.min))
|
||||
min = fold_unary_to_constant (code, type, vr0.min);
|
||||
else if (!needs_overflow_infinity (type))
|
||||
- min = TYPE_MAX_VALUE (type);
|
||||
+ min = vrp_val_max (type);
|
||||
else if (supports_overflow_infinity (type))
|
||||
min = positive_overflow_infinity (type);
|
||||
else
|
||||
@@ -2911,7 +2911,7 @@
|
||||
else if (!vrp_val_is_min (vr0.max))
|
||||
max = fold_unary_to_constant (code, type, vr0.max);
|
||||
else if (!needs_overflow_infinity (type))
|
||||
- max = TYPE_MAX_VALUE (type);
|
||||
+ max = vrp_val_max (type);
|
||||
else if (supports_overflow_infinity (type)
|
||||
/* We shouldn't generate [+INF, +INF] as set_value_range
|
||||
doesn't like this and ICEs. */
|
||||
@@ -2941,7 +2941,7 @@
|
||||
TYPE_MIN_VALUE, remember -TYPE_MIN_VALUE = TYPE_MIN_VALUE. */
|
||||
if (TYPE_OVERFLOW_WRAPS (type))
|
||||
{
|
||||
- tree type_min_value = TYPE_MIN_VALUE (type);
|
||||
+ tree type_min_value = vrp_val_min (type);
|
||||
|
||||
min = (vr0.min != type_min_value
|
||||
? int_const_binop (PLUS_EXPR, type_min_value,
|
||||
@@ -2953,7 +2953,7 @@
|
||||
if (overflow_infinity_range_p (&vr0))
|
||||
min = negative_overflow_infinity (type);
|
||||
else
|
||||
- min = TYPE_MIN_VALUE (type);
|
||||
+ min = vrp_val_min (type);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2974,7 +2974,7 @@
|
||||
}
|
||||
}
|
||||
else
|
||||
- max = TYPE_MAX_VALUE (type);
|
||||
+ max = vrp_val_max (type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3258,11 +3258,11 @@
|
||||
if (POINTER_TYPE_P (type) || !TYPE_MIN_VALUE (type))
|
||||
tmin = lower_bound_in_type (type, type);
|
||||
else
|
||||
- tmin = TYPE_MIN_VALUE (type);
|
||||
+ tmin = vrp_val_min (type);
|
||||
if (POINTER_TYPE_P (type) || !TYPE_MAX_VALUE (type))
|
||||
tmax = upper_bound_in_type (type, type);
|
||||
else
|
||||
- tmax = TYPE_MAX_VALUE (type);
|
||||
+ tmax = vrp_val_max (type);
|
||||
|
||||
if (vr->type == VR_VARYING || vr->type == VR_UNDEFINED)
|
||||
{
|
||||
@@ -4146,8 +4146,8 @@
|
||||
if ((comp_code == GT_EXPR || comp_code == LT_EXPR)
|
||||
&& INTEGRAL_TYPE_P (TREE_TYPE (val)))
|
||||
{
|
||||
- tree min = TYPE_MIN_VALUE (TREE_TYPE (val));
|
||||
- tree max = TYPE_MAX_VALUE (TREE_TYPE (val));
|
||||
+ tree min = vrp_val_min (TREE_TYPE (val));
|
||||
+ tree max = vrp_val_max (TREE_TYPE (val));
|
||||
|
||||
if (comp_code == GT_EXPR
|
||||
&& (!max
|
||||
@@ -6426,13 +6426,13 @@
|
||||
VARYING. Same if the previous max value was invalid for
|
||||
the type and we'd end up with vr_result.min > vr_result.max. */
|
||||
if (vrp_val_is_max (vr_result.max)
|
||||
- || compare_values (TYPE_MIN_VALUE (TREE_TYPE (vr_result.min)),
|
||||
+ || compare_values (vrp_val_min (TREE_TYPE (vr_result.min)),
|
||||
vr_result.max) > 0)
|
||||
goto varying;
|
||||
|
||||
if (!needs_overflow_infinity (TREE_TYPE (vr_result.min))
|
||||
|| !vrp_var_may_overflow (lhs, phi))
|
||||
- vr_result.min = TYPE_MIN_VALUE (TREE_TYPE (vr_result.min));
|
||||
+ vr_result.min = vrp_val_min (TREE_TYPE (vr_result.min));
|
||||
else if (supports_overflow_infinity (TREE_TYPE (vr_result.min)))
|
||||
vr_result.min =
|
||||
negative_overflow_infinity (TREE_TYPE (vr_result.min));
|
||||
@@ -6448,13 +6448,13 @@
|
||||
VARYING. Same if the previous min value was invalid for
|
||||
the type and we'd end up with vr_result.max < vr_result.min. */
|
||||
if (vrp_val_is_min (vr_result.min)
|
||||
- || compare_values (TYPE_MAX_VALUE (TREE_TYPE (vr_result.max)),
|
||||
+ || compare_values (vrp_val_max (TREE_TYPE (vr_result.max)),
|
||||
vr_result.min) < 0)
|
||||
goto varying;
|
||||
|
||||
if (!needs_overflow_infinity (TREE_TYPE (vr_result.max))
|
||||
|| !vrp_var_may_overflow (lhs, phi))
|
||||
- vr_result.max = TYPE_MAX_VALUE (TREE_TYPE (vr_result.max));
|
||||
+ vr_result.max = vrp_val_max (TREE_TYPE (vr_result.max));
|
||||
else if (supports_overflow_infinity (TREE_TYPE (vr_result.max)))
|
||||
vr_result.max =
|
||||
positive_overflow_infinity (TREE_TYPE (vr_result.max));
|
||||
@@ -6782,7 +6782,7 @@
|
||||
{
|
||||
/* This should not be negative infinity; there is no overflow
|
||||
here. */
|
||||
- min = TYPE_MIN_VALUE (TREE_TYPE (op0));
|
||||
+ min = vrp_val_min (TREE_TYPE (op0));
|
||||
|
||||
max = op1;
|
||||
if (cond_code == LT_EXPR && !is_overflow_infinity (max))
|
||||
@@ -6797,7 +6797,7 @@
|
||||
{
|
||||
/* This should not be positive infinity; there is no overflow
|
||||
here. */
|
||||
- max = TYPE_MAX_VALUE (TREE_TYPE (op0));
|
||||
+ max = vrp_val_max (TREE_TYPE (op0));
|
||||
|
||||
min = op1;
|
||||
if (cond_code == GT_EXPR && !is_overflow_infinity (min))
|
|
@ -1,98 +0,0 @@
|
|||
diff -ru gcc-4.5.2/libstdc++-v3/include/bits/stl_pair.h gcc-4.5.2-new/libstdc++-v3/include/bits/stl_pair.h
|
||||
--- gcc-4.5.2/libstdc++-v3/include/bits/stl_pair.h 2010-06-10 06:26:14.000000000 -0400
|
||||
+++ gcc-4.5.2-new/libstdc++-v3/include/bits/stl_pair.h 2011-11-29 10:25:51.203597393 -0500
|
||||
@@ -88,6 +88,8 @@
|
||||
: first(__a), second(__b) { }
|
||||
|
||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
+ pair(const pair&) = default;
|
||||
+
|
||||
// DR 811.
|
||||
template<class _U1, class = typename
|
||||
std::enable_if<std::is_convertible<_U1, _T1>::value>::type>
|
||||
@@ -131,6 +133,15 @@
|
||||
|
||||
template<class _U1, class _U2>
|
||||
pair&
|
||||
+ operator=(const pair<_U1, _U2>& __p)
|
||||
+ {
|
||||
+ first = __p.first;
|
||||
+ second = __p.second;
|
||||
+ return *this;
|
||||
+ }
|
||||
+
|
||||
+ template<class _U1, class _U2>
|
||||
+ pair&
|
||||
operator=(pair<_U1, _U2>&& __p)
|
||||
{
|
||||
first = std::move(__p.first);
|
||||
diff -ru gcc-4.5.2/libstdc++-v3/include/bits/stl_queue.h gcc-4.5.2-new/libstdc++-v3/include/bits/stl_queue.h
|
||||
--- gcc-4.5.2/libstdc++-v3/include/bits/stl_queue.h 2010-02-04 13:20:34.000000000 -0500
|
||||
+++ gcc-4.5.2-new/libstdc++-v3/include/bits/stl_queue.h 2011-11-29 10:26:22.511695475 -0500
|
||||
@@ -1,6 +1,6 @@
|
||||
// Queue implementation -*- C++ -*-
|
||||
|
||||
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
// Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
@@ -137,16 +137,6 @@
|
||||
explicit
|
||||
queue(_Sequence&& __c = _Sequence())
|
||||
: c(std::move(__c)) { }
|
||||
-
|
||||
- queue(queue&& __q)
|
||||
- : c(std::move(__q.c)) { }
|
||||
-
|
||||
- queue&
|
||||
- operator=(queue&& __q)
|
||||
- {
|
||||
- c = std::move(__q.c);
|
||||
- return *this;
|
||||
- }
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -451,17 +441,6 @@
|
||||
c.insert(c.end(), __first, __last);
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
-
|
||||
- priority_queue(priority_queue&& __pq)
|
||||
- : c(std::move(__pq.c)), comp(std::move(__pq.comp)) { }
|
||||
-
|
||||
- priority_queue&
|
||||
- operator=(priority_queue&& __pq)
|
||||
- {
|
||||
- c = std::move(__pq.c);
|
||||
- comp = std::move(__pq.comp);
|
||||
- return *this;
|
||||
- }
|
||||
#endif
|
||||
|
||||
/**
|
||||
diff -ru gcc-4.5.2/libstdc++-v3/libsupc++/exception_ptr.h gcc-4.5.2-new/libstdc++-v3/libsupc++/exception_ptr.h
|
||||
--- gcc-4.5.2/libstdc++-v3/libsupc++/exception_ptr.h 2009-11-09 17:09:30.000000000 -0500
|
||||
+++ gcc-4.5.2-new/libstdc++-v3/libsupc++/exception_ptr.h 2011-11-29 10:26:10.878659023 -0500
|
||||
@@ -129,7 +129,7 @@
|
||||
operator==(const exception_ptr&, const exception_ptr&) throw()
|
||||
__attribute__ ((__pure__));
|
||||
|
||||
- const type_info*
|
||||
+ const class type_info*
|
||||
__cxa_exception_type() const throw() __attribute__ ((__pure__));
|
||||
};
|
||||
|
||||
diff -ru gcc-4.5.2/libstdc++-v3/libsupc++/nested_exception.h gcc-4.5.2-new/libstdc++-v3/libsupc++/nested_exception.h
|
||||
--- gcc-4.5.2/libstdc++-v3/libsupc++/nested_exception.h 2010-02-18 12:20:16.000000000 -0500
|
||||
+++ gcc-4.5.2-new/libstdc++-v3/libsupc++/nested_exception.h 2011-11-29 10:26:10.879659026 -0500
|
||||
@@ -119,7 +119,7 @@
|
||||
// with a type that has an accessible nested_exception base.
|
||||
template<typename _Ex>
|
||||
inline void
|
||||
- __throw_with_nested(_Ex&& __ex, const nested_exception* = 0)
|
||||
+ __throw_with_nested(_Ex&& __ex, const nested_exception*)
|
||||
{ throw __ex; }
|
||||
|
||||
template<typename _Ex>
|
|
@ -18,7 +18,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
DEFINES += -DELFHACK_BUILD
|
||||
|
||||
test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX) elfhack $(filter inject/%,$(CSRCS:.c=.$(OBJ_SUFFIX)))
|
||||
test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX) elfhack
|
||||
$(MKSHLIB) $(LDFLAGS) $< -nostartfiles
|
||||
@echo ===
|
||||
@echo === If you get failures below, please file a bug describing the error
|
||||
|
|
|
@ -6,21 +6,6 @@
|
|||
INTERNAL_TOOLS = 1
|
||||
NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
|
||||
ifneq (,$(filter %86,$(TARGET_CPU)))
|
||||
CPU := x86
|
||||
else
|
||||
ifneq (,$(filter arm%,$(TARGET_CPU)))
|
||||
CPU := arm
|
||||
else
|
||||
CPU := $(TARGET_CPU)
|
||||
endif
|
||||
endif
|
||||
|
||||
CSRCS := \
|
||||
$(CPU).c \
|
||||
$(CPU)-noinit.c \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
export:: $(CSRCS:.c=.$(OBJ_SUFFIX))
|
||||
|
@ -33,4 +18,4 @@ GARBAGE += $(CSRCS)
|
|||
DEFINES += -DELFHACK_BUILD
|
||||
|
||||
CFLAGS := -O2 -fno-stack-protector $(filter -m% -I%,$(CFLAGS))
|
||||
$(CPU)-noinit.$(OBJ_SUFFIX): DEFINES += -DNOINIT
|
||||
%-noinit.$(OBJ_SUFFIX): DEFINES += -DNOINIT
|
||||
|
|
|
@ -5,3 +5,15 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
NO_DIST_INSTALL = True
|
||||
|
||||
if CONFIG['TARGET_CPU'].endswith('86'):
|
||||
cpu = 'x86'
|
||||
elif CONFIG['TARGET_CPU'].startswith('arm'):
|
||||
cpu = 'arm'
|
||||
else:
|
||||
cpu = CONFIG['TARGET_CPU']
|
||||
|
||||
GENERATED_SOURCES += [ s % cpu for s in [
|
||||
"%s-noinit.c",
|
||||
"%s.c",
|
||||
]]
|
||||
|
|
|
@ -69,6 +69,8 @@ namespace std __attribute__((visibility("default"))) {
|
|||
/* Hack to avoid GLIBCXX_3.4.15 symbol versions */
|
||||
#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
|
||||
static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
|
||||
|
||||
void reverse() throw();
|
||||
};
|
||||
|
||||
namespace __detail {
|
||||
|
@ -85,6 +87,8 @@ namespace std __attribute__((visibility("default"))) {
|
|||
|
||||
#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
|
||||
static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
|
||||
|
||||
void _M_reverse() throw();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -116,6 +120,12 @@ namespace std __attribute__((visibility("default"))) {
|
|||
std::_List_node_base::swap(*((std::_List_node_base *) &__x),
|
||||
*((std::_List_node_base *) &__y));
|
||||
}
|
||||
|
||||
void
|
||||
_List_node_base::_M_reverse() throw ()
|
||||
{
|
||||
((std::_List_node_base *)this)->reverse();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ endif
|
|||
_MOZBUILD_EXTERNAL_VARIABLES := \
|
||||
ANDROID_GENERATED_RESFILES \
|
||||
ANDROID_RESFILES \
|
||||
CMSRCS \
|
||||
CMMSRCS \
|
||||
CPP_UNIT_TESTS \
|
||||
DIRS \
|
||||
|
@ -46,6 +47,7 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
|
|||
GTEST_CPPSRCS \
|
||||
GTEST_CSRCS \
|
||||
HOST_CSRCS \
|
||||
HOST_CMMSRCS \
|
||||
HOST_LIBRARY_NAME \
|
||||
IS_COMPONENT \
|
||||
JAVA_JAR_TARGETS \
|
||||
|
|
|
@ -568,8 +568,10 @@ endif
|
|||
|
||||
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
|
||||
OUTOPTION = -Fo# eol
|
||||
PREPROCESS_OPTION = -P -Fi# eol
|
||||
else
|
||||
OUTOPTION = -o # eol
|
||||
PREPROCESS_OPTION = -E -o #eol
|
||||
endif # WINNT && !GNU_CC
|
||||
|
||||
ifneq (,$(filter ml%,$(AS)))
|
||||
|
@ -1069,19 +1071,19 @@ $(filter %.s,$(CSRCS:%.c=%.s)): %.s: %.c $(call mkdir_deps,$(MDDEPDIR))
|
|||
|
||||
$(filter %.i,$(CPPSRCS:%.cpp=%.i)): %.i: %.cpp $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CCC) -C -E $(COMPILE_CXXFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) > $*.i
|
||||
$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(filter %.i,$(CPPSRCS:%.cc=%.i)): %.i: %.cc $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CCC) -C -E $(COMPILE_CXXFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) > $*.i
|
||||
$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(filter %.i,$(CSRCS:%.c=%.i)): %.i: %.c $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CC) -C -E $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) > $*.i
|
||||
$(CC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(filter %.i,$(CMMSRCS:%.mm=%.i)): %.i: %.mm $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CCC) -C -E $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) > $*.i
|
||||
$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(RESFILE): %.res: %.rc
|
||||
$(REPORT_BUILD)
|
||||
|
|
|
@ -646,6 +646,10 @@ public:
|
|||
|
||||
already_AddRefed<DOMRectList> GetClientRects();
|
||||
already_AddRefed<DOMRect> GetBoundingClientRect();
|
||||
void ScrollIntoView()
|
||||
{
|
||||
ScrollIntoView(true);
|
||||
}
|
||||
void ScrollIntoView(bool aTop);
|
||||
int32_t ScrollTop()
|
||||
{
|
||||
|
|
|
@ -696,10 +696,12 @@ public:
|
|||
|
||||
// We do not call MarkUsed because it would just slow down lookups and
|
||||
// because we're OK expiring things after a few seconds even if they're
|
||||
// being used.
|
||||
nsCSSSelectorList* GetList(const nsAString& aSelector)
|
||||
// being used. Returns whether we actually had an entry for aSelector.
|
||||
// If we have an entry and *aList is null, that indicates that aSelector
|
||||
// has already been parsed and is not a syntactically valid selector.
|
||||
bool GetList(const nsAString& aSelector, nsCSSSelectorList** aList)
|
||||
{
|
||||
return mTable.Get(aSelector);
|
||||
return mTable.Get(aSelector, aList);
|
||||
}
|
||||
|
||||
~SelectorCache()
|
||||
|
@ -2001,6 +2003,11 @@ public:
|
|||
mozilla::ErrorResult& rv) const;
|
||||
already_AddRefed<nsINode>
|
||||
ImportNode(nsINode& aNode, bool aDeep, mozilla::ErrorResult& rv) const;
|
||||
already_AddRefed<nsINode>
|
||||
ImportNode(nsINode& aNode, mozilla::ErrorResult& rv) const
|
||||
{
|
||||
return ImportNode(aNode, true, rv);
|
||||
}
|
||||
nsINode* AdoptNode(nsINode& aNode, mozilla::ErrorResult& rv);
|
||||
already_AddRefed<nsDOMEvent> CreateEvent(const nsAString& aEventType,
|
||||
mozilla::ErrorResult& rv) const;
|
||||
|
|
|
@ -1533,6 +1533,10 @@ public:
|
|||
return ReplaceOrInsertBefore(true, &aNode, &aChild, aError);
|
||||
}
|
||||
nsINode* RemoveChild(nsINode& aChild, mozilla::ErrorResult& aError);
|
||||
already_AddRefed<nsINode> CloneNode(mozilla::ErrorResult& aError)
|
||||
{
|
||||
return CloneNode(true, aError);
|
||||
}
|
||||
already_AddRefed<nsINode> CloneNode(bool aDeep, mozilla::ErrorResult& aError);
|
||||
bool IsEqualNode(nsINode* aNode);
|
||||
void GetNamespaceURI(nsAString& aNamespaceURI) const
|
||||
|
|
|
@ -242,23 +242,23 @@ CSPRep.ALLOW_DIRECTIVE = "allow";
|
|||
* string rep of a CSP
|
||||
* @param self (optional)
|
||||
* URI representing the "self" source
|
||||
* @param reportOnly (optional)
|
||||
* whether or not this CSP is report-only (defaults to false)
|
||||
* @param docRequest (optional)
|
||||
* request for the parent document which may need to be suspended
|
||||
* while the policy-uri is asynchronously fetched
|
||||
* @param csp (optional)
|
||||
* the CSP object to update once the policy has been fetched
|
||||
* @param reportOnly (optional)
|
||||
* whether or not this CSP is report-only (defaults to false)
|
||||
* @returns
|
||||
* an instance of CSPRep
|
||||
*/
|
||||
CSPRep.fromString = function(aStr, self, docRequest, csp, reportOnly) {
|
||||
if (typeof reportOnly === 'undefined') reportOnly = false;
|
||||
CSPRep.fromString = function(aStr, self, reportOnly, docRequest, csp) {
|
||||
var SD = CSPRep.SRC_DIRECTIVES_OLD;
|
||||
var UD = CSPRep.URI_DIRECTIVES;
|
||||
var aCSPR = new CSPRep();
|
||||
aCSPR._originalText = aStr;
|
||||
aCSPR._innerWindowID = innerWindowFromRequest(docRequest);
|
||||
if (typeof reportOnly === 'undefined') reportOnly = false;
|
||||
aCSPR._reportOnlyMode = reportOnly;
|
||||
|
||||
var selfUri = null;
|
||||
|
@ -416,13 +416,13 @@ CSPRep.fromString = function(aStr, self, docRequest, csp, reportOnly) {
|
|||
// POLICY_URI can only be alone
|
||||
if (aCSPR._directives.length > 0 || dirs.length > 1) {
|
||||
cspError(aCSPR, CSPLocalizer.getStr("policyURINotAlone"));
|
||||
return CSPRep.fromString("default-src 'none'");
|
||||
return CSPRep.fromString("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
// if we were called without a reference to the parent document request
|
||||
// we won't be able to suspend it while we fetch the policy -> fail closed
|
||||
if (!docRequest || !csp) {
|
||||
cspError(aCSPR, CSPLocalizer.getStr("noParentRequest"));
|
||||
return CSPRep.fromString("default-src 'none'");
|
||||
return CSPRep.fromString("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
|
||||
var uri = '';
|
||||
|
@ -431,7 +431,7 @@ CSPRep.fromString = function(aStr, self, docRequest, csp, reportOnly) {
|
|||
} catch(e) {
|
||||
cspError(aCSPR, CSPLocalizer.getFormatStr("policyURIParseError",
|
||||
[dirvalue]));
|
||||
return CSPRep.fromString("default-src 'none'");
|
||||
return CSPRep.fromString("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
|
||||
// Verify that policy URI comes from the same origin
|
||||
|
@ -439,17 +439,17 @@ CSPRep.fromString = function(aStr, self, docRequest, csp, reportOnly) {
|
|||
if (selfUri.host !== uri.host) {
|
||||
cspError(aCSPR, CSPLocalizer.getFormatStr("nonMatchingHost",
|
||||
[uri.host]));
|
||||
return CSPRep.fromString("default-src 'none'");
|
||||
return CSPRep.fromString("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
if (selfUri.port !== uri.port) {
|
||||
cspError(aCSPR, CSPLocalizer.getFormatStr("nonMatchingPort",
|
||||
[uri.port.toString()]));
|
||||
return CSPRep.fromString("default-src 'none'");
|
||||
return CSPRep.fromString("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
if (selfUri.scheme !== uri.scheme) {
|
||||
cspError(aCSPR, CSPLocalizer.getFormatStr("nonMatchingScheme",
|
||||
[uri.scheme]));
|
||||
return CSPRep.fromString("default-src 'none'");
|
||||
return CSPRep.fromString("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -468,12 +468,12 @@ CSPRep.fromString = function(aStr, self, docRequest, csp, reportOnly) {
|
|||
docRequest.resume();
|
||||
cspError(aCSPR, CSPLocalizer.getFormatStr("errorFetchingPolicy",
|
||||
[e.toString()]));
|
||||
return CSPRep.fromString("default-src 'none'");
|
||||
return CSPRep.fromString("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
|
||||
// return a fully-open policy to be used until the contents of the
|
||||
// policy-uri come back.
|
||||
return CSPRep.fromString("default-src *");
|
||||
return CSPRep.fromString("default-src *", null, reportOnly);
|
||||
}
|
||||
|
||||
// UNIDENTIFIED DIRECTIVE /////////////////////////////////////////////
|
||||
|
@ -486,8 +486,7 @@ CSPRep.fromString = function(aStr, self, docRequest, csp, reportOnly) {
|
|||
// directive to be present.
|
||||
if (!aCSPR._directives[SD.DEFAULT_SRC]) {
|
||||
cspWarn(aCSPR, CSPLocalizer.getStr("allowOrDefaultSrcRequired"));
|
||||
return CSPRep.fromString("default-src 'none'", selfUri, docRequest, csp,
|
||||
reportOnly);
|
||||
return CSPRep.fromString("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
return aCSPR;
|
||||
};
|
||||
|
@ -500,26 +499,25 @@ CSPRep.fromString = function(aStr, self, docRequest, csp, reportOnly) {
|
|||
* string rep of a CSP
|
||||
* @param self (optional)
|
||||
* URI representing the "self" source
|
||||
* @param reportOnly (optional)
|
||||
* whether or not this CSP is report-only (defaults to false)
|
||||
* @param docRequest (optional)
|
||||
* request for the parent document which may need to be suspended
|
||||
* while the policy-uri is asynchronously fetched
|
||||
* @param csp (optional)
|
||||
* the CSP object to update once the policy has been fetched
|
||||
* @param reportOnly (optional)
|
||||
* whether or not this CSP is report-only (defaults to false)
|
||||
* @returns
|
||||
* an instance of CSPRep
|
||||
*/
|
||||
// When we deprecate our original CSP implementation, we rename this to
|
||||
// CSPRep.fromString and remove the existing CSPRep.fromString above.
|
||||
CSPRep.fromStringSpecCompliant = function(aStr, self, docRequest, csp, reportOnly) {
|
||||
if (typeof reportOnly === 'undefined') reportOnly = false;
|
||||
|
||||
CSPRep.fromStringSpecCompliant = function(aStr, self, reportOnly, docRequest, csp) {
|
||||
var SD = CSPRep.SRC_DIRECTIVES_NEW;
|
||||
var UD = CSPRep.URI_DIRECTIVES;
|
||||
var aCSPR = new CSPRep(true);
|
||||
aCSPR._originalText = aStr;
|
||||
aCSPR._innerWindowID = innerWindowFromRequest(docRequest);
|
||||
if (typeof reportOnly === 'undefined') reportOnly = false;
|
||||
aCSPR._reportOnlyMode = reportOnly;
|
||||
|
||||
var selfUri = null;
|
||||
|
@ -682,13 +680,13 @@ CSPRep.fromStringSpecCompliant = function(aStr, self, docRequest, csp, reportOnl
|
|||
// POLICY_URI can only be alone
|
||||
if (aCSPR._directives.length > 0 || dirs.length > 1) {
|
||||
cspError(aCSPR, CSPLocalizer.getStr("policyURINotAlone"));
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'");
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
// if we were called without a reference to the parent document request
|
||||
// we won't be able to suspend it while we fetch the policy -> fail closed
|
||||
if (!docRequest || !csp) {
|
||||
cspError(aCSPR, CSPLocalizer.getStr("noParentRequest"));
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'");
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
|
||||
var uri = '';
|
||||
|
@ -696,22 +694,22 @@ CSPRep.fromStringSpecCompliant = function(aStr, self, docRequest, csp, reportOnl
|
|||
uri = gIoService.newURI(dirvalue, null, selfUri);
|
||||
} catch(e) {
|
||||
cspError(aCSPR, CSPLocalizer.getFormatStr("policyURIParseError", [dirvalue]));
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'");
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
|
||||
// Verify that policy URI comes from the same origin
|
||||
if (selfUri) {
|
||||
if (selfUri.host !== uri.host){
|
||||
cspError(aCSPR, CSPLocalizer.getFormatStr("nonMatchingHost", [uri.host]));
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'");
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
if (selfUri.port !== uri.port){
|
||||
cspError(aCSPR, CSPLocalizer.getFormatStr("nonMatchingPort", [uri.port.toString()]));
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'");
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
if (selfUri.scheme !== uri.scheme){
|
||||
cspError(aCSPR, CSPLocalizer.getFormatStr("nonMatchingScheme", [uri.scheme]));
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'");
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -723,18 +721,18 @@ CSPRep.fromStringSpecCompliant = function(aStr, self, docRequest, csp, reportOnl
|
|||
// policy-uri can't be abused for CSRF
|
||||
chan.loadFlags |= Components.interfaces.nsIChannel.LOAD_ANONYMOUS;
|
||||
chan.loadGroup = docRequest.loadGroup;
|
||||
chan.asyncOpen(new CSPPolicyURIListener(uri, docRequest, csp), null);
|
||||
chan.asyncOpen(new CSPPolicyURIListener(uri, docRequest, csp, reportOnly), null);
|
||||
}
|
||||
catch (e) {
|
||||
// resume the document request and apply most restrictive policy
|
||||
docRequest.resume();
|
||||
cspError(aCSPR, CSPLocalizer.getFormatStr("errorFetchingPolicy", [e.toString()]));
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'");
|
||||
return CSPRep.fromStringSpecCompliant("default-src 'none'", null, reportOnly);
|
||||
}
|
||||
|
||||
// return a fully-open policy to be used until the contents of the
|
||||
// policy-uri come back
|
||||
return CSPRep.fromStringSpecCompliant("default-src *");
|
||||
return CSPRep.fromStringSpecCompliant("default-src *", null, reportOnly);
|
||||
}
|
||||
|
||||
// UNIDENTIFIED DIRECTIVE /////////////////////////////////////////////
|
||||
|
|
|
@ -311,15 +311,15 @@ ContentSecurityPolicy.prototype = {
|
|||
if (aSpecCompliant) {
|
||||
newpolicy = CSPRep.fromStringSpecCompliant(aPolicy,
|
||||
selfURI,
|
||||
aReportOnly,
|
||||
this._docRequest,
|
||||
this,
|
||||
aReportOnly);
|
||||
this);
|
||||
} else {
|
||||
newpolicy = CSPRep.fromString(aPolicy,
|
||||
selfURI,
|
||||
aReportOnly,
|
||||
this._docRequest,
|
||||
this,
|
||||
aReportOnly);
|
||||
this);
|
||||
}
|
||||
|
||||
newpolicy._specCompliant = !!aSpecCompliant;
|
||||
|
|
|
@ -215,8 +215,6 @@
|
|||
#include "mozilla/dom/XPathEvaluator.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIStructuredCloneContainer.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -10649,11 +10647,17 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsPointerLockPermissionRequest,
|
|||
nsIContentPermissionRequest)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPointerLockPermissionRequest::GetTypes(nsIArray** aTypes)
|
||||
nsPointerLockPermissionRequest::GetType(nsACString& aType)
|
||||
{
|
||||
return CreatePermissionArray(NS_LITERAL_CSTRING("pointerLock"),
|
||||
NS_LITERAL_CSTRING("unused"),
|
||||
aTypes);
|
||||
aType = "pointerLock";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPointerLockPermissionRequest::GetAccess(nsACString& aAccess)
|
||||
{
|
||||
aAccess = "unused";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -2291,8 +2291,7 @@ ParseSelectorList(nsINode* aNode,
|
|||
const nsAString& aSelectorString,
|
||||
nsCSSSelectorList** aSelectorList)
|
||||
{
|
||||
NS_ENSURE_ARG(aNode);
|
||||
|
||||
MOZ_ASSERT(aNode);
|
||||
nsIDocument* doc = aNode->OwnerDoc();
|
||||
nsCSSParser parser(doc->CSSLoader());
|
||||
|
||||
|
@ -2345,24 +2344,34 @@ FindMatchingElements(nsINode* aRoot, const nsAString& aSelector, T &aList)
|
|||
|
||||
nsIDocument* doc = aRoot->OwnerDoc();
|
||||
nsIDocument::SelectorCache& cache = doc->GetSelectorCache();
|
||||
nsCSSSelectorList* selectorList = cache.GetList(aSelector);
|
||||
nsCSSSelectorList* selectorList = nullptr;
|
||||
bool haveCachedList = cache.GetList(aSelector, &selectorList);
|
||||
|
||||
if (!selectorList) {
|
||||
nsresult rv = ParseSelectorList(aRoot, aSelector,
|
||||
&selectorList);
|
||||
if (!haveCachedList) {
|
||||
nsresult rv = ParseSelectorList(aRoot, aSelector, &selectorList);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete selectorList;
|
||||
MOZ_ASSERT(!selectorList);
|
||||
MOZ_ASSERT(rv == NS_ERROR_DOM_SYNTAX_ERR,
|
||||
"Unexpected error, so cached version won't return it");
|
||||
// We hit this for syntax errors, which are quite common, so don't
|
||||
// use NS_ENSURE_SUCCESS. (For example, jQuery has an extended set
|
||||
// of selectors, but it sees if we can parse them first.)
|
||||
return rv;
|
||||
} else if (!selectorList) {
|
||||
// This is the "only pseudo-element selectors" case, which is
|
||||
// not common, so just don't worry about caching it. That way a
|
||||
// null cached value can always indicate an invalid selector.
|
||||
// Also don't try to do any matching, of course.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(selectorList, NS_OK);
|
||||
|
||||
cache.CacheList(aSelector, selectorList);
|
||||
}
|
||||
|
||||
if (!selectorList) {
|
||||
// Invalid selector, since we've already handled the pseudo-element case.
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
}
|
||||
|
||||
NS_ASSERTION(selectorList->mSelectors,
|
||||
"How can we not have any selectors?");
|
||||
|
||||
|
|
|
@ -282,6 +282,13 @@ public:
|
|||
uint16_t ReadyState();
|
||||
|
||||
// request
|
||||
void Open(const nsACString& aMethod, const nsAString& aUrl, ErrorResult& aRv)
|
||||
{
|
||||
Open(aMethod, aUrl, true,
|
||||
mozilla::dom::Optional<nsAString>(),
|
||||
mozilla::dom::Optional<nsAString>(),
|
||||
aRv);
|
||||
}
|
||||
void Open(const nsACString& aMethod, const nsAString& aUrl, bool aAsync,
|
||||
const mozilla::dom::Optional<nsAString>& aUser,
|
||||
const mozilla::dom::Optional<nsAString>& aPassword,
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<div id=testdiv>Inline script didn't run</div>
|
||||
<script>
|
||||
document.getElementById('testdiv').innerHTML = "Inline Script Executed";
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
content-security-policy-report-only: policy-uri /tests/content/base/test/csp/file_CSP_policyuri_regression_from_multipolicy_policy
|
|
@ -0,0 +1 @@
|
|||
default-src 'self';
|
|
@ -82,6 +82,9 @@ support-files =
|
|||
file_CSP_bug909029_star.html^headers^
|
||||
file_CSP_bug909029_none.html
|
||||
file_CSP_bug909029_none.html^headers^
|
||||
file_policyuri_regression_from_multipolicy.html
|
||||
file_policyuri_regression_from_multipolicy.html^headers^
|
||||
file_policyuri_regression_from_multipolicy_policy
|
||||
|
||||
[test_CSP.html]
|
||||
[test_CSP_bug663567.html]
|
||||
|
@ -99,3 +102,4 @@ support-files =
|
|||
[test_csp_redirects.html]
|
||||
[test_CSP_bug910139.html]
|
||||
[test_CSP_bug909029.html]
|
||||
[test_policyuri_regression_from_multipolicy.html]
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 924708</title>
|
||||
<!--
|
||||
test that a report-only policy that uses policy-uri is not incorrectly
|
||||
enforced due to regressions introduced by Bug 836922.
|
||||
-->
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<iframe style="width:200px;height:200px;" id='testframe'></iframe>
|
||||
<script class="testbody" type="text/javascript">
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{'set':[["security.csp.speccompliant", true]]},
|
||||
function() {
|
||||
var testframe = document.getElementById('testframe');
|
||||
testframe.src = 'file_policyuri_regression_from_multipolicy.html';
|
||||
testframe.addEventListener('load', function checkInlineScriptExecuted () {
|
||||
is(this.contentDocument.getElementById('testdiv').innerHTML,
|
||||
'Inline Script Executed',
|
||||
'Inline script should execute (it would be blocked by the policy, but the policy is report-only)');
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -27,11 +27,15 @@ function checkDoc(title, expectedtitle, normalizedtitle) {
|
|||
is(doc.doctype.internalSubset, null, "internalSubset should be null!");
|
||||
isElement(doc.documentElement, "html");
|
||||
isElement(doc.documentElement.firstChild, "head");
|
||||
is(doc.documentElement.firstChild.childNodes.length, 1);
|
||||
isElement(doc.documentElement.firstChild.firstChild, "title");
|
||||
// Doesn't always work out in WebKit.
|
||||
ok(doc.documentElement.firstChild.firstChild.firstChild, "Need a text node.");
|
||||
is(doc.documentElement.firstChild.firstChild.firstChild.data, expectedtitle);
|
||||
if (title !== undefined) {
|
||||
is(doc.documentElement.firstChild.childNodes.length, 1);
|
||||
isElement(doc.documentElement.firstChild.firstChild, "title");
|
||||
// Doesn't always work out in WebKit.
|
||||
ok(doc.documentElement.firstChild.firstChild.firstChild, "Need a text node.");
|
||||
is(doc.documentElement.firstChild.firstChild.firstChild.data, expectedtitle);
|
||||
} else {
|
||||
is(doc.documentElement.firstChild.childNodes.length, 0);
|
||||
}
|
||||
isElement(doc.documentElement.lastChild, "body");
|
||||
is(doc.documentElement.lastChild.childNodes.length, 0);
|
||||
((!title || title.indexOf("\f") === -1) ? is : todo_is)
|
||||
|
@ -41,7 +45,7 @@ function checkDoc(title, expectedtitle, normalizedtitle) {
|
|||
}
|
||||
checkDoc("", "", "");
|
||||
checkDoc(null, "null", "null");
|
||||
checkDoc(undefined, "undefined", "undefined");
|
||||
checkDoc(undefined, "", "");
|
||||
checkDoc("foo bar baz", "foo bar baz", "foo bar baz");
|
||||
checkDoc("foo\t\tbar baz", "foo\t\tbar baz", "foo bar baz");
|
||||
checkDoc("foo\n\nbar baz", "foo\n\nbar baz", "foo bar baz");
|
||||
|
|
|
@ -139,7 +139,7 @@ function test_CSPRep_fromPolicyURI() {
|
|||
// "allow *"; when the policy-uri fetching call-back happens, the *real*
|
||||
// policy will be in csp.policy
|
||||
CSPRep.fromString("policy-uri " + POLICY_URI,
|
||||
mkuri(DOCUMENT_URI), docChan, csp);
|
||||
mkuri(DOCUMENT_URI), false, docChan, csp);
|
||||
}
|
||||
|
||||
function test_CSPRep_fromRelativePolicyURI() {
|
||||
|
@ -159,5 +159,5 @@ function test_CSPRep_fromRelativePolicyURI() {
|
|||
// "allow *"; when the policy-uri fetching call-back happens, the *real*
|
||||
// policy will be in csp.policy
|
||||
CSPRep.fromString("policy-uri " + POLICY_URI_RELATIVE,
|
||||
mkuri(DOCUMENT_URI), docChan, csp);
|
||||
mkuri(DOCUMENT_URI), false, docChan, csp);
|
||||
}
|
||||
|
|
|
@ -302,11 +302,6 @@ this.PermissionsTable = { geolocation: {
|
|||
privileged: PROMPT_ACTION,
|
||||
certified: PROMPT_ACTION
|
||||
},
|
||||
"video-capture": {
|
||||
app: PROMPT_ACTION,
|
||||
privileged: PROMPT_ACTION,
|
||||
certified: PROMPT_ACTION
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,155 +2,19 @@
|
|||
* 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 "nsContentPermissionHelper.h"
|
||||
#include "nsIContentPermissionPrompt.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/PContentPermission.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
|
||||
using mozilla::unused; // <snicker>
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class ContentPermissionRequestParent : public PContentPermissionRequestParent
|
||||
{
|
||||
public:
|
||||
ContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
|
||||
Element* element,
|
||||
const IPC::Principal& principal);
|
||||
virtual ~ContentPermissionRequestParent();
|
||||
|
||||
bool IsBeingDestroyed();
|
||||
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCOMPtr<Element> mElement;
|
||||
nsCOMPtr<nsContentPermissionRequestProxy> mProxy;
|
||||
nsTArray<PermissionRequest> mRequests;
|
||||
|
||||
private:
|
||||
virtual bool Recvprompt();
|
||||
virtual void ActorDestroy(ActorDestroyReason why);
|
||||
};
|
||||
|
||||
ContentPermissionRequestParent::ContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
|
||||
Element* aElement,
|
||||
const IPC::Principal& aPrincipal)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ContentPermissionRequestParent);
|
||||
|
||||
mPrincipal = aPrincipal;
|
||||
mElement = aElement;
|
||||
mRequests = aRequests;
|
||||
}
|
||||
|
||||
ContentPermissionRequestParent::~ContentPermissionRequestParent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(ContentPermissionRequestParent);
|
||||
}
|
||||
|
||||
bool
|
||||
ContentPermissionRequestParent::Recvprompt()
|
||||
{
|
||||
mProxy = new nsContentPermissionRequestProxy();
|
||||
NS_ASSERTION(mProxy, "Alloc of request proxy failed");
|
||||
if (NS_FAILED(mProxy->Init(mRequests, this))) {
|
||||
mProxy->Cancel();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentPermissionRequestParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
if (mProxy) {
|
||||
mProxy->OnParentDestroyed();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ContentPermissionRequestParent::IsBeingDestroyed()
|
||||
{
|
||||
// When TabParent::Destroy() is called, we are being destroyed. It's unsafe
|
||||
// to send out any message now.
|
||||
TabParent* tabParent = static_cast<TabParent*>(Manager());
|
||||
return tabParent->IsDestroyed();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(ContentPermissionType, nsIContentPermissionType)
|
||||
|
||||
ContentPermissionType::ContentPermissionType(const nsACString& aType,
|
||||
const nsACString& aAccess)
|
||||
{
|
||||
mType = aType;
|
||||
mAccess = aAccess;
|
||||
}
|
||||
|
||||
ContentPermissionType::~ContentPermissionType()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ContentPermissionType::GetType(nsACString& aType)
|
||||
{
|
||||
aType = mType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ContentPermissionType::GetAccess(nsACString& aAccess)
|
||||
{
|
||||
aAccess = mAccess;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ConvertPermissionRequestToArray(nsTArray<PermissionRequest>& aSrcArray,
|
||||
nsIMutableArray* aDesArray)
|
||||
{
|
||||
uint32_t len = aSrcArray.Length();
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
nsRefPtr<ContentPermissionType> cpt =
|
||||
new ContentPermissionType(aSrcArray[i].type(), aSrcArray[i].access());
|
||||
aDesArray->AppendElement(cpt, false);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
nsresult
|
||||
CreatePermissionArray(const nsACString& aType,
|
||||
const nsACString& aAccess,
|
||||
nsIArray** aTypesArray)
|
||||
{
|
||||
nsCOMPtr<nsIMutableArray> types = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
nsRefPtr<ContentPermissionType> permType = new ContentPermissionType(aType,
|
||||
aAccess);
|
||||
types->AppendElement(permType, false);
|
||||
types.forget(aTypesArray);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PContentPermissionRequestParent*
|
||||
CreateContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
|
||||
Element* element,
|
||||
const IPC::Principal& principal)
|
||||
{
|
||||
return new ContentPermissionRequestParent(aRequests, element, principal);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
nsContentPermissionRequestProxy::nsContentPermissionRequestProxy()
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsContentPermissionRequestProxy);
|
||||
|
@ -162,12 +26,14 @@ nsContentPermissionRequestProxy::~nsContentPermissionRequestProxy()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsContentPermissionRequestProxy::Init(const nsTArray<PermissionRequest>& requests,
|
||||
nsContentPermissionRequestProxy::Init(const nsACString & type,
|
||||
const nsACString & access,
|
||||
ContentPermissionRequestParent* parent)
|
||||
{
|
||||
NS_ASSERTION(parent, "null parent");
|
||||
mParent = parent;
|
||||
mPermissionRequests = requests;
|
||||
mType = type;
|
||||
mAccess = access;
|
||||
|
||||
nsCOMPtr<nsIContentPermissionPrompt> prompt = do_CreateInstance(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID);
|
||||
if (!prompt) {
|
||||
|
@ -187,14 +53,17 @@ nsContentPermissionRequestProxy::OnParentDestroyed()
|
|||
NS_IMPL_ISUPPORTS1(nsContentPermissionRequestProxy, nsIContentPermissionRequest)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentPermissionRequestProxy::GetTypes(nsIArray** aTypes)
|
||||
nsContentPermissionRequestProxy::GetType(nsACString & aType)
|
||||
{
|
||||
nsCOMPtr<nsIMutableArray> types = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
if (ConvertPermissionRequestToArray(mPermissionRequests, types)) {
|
||||
types.forget(aTypes);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
aType = mType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentPermissionRequestProxy::GetAccess(nsACString & aAccess)
|
||||
{
|
||||
aAccess = mAccess;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -265,3 +134,55 @@ nsContentPermissionRequestProxy::Allow()
|
|||
mParent = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
ContentPermissionRequestParent::ContentPermissionRequestParent(const nsACString& aType,
|
||||
const nsACString& aAccess,
|
||||
Element* aElement,
|
||||
const IPC::Principal& aPrincipal)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ContentPermissionRequestParent);
|
||||
|
||||
mPrincipal = aPrincipal;
|
||||
mElement = aElement;
|
||||
mType = aType;
|
||||
mAccess = aAccess;
|
||||
}
|
||||
|
||||
ContentPermissionRequestParent::~ContentPermissionRequestParent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(ContentPermissionRequestParent);
|
||||
}
|
||||
|
||||
bool
|
||||
ContentPermissionRequestParent::Recvprompt()
|
||||
{
|
||||
mProxy = new nsContentPermissionRequestProxy();
|
||||
NS_ASSERTION(mProxy, "Alloc of request proxy failed");
|
||||
if (NS_FAILED(mProxy->Init(mType, mAccess, this))) {
|
||||
mProxy->Cancel();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentPermissionRequestParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
if (mProxy) {
|
||||
mProxy->OnParentDestroyed();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ContentPermissionRequestParent::IsBeingDestroyed()
|
||||
{
|
||||
// When TabParent::Destroy() is called, we are being destroyed. It's unsafe
|
||||
// to send out any message now.
|
||||
TabParent* tabParent = static_cast<TabParent*>(Manager());
|
||||
return tabParent->IsDestroyed();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -6,75 +6,60 @@
|
|||
#define nsContentPermissionHelper_h
|
||||
|
||||
#include "nsIContentPermissionPrompt.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
||||
|
||||
class nsContentPermissionRequestProxy;
|
||||
|
||||
// Forward declare IPC::Principal here which is defined in
|
||||
// PermissionMessageUtils.h. Include this file will transitively includes
|
||||
// "windows.h" and it defines
|
||||
// #define CreateEvent CreateEventW
|
||||
// #define LoadImage LoadImageW
|
||||
// That will mess up windows build.
|
||||
namespace IPC {
|
||||
class Principal;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Element;
|
||||
class PermissionRequest;
|
||||
class ContentPermissionRequestParent;
|
||||
class PContentPermissionRequestParent;
|
||||
|
||||
class ContentPermissionType : public nsIContentPermissionType
|
||||
class ContentPermissionRequestParent : public PContentPermissionRequestParent
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONTENTPERMISSIONTYPE
|
||||
public:
|
||||
ContentPermissionRequestParent(const nsACString& type,
|
||||
const nsACString& access,
|
||||
Element* element,
|
||||
const IPC::Principal& principal);
|
||||
virtual ~ContentPermissionRequestParent();
|
||||
|
||||
ContentPermissionType(const nsACString& aType, const nsACString& aAccess);
|
||||
virtual ~ContentPermissionType();
|
||||
bool IsBeingDestroyed();
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCOMPtr<Element> mElement;
|
||||
nsCOMPtr<nsContentPermissionRequestProxy> mProxy;
|
||||
nsCString mType;
|
||||
nsCString mAccess;
|
||||
|
||||
private:
|
||||
virtual bool Recvprompt();
|
||||
virtual void ActorDestroy(ActorDestroyReason why);
|
||||
};
|
||||
|
||||
uint32_t ConvertPermissionRequestToArray(nsTArray<PermissionRequest>& aSrcArray,
|
||||
nsIMutableArray* aDesArray);
|
||||
|
||||
nsresult CreatePermissionArray(const nsACString& aType,
|
||||
const nsACString& aAccess,
|
||||
nsIArray** aTypesArray);
|
||||
|
||||
PContentPermissionRequestParent*
|
||||
CreateContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
|
||||
Element* element,
|
||||
const IPC::Principal& principal);
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
class nsContentPermissionRequestProxy : public nsIContentPermissionRequest
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONTENTPERMISSIONREQUEST
|
||||
|
||||
nsContentPermissionRequestProxy();
|
||||
virtual ~nsContentPermissionRequestProxy();
|
||||
|
||||
nsresult Init(const nsTArray<mozilla::dom::PermissionRequest>& requests,
|
||||
mozilla::dom::ContentPermissionRequestParent* parent);
|
||||
nsresult Init(const nsACString& type, const nsACString& access, mozilla::dom::ContentPermissionRequestParent* parent);
|
||||
void OnParentDestroyed();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONTENTPERMISSIONREQUEST
|
||||
|
||||
private:
|
||||
// Non-owning pointer to the ContentPermissionRequestParent object which owns this proxy.
|
||||
mozilla::dom::ContentPermissionRequestParent* mParent;
|
||||
nsTArray<mozilla::dom::PermissionRequest> mPermissionRequests;
|
||||
nsCString mType;
|
||||
nsCString mAccess;
|
||||
};
|
||||
|
||||
#endif // nsContentPermissionHelper_h
|
||||
|
||||
|
|
|
@ -36,16 +36,6 @@
|
|||
#include "nsIScriptTimeoutHandler.h"
|
||||
#include "nsIController.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
// Thanks so much, Microsoft! :(
|
||||
#ifdef GetClassName
|
||||
#undef GetClassName
|
||||
#endif // GetClassName
|
||||
#ifdef CreateEvent
|
||||
#undef CreateEvent
|
||||
#endif
|
||||
#endif // XP_WIN
|
||||
|
||||
// Helper Classes
|
||||
#include "nsJSUtils.h"
|
||||
#include "jsapi.h" // for JSAutoRequest
|
||||
|
@ -75,6 +65,18 @@
|
|||
#include "nsIWidgetListener.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsDeviceSensors.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
// Thanks so much, Microsoft and the people who pull in windows.h via
|
||||
// random silly headers! :(
|
||||
#ifdef GetClassName
|
||||
#undef GetClassName
|
||||
#endif // GetClassName
|
||||
#ifdef CreateEvent
|
||||
#undef CreateEvent
|
||||
#endif
|
||||
#endif // XP_WIN
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocCharset.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/HalScreenConfiguration.h"
|
||||
#include "nsIDOMScreen.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
|
|
|
@ -53,6 +53,14 @@ def toStringBool(arg):
|
|||
def toBindingNamespace(arg):
|
||||
return re.sub("((_workers)?$)", "Binding\\1", arg);
|
||||
|
||||
def isTypeCopyConstructible(type):
|
||||
# Nullable and sequence stuff doesn't affect copy/constructibility
|
||||
type = type.unroll()
|
||||
return (type.isPrimitive() or type.isString() or type.isEnum() or
|
||||
(type.isUnion() and CGUnionStruct.isUnionCopyConstructible(type)) or
|
||||
(type.isDictionary() and
|
||||
CGDictionary.isDictionaryCopyConstructible(type.inner)))
|
||||
|
||||
class CGThing():
|
||||
"""
|
||||
Abstract base class for things that spit out code.
|
||||
|
@ -2708,8 +2716,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
# A helper function for wrapping up the template body for
|
||||
# possibly-nullable objecty stuff
|
||||
def wrapObjectTemplate(templateBody, type, codeToSetNull, failureCode=None):
|
||||
if isNullOrUndefined:
|
||||
assert type.nullable()
|
||||
if isNullOrUndefined and type.nullable():
|
||||
# Just ignore templateBody and set ourselves to null.
|
||||
# Note that we don't have to worry about default values
|
||||
# here either, since we already examined this value.
|
||||
|
@ -3203,6 +3210,12 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
isMember or
|
||||
isCallbackReturnValue)
|
||||
|
||||
if forceOwningType and descriptor.nativeOwnership == 'owned':
|
||||
raise TypeError("Interface %s has 'owned' nativeOwnership, so we "
|
||||
"don't know how to keep it alive in %s" %
|
||||
(descriptor.interface.identifier.name,
|
||||
sourceDescription))
|
||||
|
||||
typeName = descriptor.nativeType
|
||||
typePtr = typeName + "*"
|
||||
|
||||
|
@ -3349,9 +3362,6 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
"Default": "eStringify",
|
||||
"EmptyString": "eEmpty",
|
||||
"Null": "eNull",
|
||||
# For Missing it doesn't matter what we use here, since we'll never
|
||||
# call ConvertJSValueToString on undefined in that case.
|
||||
"Missing": "eStringify"
|
||||
}
|
||||
if type.nullable():
|
||||
# For nullable strings null becomes a null string.
|
||||
|
@ -3871,11 +3881,8 @@ class CGArgumentConverter(CGThing):
|
|||
"args[${index}]"
|
||||
).substitute(replacer)
|
||||
self.replacementVariables["mutableVal"] = self.replacementVariables["val"]
|
||||
if argument.treatUndefinedAs == "Missing":
|
||||
haveValueCheck = "args.hasDefined(${index})"
|
||||
else:
|
||||
haveValueCheck = "${index} < args.length()"
|
||||
haveValueCheck = string.Template(haveValueCheck).substitute(replacer)
|
||||
haveValueCheck = string.Template(
|
||||
"args.hasDefined(${index})").substitute(replacer)
|
||||
self.replacementVariables["haveValue"] = haveValueCheck
|
||||
self.descriptorProvider = descriptorProvider
|
||||
if self.argument.optional and not self.argument.defaultValue:
|
||||
|
@ -4832,6 +4839,18 @@ if (global.Failed()) {
|
|||
else:
|
||||
assert self.argCount == 0
|
||||
|
||||
if needsUnwrap:
|
||||
# It's very important that we construct our unwrappedObj, if we need
|
||||
# to do it, before we might start setting up Rooted things for our
|
||||
# arguments, so that we don't violate the stack discipline Rooted
|
||||
# depends on.
|
||||
cgThings.append(CGGeneric(
|
||||
"bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);"))
|
||||
if needsUnwrappedVar:
|
||||
cgThings.append(CGIfWrapper(
|
||||
CGGeneric("unwrappedObj.construct(cx, obj);"),
|
||||
"objIsXray"))
|
||||
|
||||
cgThings.extend([CGArgumentConverter(arguments[i], i, self.descriptor,
|
||||
argDescription % { "index": i + 1 },
|
||||
invalidEnumValueFatal=not setter,
|
||||
|
@ -4842,10 +4861,6 @@ if (global.Failed()) {
|
|||
if needsUnwrap:
|
||||
# Something depends on having the unwrapped object, so unwrap it now.
|
||||
xraySteps = []
|
||||
if needsUnwrappedVar:
|
||||
xraySteps.append(
|
||||
CGGeneric("unwrappedObj.construct(cx, obj);"))
|
||||
|
||||
# XXXkhuey we should be able to MOZ_ASSERT that ${obj} is
|
||||
# not null.
|
||||
xraySteps.append(
|
||||
|
@ -4871,7 +4886,7 @@ if (!${obj}) {
|
|||
|
||||
cgThings.append(
|
||||
CGIfWrapper(CGList(xraySteps, "\n"),
|
||||
"xpc::WrapperFactory::IsXrayWrapper(obj)"))
|
||||
"objIsXray"))
|
||||
|
||||
cgThings.append(CGCallGenerator(
|
||||
self.getErrorReport() if self.isFallible() else None,
|
||||
|
@ -5017,15 +5032,6 @@ class CGMethodCall(CGThing):
|
|||
CGWrapper(CGIndenter(CGGeneric(code)), pre="\n", post="\n"))
|
||||
return
|
||||
|
||||
# We don't handle [TreatUndefinedAs=Missing] arguments in overload
|
||||
# resolution yet.
|
||||
for (_, sigArgs) in signatures:
|
||||
for arg in sigArgs:
|
||||
if arg.treatUndefinedAs == "Missing":
|
||||
raise TypeError("No support for [TreatUndefinedAs=Missing] "
|
||||
"handling in overload resolution yet: %s" %
|
||||
arg.location)
|
||||
|
||||
# Need to find the right overload
|
||||
maxArgCount = method.maxArgCount
|
||||
allowedArgCounts = method.allowedArgCounts
|
||||
|
@ -5115,22 +5121,30 @@ class CGMethodCall(CGThing):
|
|||
else:
|
||||
failureCode = None
|
||||
type = distinguishingType(signature)
|
||||
# The argument at index distinguishingIndex can't possibly
|
||||
# be unset here, because we've already checked that argc is
|
||||
# large enough that we can examine this argument.
|
||||
# The argument at index distinguishingIndex can't possibly be
|
||||
# unset here, because we've already checked that argc is large
|
||||
# enough that we can examine this argument. But note that we
|
||||
# still want to claim that optional arguments are optional, in
|
||||
# case undefined was passed in.
|
||||
argIsOptional = (distinguishingArgument(signature).optional and
|
||||
not distinguishingArgument(signature).defaultValue)
|
||||
testCode = instantiateJSToNativeConversion(
|
||||
getJSToNativeConversionInfo(type, descriptor,
|
||||
failureCode=failureCode,
|
||||
isDefinitelyObject=isDefinitelyObject,
|
||||
isNullOrUndefined=isNullOrUndefined,
|
||||
isOptional=argIsOptional,
|
||||
sourceDescription=(argDesc % (distinguishingIndex + 1))),
|
||||
{
|
||||
"declName" : "arg%d" % distinguishingIndex,
|
||||
"holderName" : ("arg%d" % distinguishingIndex) + "_holder",
|
||||
"val" : distinguishingArg,
|
||||
"mutableVal" : distinguishingArg,
|
||||
"obj" : "obj"
|
||||
})
|
||||
"obj" : "obj",
|
||||
"haveValue": "args.hasDefined(%d)" % distinguishingIndex
|
||||
},
|
||||
checkForValue=argIsOptional
|
||||
)
|
||||
caseBody.append(CGIndenter(testCode, indent));
|
||||
# If we got this far, we know we unwrapped to the right
|
||||
# C++ type, so just do the call. Start conversion with
|
||||
|
@ -5140,24 +5154,76 @@ class CGMethodCall(CGThing):
|
|||
getPerSignatureCall(signature, distinguishingIndex + 1),
|
||||
indent))
|
||||
|
||||
# First check for null or undefined. That means looking for
|
||||
def hasConditionalConversion(type):
|
||||
"""
|
||||
Return whether the argument conversion for this type will be
|
||||
conditional on the type of incoming JS value. For example, for
|
||||
interface types the conversion is conditional on the incoming
|
||||
value being isObject().
|
||||
|
||||
For the types for which this returns false, we do not have to
|
||||
output extra isUndefined() or isNullOrUndefined() cases, because
|
||||
null/undefined values will just fall through into our
|
||||
unconditional conversion.
|
||||
"""
|
||||
if type.isString() or type.isEnum():
|
||||
return False
|
||||
if type.isBoolean():
|
||||
distinguishingTypes = (distinguishingType(s) for s in
|
||||
possibleSignatures)
|
||||
return any(t.isString() or t.isEnum() or t.isNumeric()
|
||||
for t in distinguishingTypes)
|
||||
if type.isNumeric():
|
||||
distinguishingTypes = (distinguishingType(s) for s in
|
||||
possibleSignatures)
|
||||
return any(t.isString() or t.isEnum()
|
||||
for t in distinguishingTypes)
|
||||
return True
|
||||
|
||||
def needsNullOrUndefinedCase(type):
|
||||
"""
|
||||
Return true if the type needs a special isNullOrUndefined() case
|
||||
"""
|
||||
return ((type.nullable() and
|
||||
hasConditionalConversion(type)) or
|
||||
type.isDictionary())
|
||||
|
||||
# First check for undefined and optional distinguishing arguments
|
||||
# and output a special branch for that case. Note that we don't
|
||||
# use distinguishingArgument here because we actualy want to
|
||||
# exclude variadic arguments. Also note that we skip this check if
|
||||
# we plan to output a isNullOrUndefined() special case for this
|
||||
# argument anyway, since that will subsume our isUndefined() check.
|
||||
# This is safe, because there can be at most one nullable
|
||||
# distinguishing argument, so if we're it we'll definitely get
|
||||
# picked up by the nullable handling. Also, we can skip this check
|
||||
# if the argument has an unconditional conversion later on.
|
||||
undefSigs = [s for s in possibleSignatures if
|
||||
distinguishingIndex < len(s[1]) and
|
||||
s[1][distinguishingIndex].optional and
|
||||
hasConditionalConversion(s[1][distinguishingIndex].type) and
|
||||
not needsNullOrUndefinedCase(s[1][distinguishingIndex].type)]
|
||||
# Can't have multiple signatures with an optional argument at the
|
||||
# same index.
|
||||
assert len(undefSigs) < 2
|
||||
if len(undefSigs) > 0:
|
||||
caseBody.append(CGGeneric("if (%s.isUndefined()) {" %
|
||||
distinguishingArg))
|
||||
tryCall(undefSigs[0], 2, isNullOrUndefined=True)
|
||||
caseBody.append(CGGeneric("}"))
|
||||
|
||||
# Next, check for null or undefined. That means looking for
|
||||
# nullable arguments at the distinguishing index and outputting a
|
||||
# separate branch for them. But if the nullable argument is a
|
||||
# primitive, string, or enum, we don't need to do that. The reason
|
||||
# separate branch for them. But if the nullable argument has an
|
||||
# unconditional conversion, we don't need to do that. The reason
|
||||
# for that is that at most one argument at the distinguishing index
|
||||
# is nullable (since two nullable arguments are not
|
||||
# distinguishable), and all the argument types other than
|
||||
# primitive/string/enum end up inside isObject() checks. So if our
|
||||
# nullable is a primitive/string/enum it's safe to not output the
|
||||
# extra branch: we'll fall through to conversion for those types,
|
||||
# which correctly handles null as needed, because isObject() will be
|
||||
# false for null and undefined.
|
||||
# distinguishable), and null/undefined values will always fall
|
||||
# through to the unconditional conversion we have, if any, since
|
||||
# they will fail whatever the conditions on the input value are for
|
||||
# our other conversions.
|
||||
nullOrUndefSigs = [s for s in possibleSignatures
|
||||
if ((distinguishingType(s).nullable() and not
|
||||
distinguishingType(s).isString() and not
|
||||
distinguishingType(s).isEnum() and not
|
||||
distinguishingType(s).isPrimitive()) or
|
||||
distinguishingType(s).isDictionary())]
|
||||
if needsNullOrUndefinedCase(distinguishingType(s))]
|
||||
# Can't have multiple nullable types here
|
||||
assert len(nullOrUndefSigs) < 2
|
||||
if len(nullOrUndefSigs) > 0:
|
||||
|
@ -6274,6 +6340,10 @@ class CGUnionStruct(CGThing):
|
|||
enumValues = ["eUninitialized"]
|
||||
toJSValCases = [CGCase("eUninitialized", CGGeneric("return false;"))]
|
||||
destructorCases = [CGCase("eUninitialized", None)]
|
||||
assignmentCases = [
|
||||
CGCase("eUninitialized",
|
||||
CGGeneric('MOZ_ASSERT(mType == eUninitialized,\n'
|
||||
' "We need to destroy ourselves?");'))]
|
||||
traceCases = []
|
||||
unionValues = []
|
||||
if self.type.hasNullableType:
|
||||
|
@ -6285,6 +6355,8 @@ class CGUnionStruct(CGThing):
|
|||
body="mType = eNull;",
|
||||
bodyInHeader=True))
|
||||
destructorCases.append(CGCase("eNull", None))
|
||||
assignmentCases.append(CGCase("eNull",
|
||||
CGGeneric("mType = eNull;")))
|
||||
toJSValCases.append(CGCase("eNull", CGGeneric("rval.setNull();\n"
|
||||
"return true;")))
|
||||
|
||||
|
@ -6352,6 +6424,10 @@ class CGUnionStruct(CGThing):
|
|||
destructorCases.append(CGCase("e" + vars["name"],
|
||||
CGGeneric("Destroy%s();"
|
||||
% vars["name"])))
|
||||
assignmentCases.append(
|
||||
CGCase("e" + vars["name"],
|
||||
CGGeneric("SetAs%s() = aOther.GetAs%s();" %
|
||||
(vars["name"], vars["name"]))))
|
||||
if self.ownsMembers and typeNeedsRooting(t):
|
||||
if t.isObject():
|
||||
traceCases.append(
|
||||
|
@ -6380,6 +6456,8 @@ class CGUnionStruct(CGThing):
|
|||
], body=CGSwitch("mType", toJSValCases,
|
||||
default=CGGeneric("return false;")).define(), const=True))
|
||||
|
||||
constructors = [ctor]
|
||||
selfName = ("Owning" if self.ownsMembers else "") + str(self.type)
|
||||
if self.ownsMembers:
|
||||
if len(traceCases):
|
||||
traceBody = CGSwitch("mType", traceCases,
|
||||
|
@ -6389,13 +6467,30 @@ class CGUnionStruct(CGThing):
|
|||
methods.append(ClassMethod("TraceUnion", "void",
|
||||
[Argument("JSTracer*", "trc")],
|
||||
body=traceBody))
|
||||
if CGUnionStruct.isUnionCopyConstructible(self.type):
|
||||
constructors.append(
|
||||
ClassConstructor([Argument("const %s&" % selfName,
|
||||
"aOther")],
|
||||
bodyInHeader=True,
|
||||
visibility="public",
|
||||
explicit=True,
|
||||
body="*this = aOther;"))
|
||||
methods.append(ClassMethod(
|
||||
"operator=", "void",
|
||||
[Argument("const %s&" % selfName, "aOther")],
|
||||
body=CGSwitch("aOther.mType", assignmentCases).define()))
|
||||
disallowCopyConstruction = False
|
||||
else:
|
||||
disallowCopyConstruction = True
|
||||
else:
|
||||
disallowCopyConstruction = True
|
||||
|
||||
friend=" friend class %sArgument;\n" % str(self.type) if not self.ownsMembers else ""
|
||||
return CGClass(("Owning" if self.ownsMembers else "") + str(self.type),
|
||||
return CGClass(selfName,
|
||||
members=members,
|
||||
constructors=[ctor],
|
||||
constructors=constructors,
|
||||
methods=methods,
|
||||
disallowCopyConstruction=True,
|
||||
disallowCopyConstruction=disallowCopyConstruction,
|
||||
extradeclarations=friend,
|
||||
destructor=ClassDestructor(visibility="public",
|
||||
body=dtor,
|
||||
|
@ -6417,6 +6512,10 @@ class CGUnionStruct(CGThing):
|
|||
})
|
||||
return CGGeneric(wrapCode)
|
||||
|
||||
@staticmethod
|
||||
def isUnionCopyConstructible(type):
|
||||
return all(isTypeCopyConstructible(t) for t in type.flatMemberTypes)
|
||||
|
||||
class CGUnionConversionStruct(CGThing):
|
||||
def __init__(self, type, descriptorProvider):
|
||||
CGThing.__init__(self)
|
||||
|
@ -8710,12 +8809,6 @@ if (""",
|
|||
|
||||
@staticmethod
|
||||
def isDictionaryCopyConstructible(dictionary):
|
||||
def isTypeCopyConstructible(type):
|
||||
# Nullable and sequence stuff doesn't affect copy/constructibility
|
||||
type = type.unroll()
|
||||
return (type.isPrimitive() or type.isString() or type.isEnum() or
|
||||
(type.isDictionary() and
|
||||
CGDictionary.isDictionaryCopyConstructible(type.inner)))
|
||||
if (dictionary.parent and
|
||||
not CGDictionary.isDictionaryCopyConstructible(dictionary.parent)):
|
||||
return False
|
||||
|
|
|
@ -81,11 +81,6 @@ public:
|
|||
return !Equals(aOtherNullable);
|
||||
}
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return !mIsNull;
|
||||
}
|
||||
|
||||
// Make it possible to use a const Nullable of an array type with other
|
||||
// array types.
|
||||
template<typename U>
|
||||
|
|
|
@ -401,12 +401,7 @@ class IDLObjectWithIdentifier(IDLObject):
|
|||
if isDictionaryMember:
|
||||
raise WebIDLError("[TreatUndefinedAs] is not allowed for "
|
||||
"dictionary members", [self.location])
|
||||
if value == 'Missing':
|
||||
if not isOptional:
|
||||
raise WebIDLError("[TreatUndefinedAs=Missing] is only "
|
||||
"allowed on optional arguments",
|
||||
[self.location])
|
||||
elif value == 'Null':
|
||||
if value == 'Null':
|
||||
if not self.type.isDOMString():
|
||||
raise WebIDLError("[TreatUndefinedAs=Null] is only "
|
||||
"allowed on arguments or "
|
||||
|
@ -426,8 +421,8 @@ class IDLObjectWithIdentifier(IDLObject):
|
|||
[self.location])
|
||||
else:
|
||||
raise WebIDLError("[TreatUndefinedAs] must take the "
|
||||
"identifiers EmptyString or Null or "
|
||||
"Missing", [self.location])
|
||||
"identifiers EmptyString or Null",
|
||||
[self.location])
|
||||
self.treatUndefinedAs = value
|
||||
else:
|
||||
unhandledAttrs.append(attr)
|
||||
|
@ -3153,15 +3148,12 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
|
||||
def finish(self, scope):
|
||||
for overload in self._overloads:
|
||||
inOptionalArguments = False
|
||||
variadicArgument = None
|
||||
|
||||
arguments = overload.arguments
|
||||
for (idx, argument) in enumerate(arguments):
|
||||
if argument.isComplete():
|
||||
continue
|
||||
|
||||
argument.complete(scope)
|
||||
if not argument.isComplete():
|
||||
argument.complete(scope)
|
||||
assert argument.type.isComplete()
|
||||
|
||||
if (argument.type.isDictionary() or
|
||||
|
@ -3171,7 +3163,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
# end of the list or followed by optional arguments must be
|
||||
# optional.
|
||||
if (not argument.optional and
|
||||
(idx == len(arguments) - 1 or arguments[idx+1].optional)):
|
||||
all(arg.optional for arg in arguments[idx+1:])):
|
||||
raise WebIDLError("Dictionary argument or union "
|
||||
"argument containing a dictionary "
|
||||
"not followed by a required argument "
|
||||
|
@ -3189,13 +3181,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
if variadicArgument:
|
||||
raise WebIDLError("Variadic argument is not last argument",
|
||||
[variadicArgument.location])
|
||||
# Once we see an optional argument, there can't be any non-optional
|
||||
# arguments.
|
||||
if inOptionalArguments and not argument.optional:
|
||||
raise WebIDLError("Non-optional argument after optional "
|
||||
"arguments",
|
||||
[argument.location])
|
||||
inOptionalArguments = argument.optional
|
||||
if argument.variadic:
|
||||
variadicArgument = argument
|
||||
|
||||
|
@ -3240,7 +3225,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
return [overload for overload in self._overloads if
|
||||
len(overload.arguments) == argc or
|
||||
(len(overload.arguments) > argc and
|
||||
overload.arguments[argc].optional) or
|
||||
all(arg.optional for arg in overload.arguments[argc:])) or
|
||||
(len(overload.arguments) < argc and
|
||||
len(overload.arguments) > 0 and
|
||||
overload.arguments[-1].variadic)]
|
||||
|
@ -4070,21 +4055,6 @@ class Parser(Tokenizer):
|
|||
raise WebIDLError("stringifier must have DOMString return type",
|
||||
[self.getLocation(p, 2)])
|
||||
|
||||
inOptionalArguments = False
|
||||
variadicArgument = False
|
||||
for argument in arguments:
|
||||
# Only the last argument can be variadic
|
||||
if variadicArgument:
|
||||
raise WebIDLError("Only the last argument can be variadic",
|
||||
[variadicArgument.location])
|
||||
# Once we see an optional argument, there can't be any non-optional
|
||||
# arguments.
|
||||
if inOptionalArguments and not argument.optional:
|
||||
raise WebIDLError("Cannot have a non-optional argument following an optional argument",
|
||||
[argument.location])
|
||||
inOptionalArguments = argument.optional
|
||||
variadicArgument = argument if argument.variadic else None
|
||||
|
||||
# identifier might be None. This is only permitted for special methods.
|
||||
if not identifier:
|
||||
if not getter and not setter and not creator and \
|
||||
|
|
|
@ -171,6 +171,23 @@ def WebIDLTest(parser, harness):
|
|||
|
||||
harness.ok(threw, "Dictionary arg followed by optional arg must be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(A arg1, optional long arg2, long arg3);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(not threw,
|
||||
"Dictionary arg followed by non-optional arg doesn't have to be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
|
|
|
@ -11,9 +11,9 @@ def WebIDLTest(parser, harness):
|
|||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Should have thrown on non-optional argument following optional "
|
||||
"argument.")
|
||||
harness.ok(not threw,
|
||||
"Should not have thrown on non-optional argument following "
|
||||
"optional argument.")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
|
|
|
@ -11,6 +11,8 @@ def WebIDLTest(parser, harness):
|
|||
void withVariadics(long... numbers);
|
||||
void withVariadics(TestOverloads iface);
|
||||
void withVariadics(long num, TestOverloads iface);
|
||||
void optionalTest();
|
||||
void optionalTest(optional long num1, long num2);
|
||||
};
|
||||
""")
|
||||
|
||||
|
@ -23,7 +25,7 @@ def WebIDLTest(parser, harness):
|
|||
"Should be an IDLInterface")
|
||||
harness.check(iface.identifier.QName(), "::TestOverloads", "Interface has the right QName")
|
||||
harness.check(iface.identifier.name, "TestOverloads", "Interface has the right name")
|
||||
harness.check(len(iface.members), 3, "Expect %s members" % 3)
|
||||
harness.check(len(iface.members), 4, "Expect %s members" % 4)
|
||||
|
||||
member = iface.members[0]
|
||||
harness.check(member.identifier.QName(), "::TestOverloads::basic", "Method has the right QName")
|
||||
|
@ -48,3 +50,11 @@ def WebIDLTest(parser, harness):
|
|||
harness.check(argument.identifier.QName(), "::TestOverloads::basic::arg1", "Argument has the right QName")
|
||||
harness.check(argument.identifier.name, "arg1", "Argument has the right name")
|
||||
harness.check(str(argument.type), "Long", "Argument has the right type")
|
||||
|
||||
member = iface.members[3]
|
||||
harness.check(len(member.overloadsForArgCount(0)), 1,
|
||||
"Only one overload for no args")
|
||||
harness.check(len(member.overloadsForArgCount(1)), 0,
|
||||
"No overloads for one arg")
|
||||
harness.check(len(member.overloadsForArgCount(2)), 1,
|
||||
"Only one overload for two args")
|
||||
|
|
|
@ -1,51 +1,62 @@
|
|||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
results = parser.parse("""
|
||||
parser.parse("""
|
||||
interface VariadicConstraints1 {
|
||||
void foo(byte... arg1, byte arg2);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
harness.ok(threw,
|
||||
"Should have thrown on variadic argument followed by required "
|
||||
"argument.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
results = parser.parse("""
|
||||
parser.parse("""
|
||||
interface VariadicConstraints2 {
|
||||
void foo(byte... arg1, optional byte arg2);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish();
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
harness.ok(threw,
|
||||
"Should have thrown on variadic argument followed by optional "
|
||||
"argument.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
results = parser.parse("""
|
||||
parser.parse("""
|
||||
interface VariadicConstraints3 {
|
||||
void foo(optional byte... arg1);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
harness.ok(threw,
|
||||
"Should have thrown on variadic argument explicitly flagged as "
|
||||
"optional.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
results = parser.parse("""
|
||||
parser.parse("""
|
||||
interface VariadicConstraints4 {
|
||||
void foo(byte... arg1 = 0);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
|
|
|
@ -161,9 +161,9 @@ public:
|
|||
void PassByte(int8_t);
|
||||
int8_t ReceiveByte();
|
||||
void PassOptionalByte(const Optional<int8_t>&);
|
||||
void PassOptionalUndefinedMissingByte(const Optional<int8_t>&);
|
||||
void PassOptionalByteBeforeRequired(const Optional<int8_t>&, int8_t);
|
||||
void PassOptionalByteWithDefault(int8_t);
|
||||
void PassOptionalUndefinedMissingByteWithDefault(int8_t);
|
||||
void PassOptionalByteWithDefaultBeforeRequired(int8_t, int8_t);
|
||||
void PassNullableByte(const Nullable<int8_t>&);
|
||||
void PassOptionalNullableByte(const Optional< Nullable<int8_t> >&);
|
||||
void PassVariadicByte(const Sequence<int8_t>&);
|
||||
|
@ -410,9 +410,7 @@ public:
|
|||
void PassString(const nsAString&);
|
||||
void PassNullableString(const nsAString&);
|
||||
void PassOptionalString(const Optional<nsAString>&);
|
||||
void PassOptionalUndefinedMissingString(const Optional<nsAString>&);
|
||||
void PassOptionalStringWithDefaultValue(const nsAString&);
|
||||
void PassOptionalUndefinedMissingStringWithDefaultValue(const nsAString&);
|
||||
void PassOptionalNullableString(const Optional<nsAString>&);
|
||||
void PassOptionalNullableStringWithDefaultValue(const nsAString&);
|
||||
void PassVariadicString(const Sequence<nsString>&);
|
||||
|
@ -634,6 +632,22 @@ public:
|
|||
void Overload7(const nsCString&);
|
||||
void Overload8(int32_t);
|
||||
void Overload8(TestInterface&);
|
||||
void Overload9(const Nullable<int32_t>&);
|
||||
void Overload9(const nsAString&);
|
||||
void Overload10(const Nullable<int32_t>&);
|
||||
void Overload10(JSContext*, JS::Handle<JSObject*>);
|
||||
void Overload11(int32_t);
|
||||
void Overload11(const nsAString&);
|
||||
void Overload12(int32_t);
|
||||
void Overload12(const Nullable<bool>&);
|
||||
void Overload13(const Nullable<int32_t>&);
|
||||
void Overload13(bool);
|
||||
void Overload14(const Optional<int32_t>&);
|
||||
void Overload14(TestInterface&);
|
||||
void Overload15(int32_t);
|
||||
void Overload15(const Optional<NonNull<TestInterface> >&);
|
||||
void Overload16(int32_t);
|
||||
void Overload16(const Optional<TestInterface*>&);
|
||||
|
||||
// Variadic handling
|
||||
void PassVariadicThirdArg(const nsAString&, int32_t,
|
||||
|
|
|
@ -118,9 +118,9 @@ interface TestInterface {
|
|||
void passByte(byte arg);
|
||||
byte receiveByte();
|
||||
void passOptionalByte(optional byte arg);
|
||||
void passOptionalUndefinedMissingByte([TreatUndefinedAs=Missing] optional byte arg);
|
||||
void passOptionalByteBeforeRequired(optional byte arg1, byte arg2);
|
||||
void passOptionalByteWithDefault(optional byte arg = 0);
|
||||
void passOptionalUndefinedMissingByteWithDefault([TreatUndefinedAs=Missing] optional byte arg = 0);
|
||||
void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2);
|
||||
void passNullableByte(byte? arg);
|
||||
void passOptionalNullableByte(optional byte? arg);
|
||||
void passVariadicByte(byte... arg);
|
||||
|
@ -365,9 +365,7 @@ interface TestInterface {
|
|||
void passString(DOMString arg);
|
||||
void passNullableString(DOMString? arg);
|
||||
void passOptionalString(optional DOMString arg);
|
||||
void passOptionalUndefinedMissingString([TreatUndefinedAs=Missing] optional DOMString arg);
|
||||
void passOptionalStringWithDefaultValue(optional DOMString arg = "abc");
|
||||
void passOptionalUndefinedMissingStringWithDefaultValue([TreatUndefinedAs=Missing] optional DOMString arg = "abc");
|
||||
void passOptionalNullableString(optional DOMString? arg);
|
||||
void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null);
|
||||
void passVariadicString(DOMString... arg);
|
||||
|
@ -584,6 +582,22 @@ interface TestInterface {
|
|||
void overload7(ByteString arg);
|
||||
void overload8(long arg);
|
||||
void overload8(TestInterface arg);
|
||||
void overload9(long? arg);
|
||||
void overload9(DOMString arg);
|
||||
void overload10(long? arg);
|
||||
void overload10(object arg);
|
||||
void overload11(long arg);
|
||||
void overload11(DOMString? arg);
|
||||
void overload12(long arg);
|
||||
void overload12(boolean? arg);
|
||||
void overload13(long? arg);
|
||||
void overload13(boolean arg);
|
||||
void overload14(optional long arg);
|
||||
void overload14(TestInterface arg);
|
||||
void overload15(long arg);
|
||||
void overload15(optional TestInterface arg);
|
||||
void overload16(long arg);
|
||||
void overload16(optional TestInterface? arg);
|
||||
|
||||
// Variadic handling
|
||||
void passVariadicThirdArg(DOMString arg1, long arg2, TestInterface... arg3);
|
||||
|
|
|
@ -23,9 +23,9 @@ interface TestExampleInterface {
|
|||
void passByte(byte arg);
|
||||
byte receiveByte();
|
||||
void passOptionalByte(optional byte arg);
|
||||
void passOptionalUndefinedMissingByte([TreatUndefinedAs=Missing] optional byte arg);
|
||||
void passOptionalByteBeforeRequired(optional byte arg1, byte arg2);
|
||||
void passOptionalByteWithDefault(optional byte arg = 0);
|
||||
void passOptionalUndefinedMissingByteWithDefault([TreatUndefinedAs=Missing] optional byte arg = 0);
|
||||
void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2);
|
||||
void passNullableByte(byte? arg);
|
||||
void passOptionalNullableByte(optional byte? arg);
|
||||
void passVariadicByte(byte... arg);
|
||||
|
@ -263,9 +263,7 @@ interface TestExampleInterface {
|
|||
void passString(DOMString arg);
|
||||
void passNullableString(DOMString? arg);
|
||||
void passOptionalString(optional DOMString arg);
|
||||
void passOptionalUndefinedMissingString([TreatUndefinedAs=Missing] optional DOMString arg);
|
||||
void passOptionalStringWithDefaultValue(optional DOMString arg = "abc");
|
||||
void passOptionalUndefinedMissingStringWithDefaultValue([TreatUndefinedAs=Missing] optional DOMString arg = "abc");
|
||||
void passOptionalNullableString(optional DOMString? arg);
|
||||
void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null);
|
||||
void passVariadicString(DOMString... arg);
|
||||
|
@ -481,6 +479,22 @@ interface TestExampleInterface {
|
|||
void overload7(ByteString arg);
|
||||
void overload8(long arg);
|
||||
void overload8(TestInterface arg);
|
||||
void overload9(long? arg);
|
||||
void overload9(DOMString arg);
|
||||
void overload10(long? arg);
|
||||
void overload10(object arg);
|
||||
void overload11(long arg);
|
||||
void overload11(DOMString? arg);
|
||||
void overload12(long arg);
|
||||
void overload12(boolean? arg);
|
||||
void overload13(long? arg);
|
||||
void overload13(boolean arg);
|
||||
void overload14(optional long arg);
|
||||
void overload14(TestInterface arg);
|
||||
void overload15(long arg);
|
||||
void overload15(optional TestInterface arg);
|
||||
void overload16(long arg);
|
||||
void overload16(optional TestInterface? arg);
|
||||
|
||||
// Variadic handling
|
||||
void passVariadicThirdArg(DOMString arg1, long arg2, TestInterface... arg3);
|
||||
|
|
|
@ -35,9 +35,9 @@ interface TestJSImplInterface {
|
|||
void passByte(byte arg);
|
||||
byte receiveByte();
|
||||
void passOptionalByte(optional byte arg);
|
||||
void passOptionalUndefinedMissingByte([TreatUndefinedAs=Missing] optional byte arg);
|
||||
void passOptionalByteBeforeRequired(optional byte arg1, byte arg2);
|
||||
void passOptionalByteWithDefault(optional byte arg = 0);
|
||||
void passOptionalUndefinedMissingByteWithDefault([TreatUndefinedAs=Missing] optional byte arg = 0);
|
||||
void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2);
|
||||
void passNullableByte(byte? arg);
|
||||
void passOptionalNullableByte(optional byte? arg);
|
||||
void passVariadicByte(byte... arg);
|
||||
|
@ -285,9 +285,7 @@ interface TestJSImplInterface {
|
|||
void passString(DOMString arg);
|
||||
void passNullableString(DOMString? arg);
|
||||
void passOptionalString(optional DOMString arg);
|
||||
void passOptionalUndefinedMissingString([TreatUndefinedAs=Missing] optional DOMString arg);
|
||||
void passOptionalStringWithDefaultValue(optional DOMString arg = "abc");
|
||||
void passOptionalUndefinedMissingStringWithDefaultValue([TreatUndefinedAs=Missing] optional DOMString arg = "abc");
|
||||
void passOptionalNullableString(optional DOMString? arg);
|
||||
void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null);
|
||||
void passVariadicString(DOMString... arg);
|
||||
|
@ -509,6 +507,22 @@ interface TestJSImplInterface {
|
|||
void overload7(ByteString arg);
|
||||
void overload8(long arg);
|
||||
void overload8(TestJSImplInterface arg);
|
||||
void overload9(long? arg);
|
||||
void overload9(DOMString arg);
|
||||
void overload10(long? arg);
|
||||
void overload10(object arg);
|
||||
void overload11(long arg);
|
||||
void overload11(DOMString? arg);
|
||||
void overload12(long arg);
|
||||
void overload12(boolean? arg);
|
||||
void overload13(long? arg);
|
||||
void overload13(boolean arg);
|
||||
void overload14(optional long arg);
|
||||
void overload14(TestInterface arg);
|
||||
void overload15(long arg);
|
||||
void overload15(optional TestInterface arg);
|
||||
void overload16(long arg);
|
||||
void overload16(optional TestInterface? arg);
|
||||
|
||||
// Variadic handling
|
||||
void passVariadicThirdArg(DOMString arg1, long arg2, TestJSImplInterface... arg3);
|
||||
|
|
|
@ -16,6 +16,7 @@ support-files =
|
|||
[test_bug788369.html]
|
||||
[test_bug852846.html]
|
||||
[test_bug862092.html]
|
||||
[test_cloneAndImportNode.html]
|
||||
[test_defineProperty.html]
|
||||
[test_enums.html]
|
||||
[test_exceptionThrowing.html]
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=882541
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 882541</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 882541 **/
|
||||
var div = document.createElement("div");
|
||||
div.appendChild(document.createElement("span"));
|
||||
|
||||
var div2;
|
||||
|
||||
div2 = div.cloneNode();
|
||||
is(div2.childNodes.length, 1, "cloneNode() should do a deep clone");
|
||||
|
||||
div2 = div.cloneNode(undefined);
|
||||
is(div2.childNodes.length, 0, "cloneNode(undefined) should do a shallow clone");
|
||||
|
||||
div2 = document.importNode(div);
|
||||
is(div2.childNodes.length, 1, "importNode(node) should do a deep import");
|
||||
|
||||
div2 = document.importNode(div, undefined);
|
||||
is(div2.childNodes.length, 0, "cloneNode(undefined) should do a shallow import");
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=882541">Mozilla Bug 882541</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -49,7 +49,6 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include "nsIDocument.h"
|
||||
#include <algorithm>
|
||||
#include "nsContentPermissionHelper.h"
|
||||
|
||||
#include "mozilla/dom/DeviceStorageBinding.h"
|
||||
|
||||
|
@ -1696,14 +1695,17 @@ nsDOMDeviceStorageCursor::GetStorageType(nsAString & aType)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceStorageCursor::GetTypes(nsIArray** aTypes)
|
||||
nsDOMDeviceStorageCursor::GetType(nsACString & aType)
|
||||
{
|
||||
nsCString type;
|
||||
nsresult rv =
|
||||
DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType, type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType,
|
||||
aType);
|
||||
}
|
||||
|
||||
return CreatePermissionArray(type, NS_LITERAL_CSTRING("read"), aTypes);
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceStorageCursor::GetAccess(nsACString & aAccess)
|
||||
{
|
||||
aAccess = NS_LITERAL_CSTRING("read");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2178,10 +2180,8 @@ public:
|
|||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
nsTArray<PermissionRequest> permArray;
|
||||
permArray.AppendElement(PermissionRequest(type, access));
|
||||
child->SendPContentPermissionRequestConstructor(
|
||||
this, permArray, IPC::Principal(mPrincipal));
|
||||
this, type, access, IPC::Principal(mPrincipal));
|
||||
|
||||
Sendprompt();
|
||||
return NS_OK;
|
||||
|
@ -2195,23 +2195,26 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetTypes(nsIArray** aTypes)
|
||||
NS_IMETHOD GetType(nsACString & aType)
|
||||
{
|
||||
nsCString type;
|
||||
nsresult rv =
|
||||
DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType, type);
|
||||
nsresult rv
|
||||
= DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType,
|
||||
aType);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCString access;
|
||||
rv = DeviceStorageTypeChecker::GetAccessForRequest(
|
||||
DeviceStorageRequestType(mRequestType), access);
|
||||
NS_IMETHOD GetAccess(nsACString & aAccess)
|
||||
{
|
||||
nsresult rv = DeviceStorageTypeChecker::GetAccessForRequest(
|
||||
DeviceStorageRequestType(mRequestType), aAccess);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return CreatePermissionArray(type, access, aTypes);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetPrincipal(nsIPrincipal * *aRequestingPrincipal)
|
||||
|
@ -3188,10 +3191,8 @@ nsDOMDeviceStorage::EnumerateInternal(const nsAString& aPath,
|
|||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
nsTArray<PermissionRequest> permArray;
|
||||
permArray.AppendElement(PermissionRequest(type, NS_LITERAL_CSTRING("read")));
|
||||
child->SendPContentPermissionRequestConstructor(r,
|
||||
permArray,
|
||||
child->SendPContentPermissionRequestConstructor(r, type,
|
||||
NS_LITERAL_CSTRING("read"),
|
||||
IPC::Principal(mPrincipal));
|
||||
|
||||
r->Sendprompt();
|
||||
|
|
|
@ -18,17 +18,21 @@ function checkDoc(title, expectedtitle, normalizedtitle) {
|
|||
assert_equals(doc.doctype.systemId, "")
|
||||
assert_equals(doc.documentElement.localName, "html")
|
||||
assert_equals(doc.documentElement.firstChild.localName, "head")
|
||||
assert_equals(doc.documentElement.firstChild.childNodes.length, 1)
|
||||
assert_equals(doc.documentElement.firstChild.firstChild.localName, "title")
|
||||
assert_equals(doc.documentElement.firstChild.firstChild.firstChild.data,
|
||||
expectedtitle)
|
||||
if (title !== undefined) {
|
||||
assert_equals(doc.documentElement.firstChild.childNodes.length, 1)
|
||||
assert_equals(doc.documentElement.firstChild.firstChild.localName, "title")
|
||||
assert_equals(doc.documentElement.firstChild.firstChild.firstChild.data,
|
||||
expectedtitle)
|
||||
} else {
|
||||
assert_equals(doc.documentElement.firstChild.childNodes.length, 0)
|
||||
}
|
||||
assert_equals(doc.documentElement.lastChild.localName, "body")
|
||||
assert_equals(doc.documentElement.lastChild.childNodes.length, 0)
|
||||
})
|
||||
}
|
||||
checkDoc("", "", "")
|
||||
checkDoc(null, "null", "null")
|
||||
checkDoc(undefined, "undefined", "undefined")
|
||||
checkDoc(undefined, "", "")
|
||||
checkDoc("foo bar baz", "foo bar baz", "foo bar baz")
|
||||
checkDoc("foo\t\tbar baz", "foo\t\tbar baz", "foo bar baz")
|
||||
checkDoc("foo\n\nbar baz", "foo\n\nbar baz", "foo bar baz")
|
||||
|
|
|
@ -12,7 +12,7 @@ function checkDoc(title, expectedtitle, normalizedtitle) {
|
|||
}
|
||||
checkDoc("", "", "")
|
||||
checkDoc(null, "null", "null")
|
||||
checkDoc(undefined, "undefined", "undefined")
|
||||
checkDoc(undefined, "", "")
|
||||
checkDoc("foo bar baz", "foo bar baz", "foo bar baz")
|
||||
checkDoc("foo\t\tbar baz", "foo\t\tbar baz", "foo bar baz")
|
||||
checkDoc("foo\n\nbar baz", "foo\n\nbar baz", "foo bar baz")
|
||||
|
|
|
@ -7,13 +7,15 @@
|
|||
interface nsIPrincipal;
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDOMElement;
|
||||
interface nsIArray;
|
||||
|
||||
/**
|
||||
* Interface provides the request type and its access.
|
||||
* Interface allows access to a content to request
|
||||
* permission to perform a privileged operation such as
|
||||
* geolocation.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(384b6cc4-a66b-4bea-98e0-eb10562a9ba4)]
|
||||
interface nsIContentPermissionType : nsISupports {
|
||||
[scriptable, uuid(1de67000-2de8-11e2-81c1-0800200c9a66)]
|
||||
interface nsIContentPermissionRequest : nsISupports {
|
||||
|
||||
/**
|
||||
* The type of the permission request, such as
|
||||
* "geolocation".
|
||||
|
@ -25,22 +27,8 @@ interface nsIContentPermissionType : nsISupports {
|
|||
* "read".
|
||||
*/
|
||||
readonly attribute ACString access;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface allows access to a content to request
|
||||
* permission to perform a privileged operation such as
|
||||
* geolocation.
|
||||
*/
|
||||
[scriptable, uuid(69a39d88-d1c4-4ba9-9b19-bafc7a1bb783)]
|
||||
interface nsIContentPermissionRequest : nsISupports {
|
||||
/**
|
||||
* The array will include the request types. Elements of this array are
|
||||
* nsIContentPermissionType object.
|
||||
*/
|
||||
readonly attribute nsIArray types;
|
||||
|
||||
/*
|
||||
* The principal of the permission request.
|
||||
*/
|
||||
readonly attribute nsIPrincipal principal;
|
||||
|
|
|
@ -383,12 +383,28 @@ ContentChild::SetProcessName(const nsAString& aName)
|
|||
mozilla::ipc::SetThisProcessName(NS_LossyConvertUTF16toASCII(aName).get());
|
||||
}
|
||||
|
||||
const void
|
||||
void
|
||||
ContentChild::GetProcessName(nsAString& aName)
|
||||
{
|
||||
aName.Assign(mProcessName);
|
||||
}
|
||||
|
||||
void
|
||||
ContentChild::GetProcessName(nsACString& aName)
|
||||
{
|
||||
aName.Assign(NS_ConvertUTF16toUTF8(mProcessName));
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
ContentChild::AppendProcessId(nsACString& aName)
|
||||
{
|
||||
if (!aName.IsEmpty()) {
|
||||
aName.AppendLiteral(" ");
|
||||
}
|
||||
unsigned pid = getpid();
|
||||
aName.Append(nsPrintfCString("(pid %u)", pid));
|
||||
}
|
||||
|
||||
void
|
||||
ContentChild::InitXPCOM()
|
||||
{
|
||||
|
@ -469,7 +485,9 @@ ContentChild::RecvPMemoryReportRequestConstructor(PMemoryReportRequestChild* chi
|
|||
|
||||
InfallibleTArray<MemoryReport> reports;
|
||||
|
||||
nsPrintfCString process("Content (%d)", getpid());
|
||||
nsCString process;
|
||||
GetProcessName(process);
|
||||
AppendProcessId(process);
|
||||
|
||||
// Run each reporter. The callback will turn each measurement into a
|
||||
// MemoryReport.
|
||||
|
|
|
@ -75,7 +75,9 @@ public:
|
|||
}
|
||||
|
||||
void SetProcessName(const nsAString& aName);
|
||||
const void GetProcessName(nsAString& aName);
|
||||
void GetProcessName(nsAString& aName);
|
||||
void GetProcessName(nsACString& aName);
|
||||
static void AppendProcessId(nsACString& aName);
|
||||
|
||||
PCompositorChild*
|
||||
AllocPCompositorChild(mozilla::ipc::Transport* aTransport,
|
||||
|
|
|
@ -16,7 +16,6 @@ include protocol PIndexedDB;
|
|||
include DOMTypes;
|
||||
include JavaScriptTypes;
|
||||
include URIParams;
|
||||
include PContentPermission;
|
||||
|
||||
include "gfxMatrix.h";
|
||||
include "FrameMetrics.h";
|
||||
|
@ -210,8 +209,10 @@ parent:
|
|||
* Initiates an asynchronous request for permission for the
|
||||
* provided principal.
|
||||
*
|
||||
* @param aRequests
|
||||
* The array of permissions to request.
|
||||
* @param aType
|
||||
* The type of permission to request.
|
||||
* @param aAccess
|
||||
* Access type. "read" for example.
|
||||
* @param aPrincipal
|
||||
* The principal of the request.
|
||||
*
|
||||
|
@ -219,7 +220,7 @@ parent:
|
|||
* principals that can live in the content process should
|
||||
* provided.
|
||||
*/
|
||||
PContentPermissionRequest(PermissionRequest[] aRequests, Principal aPrincipal);
|
||||
PContentPermissionRequest(nsCString aType, nsCString aAccess, Principal principal);
|
||||
|
||||
PContentDialog(uint32_t aType, nsCString aName, nsCString aFeatures,
|
||||
int32_t[] aIntParams, nsString[] aStringParams);
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include "mozilla/dom/PContentPermissionRequestChild.h"
|
||||
// Microsoft's API Name hackery sucks
|
||||
// XXXbz Doing this in a header is a gigantic footgun. See
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=932421#c3 for why.
|
||||
#undef CreateEvent
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/* 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/. */
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
struct PermissionRequest {
|
||||
nsCString type;
|
||||
nsCString access;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -1989,8 +1989,7 @@ TabChild::DeallocPContentDialogChild(PContentDialogChild* aDialog)
|
|||
}
|
||||
|
||||
PContentPermissionRequestChild*
|
||||
TabChild::AllocPContentPermissionRequestChild(const InfallibleTArray<PermissionRequest>& aRequests,
|
||||
const IPC::Principal& aPrincipal)
|
||||
TabChild::AllocPContentPermissionRequestChild(const nsCString& aType, const nsCString& aAccess, const IPC::Principal&)
|
||||
{
|
||||
NS_RUNTIMEABORT("unused");
|
||||
return nullptr;
|
||||
|
|
|
@ -274,17 +274,19 @@ public:
|
|||
|
||||
#ifdef DEBUG
|
||||
virtual PContentPermissionRequestChild* SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
||||
const InfallibleTArray<PermissionRequest>& aRequests,
|
||||
const nsCString& aType,
|
||||
const nsCString& aAccess,
|
||||
const IPC::Principal& aPrincipal)
|
||||
{
|
||||
PCOMContentPermissionRequestChild* child = static_cast<PCOMContentPermissionRequestChild*>(aActor);
|
||||
PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aRequests, aPrincipal);
|
||||
PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aType, aAccess, aPrincipal);
|
||||
child->mIPCOpen = true;
|
||||
return request;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
virtual PContentPermissionRequestChild* AllocPContentPermissionRequestChild(const InfallibleTArray<PermissionRequest>& aRequests,
|
||||
virtual PContentPermissionRequestChild* AllocPContentPermissionRequestChild(const nsCString& aType,
|
||||
const nsCString& aAccess,
|
||||
const IPC::Principal& aPrincipal);
|
||||
virtual bool DeallocPContentPermissionRequestChild(PContentPermissionRequestChild* actor);
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "mozilla/BrowserElementParent.h"
|
||||
#include "mozilla/docshell/OfflineCacheUpdateParent.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/ipc/DocumentRendererParent.h"
|
||||
#include "mozilla/layers/CompositorParent.h"
|
||||
|
@ -571,10 +570,9 @@ TabParent::DeallocPDocumentRendererParent(PDocumentRendererParent* actor)
|
|||
}
|
||||
|
||||
PContentPermissionRequestParent*
|
||||
TabParent::AllocPContentPermissionRequestParent(const InfallibleTArray<PermissionRequest>& aRequests,
|
||||
const IPC::Principal& aPrincipal)
|
||||
TabParent::AllocPContentPermissionRequestParent(const nsCString& type, const nsCString& access, const IPC::Principal& principal)
|
||||
{
|
||||
return CreateContentPermissionRequestParent(aRequests, mFrameElement, aPrincipal);
|
||||
return new ContentPermissionRequestParent(type, access, mFrameElement, principal);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -213,8 +213,7 @@ public:
|
|||
virtual bool DeallocPDocumentRendererParent(PDocumentRendererParent* actor);
|
||||
|
||||
virtual PContentPermissionRequestParent*
|
||||
AllocPContentPermissionRequestParent(const InfallibleTArray<PermissionRequest>& aRequests,
|
||||
const IPC::Principal& aPrincipal);
|
||||
AllocPContentPermissionRequestParent(const nsCString& aType, const nsCString& aAccess, const IPC::Principal& aPrincipal);
|
||||
virtual bool DeallocPContentPermissionRequestParent(PContentPermissionRequestParent* actor);
|
||||
|
||||
virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdateParent(
|
||||
|
|
|
@ -64,7 +64,6 @@ IPDL_SOURCES += [
|
|||
'PBrowser.ipdl',
|
||||
'PContent.ipdl',
|
||||
'PContentDialog.ipdl',
|
||||
'PContentPermission.ipdlh',
|
||||
'PContentPermissionRequest.ipdl',
|
||||
'PCrashReporter.ipdl',
|
||||
'PDocumentRenderer.ipdl',
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "MediaEngineWebRTC.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "MediaPermissionGonk.h"
|
||||
#endif
|
||||
|
||||
|
@ -810,6 +810,7 @@ public:
|
|||
, mListener(aListener)
|
||||
, mPrefs(aPrefs)
|
||||
, mDeviceChosen(false)
|
||||
, mBackendChosen(false)
|
||||
, mManager(MediaManager::GetInstance())
|
||||
{}
|
||||
|
||||
|
@ -831,11 +832,15 @@ public:
|
|||
, mListener(aListener)
|
||||
, mPrefs(aPrefs)
|
||||
, mDeviceChosen(false)
|
||||
, mBackendChosen(true)
|
||||
, mBackend(aBackend)
|
||||
, mManager(MediaManager::GetInstance())
|
||||
{}
|
||||
|
||||
~GetUserMediaRunnable() {
|
||||
if (mBackendChosen) {
|
||||
delete mBackend;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHOD
|
||||
|
@ -843,7 +848,10 @@ public:
|
|||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
|
||||
|
||||
mBackend = mManager->GetBackend(mWindowID);
|
||||
// Was a backend provided?
|
||||
if (!mBackendChosen) {
|
||||
mBackend = mManager->GetBackend(mWindowID);
|
||||
}
|
||||
|
||||
// Was a device provided?
|
||||
if (!mDeviceChosen) {
|
||||
|
@ -1030,6 +1038,7 @@ private:
|
|||
MediaEnginePrefs mPrefs;
|
||||
|
||||
bool mDeviceChosen;
|
||||
bool mBackendChosen;
|
||||
|
||||
MediaEngine* mBackend;
|
||||
nsRefPtr<MediaManager> mManager; // get ref to this when creating the runnable
|
||||
|
@ -1247,10 +1256,10 @@ MediaManager::GetUserMedia(JSContext* aCx, bool aPrivileged,
|
|||
// Force MediaManager to startup before we try to access it from other threads
|
||||
// Hack: should init singleton earlier unless it's expensive (mem or CPU)
|
||||
(void) MediaManager::Get();
|
||||
#ifdef MOZ_B2G
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// Initialize MediaPermissionManager before send out any permission request.
|
||||
(void) MediaPermissionManager::GetInstance();
|
||||
#endif //MOZ_B2G
|
||||
#endif //MOZ_WIDGET_GONK
|
||||
}
|
||||
|
||||
// Store the WindowID in a hash table and mark as active. The entry is removed
|
||||
|
@ -1302,7 +1311,7 @@ MediaManager::GetUserMedia(JSContext* aCx, bool aPrivileged,
|
|||
if (c.mFake) {
|
||||
// Fake stream from default backend.
|
||||
gUMRunnable = new GetUserMediaRunnable(c, onSuccess.forget(),
|
||||
onError.forget(), windowID, listener, mPrefs, GetBackend(windowID, true));
|
||||
onError.forget(), windowID, listener, mPrefs, new MediaEngineDefault());
|
||||
} else {
|
||||
// Stream from default device from WebRTC backend.
|
||||
gUMRunnable = new GetUserMediaRunnable(c, onSuccess.forget(),
|
||||
|
@ -1383,26 +1392,22 @@ MediaManager::GetUserMediaDevices(nsPIDOMWindow* aWindow,
|
|||
}
|
||||
|
||||
MediaEngine*
|
||||
MediaManager::GetBackend(uint64_t aWindowId, bool aFake)
|
||||
MediaManager::GetBackend(uint64_t aWindowId)
|
||||
{
|
||||
// Plugin backends as appropriate. The default engine also currently
|
||||
// includes picture support for Android.
|
||||
// This IS called off main-thread.
|
||||
MutexAutoLock lock(mMutex);
|
||||
if (!mBackend) {
|
||||
if (aFake) {
|
||||
mBackend = new MediaEngineDefault();
|
||||
} else {
|
||||
#if defined(MOZ_WEBRTC)
|
||||
#ifndef MOZ_B2G_CAMERA
|
||||
mBackend = new MediaEngineWebRTC();
|
||||
#ifndef MOZ_B2G_CAMERA
|
||||
mBackend = new MediaEngineWebRTC();
|
||||
#else
|
||||
mBackend = new MediaEngineWebRTC(mCameraManager, aWindowId);
|
||||
#endif
|
||||
#else
|
||||
mBackend = new MediaEngineWebRTC(mCameraManager, aWindowId);
|
||||
mBackend = new MediaEngineDefault();
|
||||
#endif
|
||||
#else
|
||||
mBackend = new MediaEngineDefault();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return mBackend;
|
||||
}
|
||||
|
|
|
@ -405,7 +405,7 @@ public:
|
|||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIMEDIAMANAGERSERVICE
|
||||
|
||||
MediaEngine* GetBackend(uint64_t aWindowId = 0, bool aFake = false);
|
||||
MediaEngine* GetBackend(uint64_t aWindowId = 0);
|
||||
StreamListeners *GetWindowListeners(uint64_t aWindowId) {
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only access windowlist on main thread");
|
||||
|
||||
|
@ -469,7 +469,7 @@ private:
|
|||
|
||||
static StaticRefPtr<MediaManager> sSingleton;
|
||||
|
||||
#ifdef MOZ_B2G_CAMERA
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
nsRefPtr<nsDOMCameraManager> mCameraManager;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -20,35 +20,13 @@
|
|||
#include "mozilla/dom/MediaStreamTrackBinding.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
|
||||
#define AUDIO_PERMISSION_NAME "audio-capture"
|
||||
#define VIDEO_PERMISSION_NAME "video-capture"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
static MediaPermissionManager *gMediaPermMgr = nullptr;
|
||||
|
||||
static uint32_t
|
||||
ConvertArrayToPermissionRequest(nsIArray* aSrcArray,
|
||||
nsTArray<PermissionRequest>& aDesArray)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
aSrcArray->GetLength(&len);
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
nsCOMPtr<nsIContentPermissionType> cpt = do_QueryElementAt(aSrcArray, i);
|
||||
nsAutoCString type;
|
||||
nsAutoCString access;
|
||||
cpt->GetType(type);
|
||||
cpt->GetAccess(access);
|
||||
aDesArray.AppendElement(PermissionRequest(type, access));
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
// Helper function for notifying permission granted
|
||||
static nsresult
|
||||
NotifyPermissionAllow(const nsAString &aCallID, nsTArray<nsCOMPtr<nsIMediaDevice> > &aDevices)
|
||||
|
@ -114,7 +92,6 @@ public:
|
|||
|
||||
private:
|
||||
bool mAudio; // Request for audio permission
|
||||
bool mVideo; // Request for video permission
|
||||
nsRefPtr<dom::GetUserMediaRequest> mRequest;
|
||||
nsTArray<nsCOMPtr<nsIMediaDevice> > mDevices; // candiate device list
|
||||
};
|
||||
|
@ -130,7 +107,6 @@ MediaPermissionRequest::MediaPermissionRequest(nsRefPtr<dom::GetUserMediaRequest
|
|||
mRequest->GetConstraints(constraints);
|
||||
|
||||
mAudio = constraints.mAudio;
|
||||
mVideo = constraints.mVideo;
|
||||
|
||||
for (uint32_t i = 0; i < aDevices.Length(); ++i) {
|
||||
nsCOMPtr<nsIMediaDevice> device(aDevices[i]);
|
||||
|
@ -139,34 +115,10 @@ MediaPermissionRequest::MediaPermissionRequest(nsRefPtr<dom::GetUserMediaRequest
|
|||
if (mAudio && deviceType.EqualsLiteral("audio")) {
|
||||
mDevices.AppendElement(device);
|
||||
}
|
||||
if (mVideo && deviceType.EqualsLiteral("video")) {
|
||||
mDevices.AppendElement(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// nsIContentPermissionRequest methods
|
||||
NS_IMETHODIMP
|
||||
MediaPermissionRequest::GetTypes(nsIArray** aTypes)
|
||||
{
|
||||
nsCOMPtr<nsIMutableArray> types = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
if (mAudio) {
|
||||
nsCOMPtr<ContentPermissionType> AudioType =
|
||||
new ContentPermissionType(NS_LITERAL_CSTRING(AUDIO_PERMISSION_NAME),
|
||||
NS_LITERAL_CSTRING("unused"));
|
||||
types->AppendElement(AudioType, false);
|
||||
}
|
||||
if (mVideo) {
|
||||
nsCOMPtr<ContentPermissionType> VideoType =
|
||||
new ContentPermissionType(NS_LITERAL_CSTRING(VIDEO_PERMISSION_NAME),
|
||||
NS_LITERAL_CSTRING("unused"));
|
||||
types->AppendElement(VideoType, false);
|
||||
}
|
||||
NS_IF_ADDREF(*aTypes = types);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MediaPermissionRequest::GetPrincipal(nsIPrincipal **aRequestingPrincipal)
|
||||
{
|
||||
|
@ -182,6 +134,24 @@ MediaPermissionRequest::GetPrincipal(nsIPrincipal **aRequestingPrincipal)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MediaPermissionRequest::GetType(nsACString &aType)
|
||||
{
|
||||
if (mAudio) {
|
||||
aType = AUDIO_PERMISSION_NAME;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MediaPermissionRequest::GetAccess(nsACString &aAccess)
|
||||
{
|
||||
aAccess = "unused";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MediaPermissionRequest::GetWindow(nsIDOMWindow** aRequestingWindow)
|
||||
{
|
||||
|
@ -307,12 +277,13 @@ MediaDeviceSuccessCallback::DoPrompt(nsRefPtr<MediaPermissionRequest> &req)
|
|||
dom::TabChild* child = dom::TabChild::GetFrom(window->GetDocShell());
|
||||
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIArray> typeArray;
|
||||
rv = req->GetTypes(getter_AddRefs(typeArray));
|
||||
nsAutoCString type;
|
||||
rv = req->GetType(type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsTArray<PermissionRequest> permArray;
|
||||
ConvertArrayToPermissionRequest(typeArray, permArray);
|
||||
nsAutoCString access;
|
||||
rv = req->GetAccess(access);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
rv = req->GetPrincipal(getter_AddRefs(principal));
|
||||
|
@ -320,7 +291,8 @@ MediaDeviceSuccessCallback::DoPrompt(nsRefPtr<MediaPermissionRequest> &req)
|
|||
|
||||
req->AddRef();
|
||||
child->SendPContentPermissionRequestConstructor(req,
|
||||
permArray,
|
||||
type,
|
||||
access,
|
||||
IPC::Principal(principal));
|
||||
|
||||
req->Sendprompt();
|
||||
|
|
|
@ -7,9 +7,3 @@ ifdef MOZ_WEBRTC_LEAKING_TESTS
|
|||
MOCHITEST_FILES += \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_B2G_CAMERA
|
||||
MOCHITEST_FILES += \
|
||||
test_getUserMedia_permission.html \
|
||||
$(NULL)
|
||||
endif
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=853356
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>mozGetUserMedia Permission Test</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="head.js"></script>
|
||||
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=853356">Display camera/microphone permission acquisition prompt</a>
|
||||
<script type="application/javascript">
|
||||
var MockPermissionPrompt = SpecialPowers.MockPermissionPrompt;
|
||||
MockPermissionPrompt.init();
|
||||
|
||||
var gCount = 0;
|
||||
var gTests = [
|
||||
{
|
||||
constraints: {video: true, audio: false}
|
||||
}
|
||||
,
|
||||
{
|
||||
constraints: {video: false, audio: true}
|
||||
}
|
||||
,
|
||||
{
|
||||
constraints: {video: true, audio: true},
|
||||
}
|
||||
];
|
||||
|
||||
function gUM(data) {
|
||||
var gum_success = function (stream) {
|
||||
SimpleTest.info("TEST-INFO | Got succss callback for " + JSON.stringify(data.constraints));
|
||||
|
||||
var hasAudioTrack = stream.getAudioTracks().length > 0;
|
||||
var hasVideoTrack = stream.getVideoTracks().length > 0;
|
||||
|
||||
is(data.constraints.audio, hasAudioTrack, "Request audio track:" +
|
||||
data.constraints.audio + " contain audio track:" + hasAudioTrack);
|
||||
is(data.constraints.video, hasVideoTrack, "Request video track:" +
|
||||
data.constraints.video + " contain audio track:" + hasVideoTrack);
|
||||
gCount++;
|
||||
if (gCount < gTests.length) {
|
||||
gUM(gTests[gCount]);
|
||||
} else {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
var gum_fail = function () {
|
||||
ok(false, "permission not granted for " + JSON.stringify(data.constraints));
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.info("TEST-INFO | Call getUserMedia for " + JSON.stringify(data.constraints));
|
||||
navigator.mozGetUserMedia(data.constraints, gum_success, gum_fail);
|
||||
}
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.navigator.permission.disabled", false]]},
|
||||
function () {
|
||||
SpecialPowers.addPermission('video-capture',
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION, document);
|
||||
SpecialPowers.addPermission('audio-capture',
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION, document);
|
||||
|
||||
gUM(gTests[gCount]);
|
||||
});
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -31,6 +31,10 @@
|
|||
#include "GLContext.h"
|
||||
#include "GLContextProvider.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include "MacIOSurfaceImage.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windowsx.h>
|
||||
#include "gfxWindowsPlatform.h"
|
||||
|
@ -713,26 +717,16 @@ PluginInstanceParent::GetImageContainer(ImageContainer** aContainer)
|
|||
|
||||
#ifdef XP_MACOSX
|
||||
if (ioSurface) {
|
||||
ImageFormat format = SHARED_TEXTURE;
|
||||
ImageFormat format = MAC_IOSURFACE;
|
||||
nsRefPtr<Image> image = container->CreateImage(&format, 1);
|
||||
if (!image) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ASSERTION(image->GetFormat() == SHARED_TEXTURE, "Wrong format?");
|
||||
NS_ASSERTION(image->GetFormat() == MAC_IOSURFACE, "Wrong format?");
|
||||
|
||||
SharedTextureImage::Data data;
|
||||
data.mShareType = gl::SameProcess;
|
||||
data.mHandle = GLContextProviderCGL::CreateSharedHandle(data.mShareType,
|
||||
ioSurface,
|
||||
gl::IOSurface);
|
||||
data.mInverted = false;
|
||||
// Use the device pixel size of the IOSurface, since layers handles resolution scaling
|
||||
// already.
|
||||
data.mSize = gfxIntSize(ioSurface->GetDevicePixelWidth(), ioSurface->GetDevicePixelHeight());
|
||||
|
||||
SharedTextureImage* pluginImage = static_cast<SharedTextureImage*>(image.get());
|
||||
pluginImage->SetData(data);
|
||||
MacIOSurfaceImage* pluginImage = static_cast<MacIOSurfaceImage*>(image.get());
|
||||
pluginImage->SetSurface(ioSurface);
|
||||
|
||||
container->SetCurrentImageInTransaction(pluginImage);
|
||||
|
||||
|
|
|
@ -61,8 +61,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
|||
]
|
||||
|
||||
if CONFIG['MOZ_ENABLE_QT']:
|
||||
SOURCES += [
|
||||
GENERATED_SOURCES += [
|
||||
'moc_NestedLoopTimer.cpp',
|
||||
]
|
||||
SOURCES += [
|
||||
'NestedLoopTimer.cpp',
|
||||
]
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче