зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to b2g-inbound
This commit is contained in:
Коммит
8a0fd8f669
|
@ -5,5 +5,7 @@
|
|||
# See http://lldb.llvm.org/troubleshooting.html for more info.
|
||||
settings set target.inline-breakpoint-strategy always
|
||||
|
||||
# Deduce the concrete types of objects and pointers when printing them.
|
||||
# Show the dynamic type of an object when using "expr". This, for example,
|
||||
# will show a variable declared as "nsIFrame *" that points to an nsBlockFrame
|
||||
# object as being of type "nsBlockFrame *" rather than "nsIFrame *".
|
||||
settings set target.prefer-dynamic-value run-target
|
||||
|
|
2
CLOBBER
2
CLOBBER
|
@ -22,4 +22,4 @@
|
|||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 944533 requires clobber to force a Proguard refresh
|
||||
Bug 958185 requires clobber on Android to force a Proguard refresh
|
||||
|
|
|
@ -59,17 +59,17 @@ if a11y_log:
|
|||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../../../content/xbl/src',
|
||||
'../../../ipc/chromium/src',
|
||||
'../../../layout/generic',
|
||||
'../../../layout/style',
|
||||
'../../../layout/svg',
|
||||
'../../../layout/xul',
|
||||
'../../../layout/xul/tree/',
|
||||
'../generic',
|
||||
'../html',
|
||||
'../xpcom',
|
||||
'../xul',
|
||||
'/dom/xbl',
|
||||
'/ipc/chromium/src',
|
||||
'/layout/generic',
|
||||
'/layout/style',
|
||||
'/layout/svg',
|
||||
'/layout/xul',
|
||||
'/layout/xul/tree/',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ENABLE_GTK']:
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "nsIScrollPositionListener.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
|
||||
class nsAccessiblePivot;
|
||||
|
||||
|
|
|
@ -1150,14 +1150,16 @@ window.addEventListener('ContentStart', function ss_onContentStart() {
|
|||
'canvas');
|
||||
var width = window.innerWidth;
|
||||
var height = window.innerHeight;
|
||||
canvas.setAttribute('width', width);
|
||||
canvas.setAttribute('height', height);
|
||||
var scale = window.devicePixelRatio;
|
||||
canvas.setAttribute('width', width * scale);
|
||||
canvas.setAttribute('height', height * scale);
|
||||
|
||||
var context = canvas.getContext('2d');
|
||||
var flags =
|
||||
context.DRAWWINDOW_DRAW_CARET |
|
||||
context.DRAWWINDOW_DRAW_VIEW |
|
||||
context.DRAWWINDOW_USE_WIDGET_LAYERS;
|
||||
context.scale(scale, scale);
|
||||
context.drawWindow(window, 0, 0, width, height,
|
||||
'rgb(255,255,255)', flags);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1387580658000">
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1389295339000">
|
||||
<emItems>
|
||||
<emItem blockID="i454" id="sqlmoz@facebook.com">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
|
@ -53,7 +53,7 @@
|
|||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i224" id="{336D0C35-8A85-403a-B9D2-65C292C39087}">
|
||||
<emItem blockID="i535" id="/^ext@WebexpEnhancedV1alpha[0-9]+\.net$/">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
|
@ -61,8 +61,8 @@
|
|||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i117" id="{ce7e73df-6a44-4028-8079-5927a588c948}">
|
||||
<versionRange minVersion="0" maxVersion="1.0.8" severity="1">
|
||||
<emItem blockID="i506" id="/^ext@bettersurfplus/">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i400" id="{dd6b651f-dfb9-4142-b0bd-09912ad22674}">
|
||||
|
@ -112,10 +112,6 @@
|
|||
<versionRange minVersion="3.4.1" maxVersion="3.4.1.194" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i506" id="ext@bettersurfplus.com">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i100" id="{394DCBA4-1F92-4f8e-8EC9-8D2CB90CB69B}">
|
||||
<versionRange minVersion="2.5.0" maxVersion="2.5.0" severity="1">
|
||||
</versionRange>
|
||||
|
@ -457,6 +453,10 @@
|
|||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i226" id="{462be121-2b54-4218-bf00-b9bf8135b23f}">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i246" id="support@vide1flash2.com">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
</versionRange>
|
||||
|
@ -555,6 +555,10 @@
|
|||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i117" id="{ce7e73df-6a44-4028-8079-5927a588c948}">
|
||||
<versionRange minVersion="0" maxVersion="1.0.8" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i474" id="{906000a4-88d9-4d52-b209-7a772970d91f}">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
</versionRange>
|
||||
|
@ -872,7 +876,7 @@
|
|||
<versionRange minVersion="0" maxVersion="2.1.0.19.99" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i226" id="{462be121-2b54-4218-bf00-b9bf8135b23f}">
|
||||
<emItem blockID="i224" id="{336D0C35-8A85-403a-B9D2-65C292C39087}">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
|
@ -949,6 +953,10 @@
|
|||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i534" id="{f9d03c26-0575-497e-821d-f7956d23e0ca}">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i68" id="flashupdate@adobe.com">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
|
|
|
@ -9,7 +9,7 @@ const gXPInstallObserver = {
|
|||
if (aDocShell == aSoughtShell)
|
||||
return aDocShell;
|
||||
|
||||
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeNode);
|
||||
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem);
|
||||
for (var i = 0; i < node.childCount; ++i) {
|
||||
var docShell = node.getChildAt(i);
|
||||
docShell = this._findChildShell(docShell, aSoughtShell);
|
||||
|
|
|
@ -391,7 +391,7 @@ function findChildShell(aDocument, aDocShell, aSoughtURI) {
|
|||
(aSoughtURI && aSoughtURI.spec == aDocShell.currentURI.spec))
|
||||
return aDocShell;
|
||||
|
||||
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeNode);
|
||||
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem);
|
||||
for (var i = 0; i < node.childCount; ++i) {
|
||||
var docShell = node.getChildAt(i);
|
||||
docShell = findChildShell(aDocument, docShell, aSoughtURI);
|
||||
|
@ -1839,8 +1839,10 @@ function loadURI(uri, referrer, postData, allowThirdPartyFixup) {
|
|||
postData = null;
|
||||
|
||||
var flags = nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
if (allowThirdPartyFixup)
|
||||
if (allowThirdPartyFixup) {
|
||||
flags |= nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
|
||||
flags |= nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
}
|
||||
|
||||
try {
|
||||
gBrowser.loadURIWithFlags(uri, flags, referrer, null, postData);
|
||||
|
@ -5904,8 +5906,9 @@ function WindowIsClosing()
|
|||
* @returns true if closing can proceed, false if it got cancelled.
|
||||
*/
|
||||
function warnAboutClosingWindow() {
|
||||
// Popups aren't considered full browser windows.
|
||||
let isPBWindow = PrivateBrowsingUtils.isWindowPrivate(window);
|
||||
// Popups aren't considered full browser windows; we also ignore private windows.
|
||||
let isPBWindow = PrivateBrowsingUtils.isWindowPrivate(window) &&
|
||||
!PrivateBrowsingUtils.permanentPrivateBrowsing;
|
||||
if (!isPBWindow && !toolbar.visible)
|
||||
return gBrowser.warnAboutClosingTabs(gBrowser.closingTabsEnum.ALL);
|
||||
|
||||
|
|
|
@ -82,7 +82,8 @@ function open()
|
|||
switch (dialog.openWhereList.value) {
|
||||
case "0":
|
||||
var webNav = Components.interfaces.nsIWebNavigation;
|
||||
var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
|
||||
var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
if (!mayInheritPrincipal)
|
||||
flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
|
||||
browser.gBrowser.loadURIWithFlags(url, flags, null, null, postData);
|
||||
|
|
|
@ -1601,8 +1601,10 @@
|
|||
b.userTypedValue = aURI;
|
||||
|
||||
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
if (aAllowThirdPartyFixup)
|
||||
if (aAllowThirdPartyFixup) {
|
||||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
|
||||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
}
|
||||
if (aFromExternal)
|
||||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
|
||||
if (aDisableMCB)
|
||||
|
@ -4480,7 +4482,10 @@
|
|||
} else {
|
||||
// Load in an existing tab.
|
||||
try {
|
||||
this.tabbrowser.getBrowserForTab(tab).loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP);
|
||||
let webNav = Ci.nsIWebNavigation;
|
||||
let flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
this.tabbrowser.getBrowserForTab(tab).loadURIWithFlags(url, flags);
|
||||
if (!bgLoad)
|
||||
this.selectedItem = tab;
|
||||
} catch(ex) {
|
||||
|
|
|
@ -293,7 +293,9 @@
|
|||
}
|
||||
|
||||
function loadCurrent() {
|
||||
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
|
||||
let webnav = Ci.nsIWebNavigation;
|
||||
let flags = webnav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
webnav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
// Pass LOAD_FLAGS_DISALLOW_INHERIT_OWNER to prevent any loads from
|
||||
// inheriting the currently loaded document's principal, unless this
|
||||
// URL is marked as safe to inherit (e.g. came from a bookmark
|
||||
|
|
|
@ -300,8 +300,10 @@ function openLinkIn(url, where, params) {
|
|||
switch (where) {
|
||||
case "current":
|
||||
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
if (aAllowThirdPartyFixup)
|
||||
if (aAllowThirdPartyFixup) {
|
||||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
|
||||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
}
|
||||
if (aDisallowInheritPrincipal)
|
||||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
|
||||
w.gBrowser.loadURIWithFlags(url, flags, aReferrerURI, null, aPostData);
|
||||
|
|
|
@ -54,9 +54,12 @@ function shouldLoadURI(aURI) {
|
|||
|
||||
function resolveURIInternal(aCmdLine, aArgument) {
|
||||
var uri = aCmdLine.resolveURI(aArgument);
|
||||
var urifixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
|
||||
.getService(nsIURIFixup);
|
||||
|
||||
if (!(uri instanceof nsIFileURL)) {
|
||||
return uri;
|
||||
return urifixup.createFixupURI(aArgument,
|
||||
urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -71,9 +74,6 @@ function resolveURIInternal(aCmdLine, aArgument) {
|
|||
// doesn't exist. Try URI fixup heuristics: see bug 290782.
|
||||
|
||||
try {
|
||||
var urifixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
|
||||
.getService(nsIURIFixup);
|
||||
|
||||
uri = urifixup.createFixupURI(aArgument, 0);
|
||||
}
|
||||
catch (e) {
|
||||
|
|
|
@ -58,6 +58,22 @@ this.SessionFile = {
|
|||
write: function (aData) {
|
||||
return SessionFileInternal.write(aData);
|
||||
},
|
||||
/**
|
||||
* Gather telemetry statistics.
|
||||
*
|
||||
*
|
||||
* Most of the work is done off the main thread but there is a main
|
||||
* thread cost involved to send data to the worker thread. This method
|
||||
* should therefore be called only when we know that it will not disrupt
|
||||
* the user's experience, e.g. on idle-daily.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @promise {object} An object holding all the information to be submitted
|
||||
* to Telemetry.
|
||||
*/
|
||||
gatherTelemetry: function(aData) {
|
||||
return SessionFileInternal.gatherTelemetry(aData);
|
||||
},
|
||||
/**
|
||||
* Writes the initial state to disk again only to change the session's load
|
||||
* state. This must only be called once, it will throw an error otherwise.
|
||||
|
@ -122,6 +138,14 @@ let SessionFileInternal = {
|
|||
});
|
||||
},
|
||||
|
||||
gatherTelemetry: function(aStateString) {
|
||||
return Task.spawn(function() {
|
||||
let msg = yield SessionWorker.post("gatherTelemetry", [aStateString]);
|
||||
this._recordTelemetry(msg.telemetry);
|
||||
throw new Task.Result(msg.telemetry);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
write: function (aData) {
|
||||
if (this._isClosed) {
|
||||
return Promise.reject(new Error("SessionFile is closed"));
|
||||
|
@ -177,8 +201,18 @@ let SessionFileInternal = {
|
|||
},
|
||||
|
||||
_recordTelemetry: function(telemetry) {
|
||||
for (let histogramId in telemetry){
|
||||
Telemetry.getHistogramById(histogramId).add(telemetry[histogramId]);
|
||||
for (let id of Object.keys(telemetry)){
|
||||
let value = telemetry[id];
|
||||
let samples = [];
|
||||
if (Array.isArray(value)) {
|
||||
samples.push(...value);
|
||||
} else {
|
||||
samples.push(value);
|
||||
}
|
||||
let histogram = Telemetry.getHistogramById(id);
|
||||
for (let sample of samples) {
|
||||
histogram.add(sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -196,9 +230,12 @@ let SessionWorker = (function () {
|
|||
// Decode any serialized error
|
||||
if (error instanceof PromiseWorker.WorkerError) {
|
||||
throw OS.File.Error.fromMsg(error.data);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
// Extract something meaningful from ErrorEvent
|
||||
if (error instanceof ErrorEvent) {
|
||||
throw new Error(error.message, error.filename, error.lineno);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ const OBSERVING = [
|
|||
"quit-application-requested", "quit-application-granted",
|
||||
"browser-lastwindow-close-granted",
|
||||
"quit-application", "browser:purge-session-history",
|
||||
"browser:purge-domain-data"
|
||||
"browser:purge-domain-data",
|
||||
"gather-telemetry",
|
||||
];
|
||||
|
||||
// XUL Window properties to (re)store
|
||||
|
@ -587,6 +588,9 @@ let SessionStoreInternal = {
|
|||
case "nsPref:changed": // catch pref changes
|
||||
this.onPrefChange(aData);
|
||||
break;
|
||||
case "gather-telemetry":
|
||||
this.onGatherTelemetry();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1457,6 +1461,16 @@ let SessionStoreInternal = {
|
|||
this.saveStateDelayed(aWindow);
|
||||
},
|
||||
|
||||
onGatherTelemetry: function() {
|
||||
// On the first gather-telemetry notification of the session,
|
||||
// gather telemetry data.
|
||||
Services.obs.removeObserver(this, "gather-telemetry");
|
||||
this.fillTabCachesAsynchronously().then(function() {
|
||||
let stateString = SessionStore.getBrowserState();
|
||||
return SessionFile.gatherTelemetry(stateString);
|
||||
});
|
||||
},
|
||||
|
||||
/* ........ nsISessionStore API .............. */
|
||||
|
||||
getBrowserState: function ssi_getBrowserState() {
|
||||
|
|
|
@ -130,6 +130,16 @@ let Agent = {
|
|||
return ret;
|
||||
},
|
||||
|
||||
/**
|
||||
* Extract all sorts of useful statistics from a state string,
|
||||
* for use with Telemetry.
|
||||
*
|
||||
* @return {object}
|
||||
*/
|
||||
gatherTelemetry: function (stateString) {
|
||||
return Statistics.collect(stateString);
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes the session state to disk again but changes session.state to
|
||||
* 'running' before doing so. This is intended to be called only once, shortly
|
||||
|
@ -236,3 +246,144 @@ let Agent = {
|
|||
function isNoSuchFileEx(aReason) {
|
||||
return aReason instanceof OS.File.Error && aReason.becauseNoSuchFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Estimate the number of bytes that a data structure will use on disk
|
||||
* once serialized.
|
||||
*/
|
||||
function getByteLength(str) {
|
||||
return Encoder.encode(JSON.stringify(str)).byteLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tools for gathering statistics on a state string.
|
||||
*/
|
||||
let Statistics = {
|
||||
collect: function(stateString) {
|
||||
let start = Date.now();
|
||||
let TOTAL_PREFIX = "FX_SESSION_RESTORE_TOTAL_";
|
||||
let INDIVIDUAL_PREFIX = "FX_SESSION_RESTORE_INDIVIDUAL_";
|
||||
let SIZE_SUFFIX = "_SIZE_BYTES";
|
||||
|
||||
let state = JSON.parse(stateString);
|
||||
|
||||
// Gather all data
|
||||
let subsets = {};
|
||||
this.gatherSimpleData(state, subsets);
|
||||
this.gatherComplexData(state, subsets);
|
||||
|
||||
// Extract telemetry
|
||||
let telemetry = {};
|
||||
for (let k of Object.keys(subsets)) {
|
||||
let obj = subsets[k];
|
||||
telemetry[TOTAL_PREFIX + k + SIZE_SUFFIX] = getByteLength(obj);
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
let size = obj.map(getByteLength);
|
||||
telemetry[INDIVIDUAL_PREFIX + k + SIZE_SUFFIX] = size;
|
||||
}
|
||||
}
|
||||
|
||||
let stop = Date.now();
|
||||
telemetry["FX_SESSION_RESTORE_EXTRACTING_STATISTICS_DURATION_MS"] = stop - start;
|
||||
return {
|
||||
telemetry: telemetry
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Collect data that doesn't require a recursive walk through the
|
||||
* data structure.
|
||||
*/
|
||||
gatherSimpleData: function(state, subsets) {
|
||||
// The subset of sessionstore.js dealing with open windows
|
||||
subsets.OPEN_WINDOWS = state.windows;
|
||||
|
||||
// The subset of sessionstore.js dealing with closed windows
|
||||
subsets.CLOSED_WINDOWS = state._closedWindows;
|
||||
|
||||
// The subset of sessionstore.js dealing with closed tabs
|
||||
// in open windows
|
||||
subsets.CLOSED_TABS_IN_OPEN_WINDOWS = [];
|
||||
|
||||
// The subset of sessionstore.js dealing with cookies
|
||||
// in both open and closed windows
|
||||
subsets.COOKIES = [];
|
||||
|
||||
for (let winData of state.windows) {
|
||||
let closedTabs = winData._closedTabs || [];
|
||||
subsets.CLOSED_TABS_IN_OPEN_WINDOWS.push(...closedTabs);
|
||||
|
||||
let cookies = winData.cookies || [];
|
||||
subsets.COOKIES.push(...cookies);
|
||||
}
|
||||
|
||||
for (let winData of state._closedWindows) {
|
||||
let cookies = winData.cookies || [];
|
||||
subsets.COOKIES.push(...cookies);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Walk through a data structure, recursively.
|
||||
*
|
||||
* @param {object} root The object from which to start walking.
|
||||
* @param {function(key, value)} cb Callback, called for each
|
||||
* item except the root. Returns |true| to walk the subtree rooted
|
||||
* at |value|, |false| otherwise */
|
||||
walk: function(root, cb) {
|
||||
if (!root || typeof root !== "object") {
|
||||
return;
|
||||
}
|
||||
for (let k of Object.keys(root)) {
|
||||
let obj = root[k];
|
||||
let stepIn = cb(k, obj);
|
||||
if (stepIn) {
|
||||
this.walk(obj, cb);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Collect data that requires walking through the data structure
|
||||
*/
|
||||
gatherComplexData: function(state, subsets) {
|
||||
// The subset of sessionstore.js dealing with DOM storage
|
||||
subsets.DOM_STORAGE = [];
|
||||
// The subset of sessionstore.js storing form data
|
||||
subsets.FORMDATA = [];
|
||||
// The subset of sessionstore.js storing POST data in history
|
||||
subsets.POSTDATA = [];
|
||||
// The subset of sessionstore.js storing history
|
||||
subsets.HISTORY = [];
|
||||
|
||||
|
||||
this.walk(state, function(k, value) {
|
||||
let dest;
|
||||
switch (k) {
|
||||
case "entries":
|
||||
subsets.HISTORY.push(value);
|
||||
return true;
|
||||
case "storage":
|
||||
subsets.DOM_STORAGE.push(value);
|
||||
// Never visit storage, it's full of weird stuff
|
||||
return false;
|
||||
case "formdata":
|
||||
subsets.FORMDATA.push(value);
|
||||
// Never visit formdata, it's full of weird stuff
|
||||
return false;
|
||||
case "postdata_b64":
|
||||
subsets.POSTDATA.push(value);
|
||||
return false; // Nothing to visit anyway
|
||||
case "cookies": // Don't visit these places, they are full of weird stuff
|
||||
case "extData":
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return subsets;
|
||||
},
|
||||
|
||||
};
|
||||
|
|
|
@ -295,12 +295,8 @@ let TabStateCacheInternal = {
|
|||
for (let key of Object.keys(newData)) {
|
||||
let value = newData[key];
|
||||
if (value === null) {
|
||||
// Remove the field if the value is null.
|
||||
this.removeField(browser, key);
|
||||
delete data[key];
|
||||
} else {
|
||||
// Update the field otherwise.
|
||||
this.updateField(browser, key, value);
|
||||
data[key] = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ support-files =
|
|||
[browser_sessionStorage.js]
|
||||
[browser_swapDocShells.js]
|
||||
[browser_tabStateCache.js]
|
||||
[browser_telemetry.js]
|
||||
[browser_upgrade_backup.js]
|
||||
[browser_windowRestore_perwindowpb.js]
|
||||
[browser_248970_b_perwindowpb.js]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const INITIAL_VALUE = "initial-value-" + Date.now();
|
||||
const INITIAL_VALUE = "browser_broadcast.js-initial-value-" + Date.now();
|
||||
|
||||
/**
|
||||
* This test ensures we won't lose tab data queued in the content script when
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
let Imports = {};
|
||||
Cu.import("resource:///modules/sessionstore/SessionSaver.jsm", Imports);
|
||||
let {SessionSaver} = Imports;
|
||||
let {Task, SessionSaver} = Imports;
|
||||
|
||||
add_task(function cleanup() {
|
||||
info("Forgetting closed tabs");
|
||||
|
|
|
@ -0,0 +1,266 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
|
||||
let tmp = {};
|
||||
Cu.import("resource:///modules/sessionstore/SessionFile.jsm", tmp);
|
||||
Cu.import("resource:///modules/sessionstore/TabStateCache.jsm", tmp);
|
||||
let {SessionFile, TabStateCache} = tmp;
|
||||
|
||||
// Shortcuts for histogram names
|
||||
let Keys = {};
|
||||
for (let k of ["HISTORY", "FORMDATA", "OPEN_WINDOWS", "CLOSED_WINDOWS", "CLOSED_TABS_IN_OPEN_WINDOWS", "DOM_STORAGE", "POSTDATA"]) {
|
||||
Keys[k] = "FX_SESSION_RESTORE_TOTAL_" + k + "_SIZE_BYTES";
|
||||
}
|
||||
|
||||
function lt(a, b, message) {
|
||||
isnot(a, undefined, message + " (sanity check)");
|
||||
isnot(b, undefined, message + " (sanity check)");
|
||||
ok(a < b, message + " ( " + a + " < " + b + ")");
|
||||
}
|
||||
function gt(a, b, message) {
|
||||
isnot(a, undefined, message + " (sanity check)");
|
||||
isnot(b, undefined, message + " (sanity check)");
|
||||
ok(a > b, message + " ( " + a + " > " + b + ")");
|
||||
}
|
||||
|
||||
add_task(function init() {
|
||||
for (let i = ss.getClosedWindowCount() - 1; i >= 0; --i) {
|
||||
ss.forgetClosedWindow(i);
|
||||
}
|
||||
for (let i = ss.getClosedTabCount(window) - 1; i >= 0; --i) {
|
||||
ss.forgetClosedTab(window, i);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Test that Telemetry collection doesn't cause any error.
|
||||
*/
|
||||
add_task(function() {
|
||||
info("Checking a little bit of consistency");
|
||||
let statistics = yield promiseStats();
|
||||
|
||||
for (let k of Object.keys(statistics)) {
|
||||
let data = statistics[k];
|
||||
info("Data for " + k + ": " + data);
|
||||
if (Array.isArray(data)) {
|
||||
ok(data.every(x => x >= 0), "Data for " + k + " is >= 0");
|
||||
} else {
|
||||
ok(data >= 0, "Data for " + k + " is >= 0");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Test HISTORY key.
|
||||
*/
|
||||
add_task(function history() {
|
||||
let KEY = Keys.HISTORY;
|
||||
let tab = gBrowser.addTab("http://example.org:80/?");
|
||||
yield promiseBrowserLoaded(tab.linkedBrowser);
|
||||
try {
|
||||
SyncHandlers.get(tab.linkedBrowser).flush();
|
||||
let statistics = yield promiseStats();
|
||||
|
||||
info("Now changing history");
|
||||
tab.linkedBrowser.contentWindow.history.pushState({foo:1}, "ref");
|
||||
SyncHandlers.get(tab.linkedBrowser).flush();
|
||||
let statistics2 = yield promiseStats();
|
||||
|
||||
// We have changed history, so it must have increased
|
||||
isnot(statistics[KEY], undefined, "Key was defined");
|
||||
isnot(statistics2[KEY], undefined, "Key is still defined");
|
||||
gt(statistics2[KEY], statistics[KEY], "The total size of HISTORY has increased");
|
||||
|
||||
// Almost nothing else should
|
||||
for (let k of ["FORMDATA", "DOM_STORAGE", "CLOSED_WINDOWS", "CLOSED_TABS_IN_OPEN_WINDOWS"]) {
|
||||
is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
|
||||
}
|
||||
} finally {
|
||||
if (tab) {
|
||||
gBrowser.removeTab(tab);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Test CLOSED_TABS_IN_OPEN_WINDOWS key.
|
||||
*/
|
||||
add_task(function close_tab() {
|
||||
let KEY = Keys.CLOSED_TABS_IN_OPEN_WINDOWS;
|
||||
let tab = gBrowser.addTab("http://example.org:80/?close_tab");
|
||||
yield promiseBrowserLoaded(tab.linkedBrowser);
|
||||
try {
|
||||
SyncHandlers.get(tab.linkedBrowser).flush();
|
||||
let statistics = yield promiseStats();
|
||||
|
||||
info("Now closing a tab");
|
||||
gBrowser.removeTab(tab);
|
||||
tab = null;
|
||||
let statistics2 = yield promiseStats();
|
||||
|
||||
isnot(statistics[KEY], undefined, "Key was defined");
|
||||
isnot(statistics2[KEY], undefined, "Key is still defined");
|
||||
gt(statistics2[KEY], statistics[KEY], "The total size of CLOSED_TABS_IN_OPEN_WINDOWS has increased");
|
||||
|
||||
// Almost nothing else should change
|
||||
for (let k of ["FORMDATA", "DOM_STORAGE", "CLOSED_WINDOWS"]) {
|
||||
is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (tab) {
|
||||
gBrowser.removeTab(tab);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Test OPEN_WINDOWS key.
|
||||
*/
|
||||
add_task(function open_window() {
|
||||
let KEY = Keys.OPEN_WINDOWS;
|
||||
let win;
|
||||
try {
|
||||
let statistics = yield promiseStats();
|
||||
win = yield promiseNewWindowLoaded("http://example.org:80/?open_window");
|
||||
let statistics2 = yield promiseStats();
|
||||
|
||||
isnot(statistics[KEY], undefined, "Key was defined");
|
||||
isnot(statistics2[KEY], undefined, "Key is still defined");
|
||||
gt(statistics2[KEY], statistics[KEY], "The total size of OPEN_WINDOWS has increased");
|
||||
|
||||
// Almost nothing else should change
|
||||
for (let k of ["FORMDATA", "DOM_STORAGE", "CLOSED_WINDOWS", "CLOSED_TABS_IN_OPEN_WINDOWS"]) {
|
||||
is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (win) {
|
||||
yield promiseWindowClosed(win);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Test CLOSED_WINDOWS key.
|
||||
*/
|
||||
add_task(function close_window() {
|
||||
let KEY = Keys.CLOSED_WINDOWS;
|
||||
let win = yield promiseNewWindowLoaded("http://example.org:80/?close_window");
|
||||
|
||||
// We need to add something to the window, otherwise it won't be saved
|
||||
let tab = win.gBrowser.addTab("http://example.org:80/?close_tab");
|
||||
yield promiseBrowserLoaded(tab.linkedBrowser);
|
||||
try {
|
||||
let statistics = yield promiseStats();
|
||||
yield promiseWindowClosed(win);
|
||||
win = null;
|
||||
let statistics2 = yield promiseStats();
|
||||
|
||||
isnot(statistics[KEY], undefined, "Key was defined");
|
||||
isnot(statistics2[KEY], undefined, "Key is still defined");
|
||||
gt(statistics2[KEY], statistics[KEY], "The total size of CLOSED_WINDOWS has increased");
|
||||
lt(statistics2[Keys.OPEN_WINDOWS], statistics[Keys.OPEN_WINDOWS], "The total size of OPEN_WINDOWS has decreased");
|
||||
|
||||
// Almost nothing else should change
|
||||
for (let k of ["FORMDATA", "DOM_STORAGE", "CLOSED_TABS_IN_OPEN_WINDOWS"]) {
|
||||
is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (win) {
|
||||
yield promiseWindowClosed(win);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Test DOM_STORAGE key.
|
||||
*/
|
||||
add_task(function dom_storage() {
|
||||
let KEY = Keys.DOM_STORAGE;
|
||||
let tab = gBrowser.addTab("http://example.org:80/?dom_storage");
|
||||
yield promiseBrowserLoaded(tab.linkedBrowser);
|
||||
try {
|
||||
SyncHandlers.get(tab.linkedBrowser).flush();
|
||||
let statistics = yield promiseStats();
|
||||
|
||||
info("Now adding some storage");
|
||||
yield modifySessionStorage(tab.linkedBrowser, {foo: "bar"});
|
||||
SyncHandlers.get(tab.linkedBrowser).flush();
|
||||
|
||||
let statistics2 = yield promiseStats();
|
||||
|
||||
isnot(statistics[KEY], undefined, "Key was defined");
|
||||
isnot(statistics2[KEY], undefined, "Key is still defined");
|
||||
gt(statistics2[KEY], statistics[KEY], "The total size of DOM_STORAGE has increased");
|
||||
|
||||
// Almost nothing else should change
|
||||
for (let k of ["CLOSED_TABS_IN_OPEN_WINDOWS", "FORMDATA", "CLOSED_WINDOWS"]) {
|
||||
is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (tab) {
|
||||
gBrowser.removeTab(tab);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Test FORMDATA key.
|
||||
*/
|
||||
add_task(function formdata() {
|
||||
let KEY = Keys.FORMDATA;
|
||||
let tab = gBrowser.addTab("data:text/html;charset=utf-8,<input%20id='input'>");
|
||||
yield promiseBrowserLoaded(tab.linkedBrowser);
|
||||
try {
|
||||
SyncHandlers.get(tab.linkedBrowser).flush();
|
||||
let statistics = yield promiseStats();
|
||||
|
||||
info("Now changing form data");
|
||||
|
||||
yield modifyFormData(tab.linkedBrowser, {input: "This is some form data "});
|
||||
SyncHandlers.get(tab.linkedBrowser).flush();
|
||||
TabStateCache.delete(tab.linkedBrowser);
|
||||
|
||||
let statistics2 = yield promiseStats();
|
||||
|
||||
isnot(statistics[KEY], undefined, "Key was defined");
|
||||
isnot(statistics2[KEY], undefined, "Key is still defined");
|
||||
gt(statistics2[KEY], statistics[KEY], "The total size of FORMDATA has increased");
|
||||
|
||||
// Almost nothing else should
|
||||
for (let k of ["DOM_STORAGE", "CLOSED_WINDOWS", "CLOSED_TABS_IN_OPEN_WINDOWS"]) {
|
||||
is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
|
||||
}
|
||||
} finally {
|
||||
if (tab) {
|
||||
gBrowser.removeTab(tab);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Get the latest statistics.
|
||||
*/
|
||||
function promiseStats() {
|
||||
let state = ss.getBrowserState();
|
||||
info("Stats: " + state);
|
||||
return SessionFile.gatherTelemetry(state);
|
||||
}
|
||||
|
||||
|
||||
function modifySessionStorage(browser, data) {
|
||||
browser.messageManager.sendAsyncMessage("ss-test:modifySessionStorage", data);
|
||||
return promiseContentMessage(browser, "ss-test:MozStorageChanged");
|
||||
}
|
||||
|
||||
function modifyFormData(browser, data) {
|
||||
browser.messageManager.sendAsyncMessage("ss-test:modifyFormData", data);
|
||||
return promiseContentMessage(browser, "ss-test:modifyFormData:done");
|
||||
}
|
||||
|
|
@ -39,6 +39,13 @@ addMessageListener("ss-test:modifySessionStorage2", function (msg) {
|
|||
}
|
||||
});
|
||||
|
||||
addMessageListener("ss-test:modifyFormData", function (msg) {
|
||||
for (let id of Object.keys(msg.data)) {
|
||||
content.document.getElementById(id).value = msg.data[id];
|
||||
}
|
||||
sendSyncMessage("ss-test:modifyFormData:done");
|
||||
});
|
||||
|
||||
addMessageListener("ss-test:purgeDomainData", function ({data: domain}) {
|
||||
Services.obs.notifyObservers(null, "browser:purge-domain-data", domain);
|
||||
content.setTimeout(() => sendAsyncMessage("ss-test:purgeDomainData"));
|
||||
|
|
|
@ -617,9 +617,9 @@
|
|||
@BINPATH@/browser/chrome.manifest
|
||||
@BINPATH@/browser/chrome/browser@JAREXT@
|
||||
@BINPATH@/browser/chrome/browser.manifest
|
||||
#ifdef NIGHTLY_BUILD
|
||||
@BINPATH@/browser/chrome/pdfjs.manifest
|
||||
@BINPATH@/browser/chrome/pdfjs/*
|
||||
#ifdef NIGHTLY_BUILD
|
||||
@BINPATH@/browser/chrome/shumway.manifest
|
||||
@BINPATH@/browser/chrome/shumway/*
|
||||
#endif
|
||||
|
@ -845,9 +845,9 @@ bin/libfreebl_32int64_3.so
|
|||
#ifdef NIGHTLY_BUILD
|
||||
@BINPATH@/metro/chrome/shumway.manifest
|
||||
@BINPATH@/metro/chrome/shumway/*
|
||||
#endif
|
||||
@BINPATH@/metro/chrome/pdfjs.manifest
|
||||
@BINPATH@/metro/chrome/pdfjs/*
|
||||
#endif
|
||||
@BINPATH@/metro/components
|
||||
@BINPATH@/metro/defaults
|
||||
@BINPATH@/metro/modules
|
||||
|
|
|
@ -368,12 +368,16 @@ var BrowserUI = {
|
|||
|
||||
Task.spawn(function() {
|
||||
let postData = {};
|
||||
let webNav = Ci.nsIWebNavigation;
|
||||
let flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
aURI = yield Browser.getShortcutOrURI(aURI, postData);
|
||||
Browser.loadURI(aURI, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP, postData: postData });
|
||||
Browser.loadURI(aURI, { flags: flags, postData: postData });
|
||||
|
||||
// Delay doing the fixup so the raw URI is passed to loadURIWithFlags
|
||||
// and the proper third-party fixup can be done
|
||||
let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
|
||||
let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP |
|
||||
Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS;
|
||||
let uri = gURIFixup.createFixupURI(aURI, fixupFlags);
|
||||
gHistSvc.markPageAsTyped(uri);
|
||||
|
||||
|
|
|
@ -172,7 +172,10 @@ var Browser = {
|
|||
let self = this;
|
||||
function loadStartupURI() {
|
||||
if (activationURI) {
|
||||
self.addTab(activationURI, true, null, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP });
|
||||
let webNav = Ci.nsIWebNavigation;
|
||||
let flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
self.addTab(activationURI, true, null, { flags: flags });
|
||||
} else {
|
||||
let uri = commandURL || Browser.getHomePage();
|
||||
self.addTab(uri, true);
|
||||
|
|
|
@ -1271,6 +1271,7 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
|
||||
uint32_t flags[] = {
|
||||
nsIURIFixup::FIXUP_FLAG_NONE,
|
||||
nsIURIFixup::FIXUP_FLAG_FIX_SCHEME_TYPOS,
|
||||
nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP,
|
||||
nsIURIFixup::FIXUP_FLAGS_MAKE_ALTERNATE_URI,
|
||||
nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP |
|
||||
|
|
|
@ -14,6 +14,7 @@ interface nsIMessageSender;
|
|||
interface nsIVariant;
|
||||
interface nsIDOMElement;
|
||||
interface nsITabParent;
|
||||
interface nsILoadContext;
|
||||
|
||||
typedef unsigned long long nsContentViewId;
|
||||
|
||||
|
@ -111,7 +112,7 @@ interface nsIContentViewManager : nsISupports
|
|||
readonly attribute nsIContentView rootContentView;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(5b9949dc-56f1-47b6-b6d2-3785bb90ed6d)]
|
||||
[scriptable, builtinclass, uuid(4c9f91c0-7a5d-11e3-981f-0800200c9a66)]
|
||||
interface nsIFrameLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -125,6 +126,13 @@ interface nsIFrameLoader : nsISupports
|
|||
*/
|
||||
readonly attribute nsITabParent tabParent;
|
||||
|
||||
/**
|
||||
* Get an nsILoadContext for the top-level docshell. For remote
|
||||
* frames, a shim is returned that contains private browsing and app
|
||||
* information.
|
||||
*/
|
||||
readonly attribute nsILoadContext loadContext;
|
||||
|
||||
/**
|
||||
* Start loading the frame. This method figures out what to load
|
||||
* from the owner content in the frame loader.
|
||||
|
|
|
@ -197,7 +197,6 @@ LOCAL_INCLUDES += [
|
|||
'/content/events/src',
|
||||
'/content/html/content/src',
|
||||
'/content/html/document/src',
|
||||
'/content/xbl/src',
|
||||
'/content/xml/content/src',
|
||||
'/content/xml/document/src',
|
||||
'/content/xul/content/src',
|
||||
|
@ -206,6 +205,7 @@ LOCAL_INCLUDES += [
|
|||
'/dom/base',
|
||||
'/dom/ipc',
|
||||
'/dom/workers',
|
||||
'/dom/xbl',
|
||||
'/dom/xslt/xpath',
|
||||
'/image/src',
|
||||
'/js/ipc',
|
||||
|
|
|
@ -223,7 +223,7 @@ MarkContentViewer(nsIContentViewer* aViewer, bool aCleanupJS,
|
|||
}
|
||||
}
|
||||
|
||||
void MarkDocShell(nsIDocShellTreeNode* aNode, bool aCleanupJS,
|
||||
void MarkDocShell(nsIDocShellTreeItem* aNode, bool aCleanupJS,
|
||||
bool aPrepareForCC);
|
||||
|
||||
void
|
||||
|
@ -256,7 +256,7 @@ MarkSHEntry(nsISHEntry* aSHEntry, bool aCleanupJS, bool aPrepareForCC)
|
|||
}
|
||||
|
||||
void
|
||||
MarkDocShell(nsIDocShellTreeNode* aNode, bool aCleanupJS, bool aPrepareForCC)
|
||||
MarkDocShell(nsIDocShellTreeItem* aNode, bool aCleanupJS, bool aPrepareForCC)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(aNode);
|
||||
if (!shell) {
|
||||
|
@ -299,8 +299,7 @@ MarkWindowList(nsISimpleEnumerator* aWindowList, bool aCleanupJS,
|
|||
iter) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(iter);
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocShellTreeNode> rootDocShell =
|
||||
do_QueryInterface(window->GetDocShell());
|
||||
nsCOMPtr<nsIDocShell> rootDocShell = window->GetDocShell();
|
||||
|
||||
MarkDocShell(rootDocShell, aCleanupJS, aPrepareForCC);
|
||||
}
|
||||
|
@ -379,8 +378,7 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
if (hw) {
|
||||
nsCOMPtr<nsIDocShell> shell;
|
||||
hw->GetDocShell(getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIDocShellTreeNode> shellTreeNode = do_QueryInterface(shell);
|
||||
MarkDocShell(shellTreeNode, cleanupJS, prepareForCC);
|
||||
MarkDocShell(shell, cleanupJS, prepareForCC);
|
||||
}
|
||||
bool hasHiddenPrivateWindow = false;
|
||||
appShell->GetHasHiddenPrivateWindow(&hasHiddenPrivateWindow);
|
||||
|
@ -389,8 +387,7 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
if (hw) {
|
||||
nsCOMPtr<nsIDocShell> shell;
|
||||
hw->GetDocShell(getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIDocShellTreeNode> shellTreeNode = do_QueryInterface(shell);
|
||||
MarkDocShell(shellTreeNode, cleanupJS, prepareForCC);
|
||||
MarkDocShell(shell, cleanupJS, prepareForCC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5881,14 +5881,13 @@ nsContentUtils::FlushLayoutForTree(nsIDOMWindow* aWindow)
|
|||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode> node =
|
||||
do_QueryInterface(piWin->GetDocShell());
|
||||
if (node) {
|
||||
nsCOMPtr<nsIDocShell> docShell = piWin->GetDocShell();
|
||||
if (docShell) {
|
||||
int32_t i = 0, i_end;
|
||||
node->GetChildCount(&i_end);
|
||||
docShell->GetChildCount(&i_end);
|
||||
for (; i < i_end; ++i) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||
node->GetChildAt(i, getter_AddRefs(item));
|
||||
docShell->GetChildAt(i, getter_AddRefs(item));
|
||||
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
|
||||
if (win) {
|
||||
FlushLayoutForTree(win);
|
||||
|
|
|
@ -713,7 +713,7 @@ bool
|
|||
nsFrameLoader::AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
|
||||
nsIDocShellTreeOwner* aOwner,
|
||||
int32_t aParentType,
|
||||
nsIDocShellTreeNode* aParentNode)
|
||||
nsIDocShell* aParentNode)
|
||||
{
|
||||
NS_PRECONDITION(aItem, "Must have docshell treeitem");
|
||||
NS_PRECONDITION(mOwnerContent, "Must have owning content");
|
||||
|
@ -1571,9 +1571,8 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> container =
|
||||
doc->GetContainer();
|
||||
nsCOMPtr<nsIWebNavigation> parentAsWebNav = do_QueryInterface(container);
|
||||
nsCOMPtr<nsIDocShell> docShell = doc->GetDocShell();
|
||||
nsCOMPtr<nsIWebNavigation> parentAsWebNav = do_QueryInterface(docShell);
|
||||
NS_ENSURE_STATE(parentAsWebNav);
|
||||
|
||||
// Create the docshell...
|
||||
|
@ -1615,53 +1614,41 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
mDocShell->SetName(frameName);
|
||||
}
|
||||
|
||||
// If our container is a web-shell, inform it that it has a new
|
||||
// child. If it's not a web-shell then some things will not operate
|
||||
// properly.
|
||||
// Inform our docShell that it has a new child.
|
||||
// Note: This logic duplicates a lot of logic in
|
||||
// nsSubDocumentFrame::AttributeChanged. We should fix that.
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(parentAsWebNav));
|
||||
if (parentAsNode) {
|
||||
// Note: This logic duplicates a lot of logic in
|
||||
// nsSubDocumentFrame::AttributeChanged. We should fix that.
|
||||
int32_t parentType;
|
||||
docShell->GetItemType(&parentType);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentAsItem =
|
||||
do_QueryInterface(parentAsNode);
|
||||
// XXXbz why is this in content code, exactly? We should handle
|
||||
// this some other way..... Not sure how yet.
|
||||
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
|
||||
docShell->GetTreeOwner(getter_AddRefs(parentTreeOwner));
|
||||
NS_ENSURE_STATE(parentTreeOwner);
|
||||
mIsTopLevelContent =
|
||||
AddTreeItemToTreeOwner(mDocShell, parentTreeOwner, parentType, docShell);
|
||||
|
||||
int32_t parentType;
|
||||
parentAsItem->GetItemType(&parentType);
|
||||
// Make sure all shells have links back to the content element
|
||||
// in the nearest enclosing chrome shell.
|
||||
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
|
||||
|
||||
// XXXbz why is this in content code, exactly? We should handle
|
||||
// this some other way..... Not sure how yet.
|
||||
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
|
||||
parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner));
|
||||
NS_ENSURE_STATE(parentTreeOwner);
|
||||
mIsTopLevelContent =
|
||||
AddTreeItemToTreeOwner(mDocShell, parentTreeOwner, parentType,
|
||||
parentAsNode);
|
||||
if (parentType == nsIDocShellTreeItem::typeChrome) {
|
||||
// Our parent shell is a chrome shell. It is therefore our nearest
|
||||
// enclosing chrome shell.
|
||||
|
||||
// Make sure all shells have links back to the content element
|
||||
// in the nearest enclosing chrome shell.
|
||||
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
|
||||
chromeEventHandler = do_QueryInterface(mOwnerContent);
|
||||
NS_ASSERTION(chromeEventHandler,
|
||||
"This mContent should implement this.");
|
||||
} else {
|
||||
// Our parent shell is a content shell. Get the chrome event
|
||||
// handler from it and use that for our shell as well.
|
||||
|
||||
if (parentType == nsIDocShellTreeItem::typeChrome) {
|
||||
// Our parent shell is a chrome shell. It is therefore our nearest
|
||||
// enclosing chrome shell.
|
||||
|
||||
chromeEventHandler = do_QueryInterface(mOwnerContent);
|
||||
NS_ASSERTION(chromeEventHandler,
|
||||
"This mContent should implement this.");
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShell> parentShell(do_QueryInterface(parentAsNode));
|
||||
|
||||
// Our parent shell is a content shell. Get the chrome event
|
||||
// handler from it and use that for our shell as well.
|
||||
|
||||
parentShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
|
||||
}
|
||||
|
||||
mDocShell->SetChromeEventHandler(chromeEventHandler);
|
||||
docShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
|
||||
}
|
||||
|
||||
mDocShell->SetChromeEventHandler(chromeEventHandler);
|
||||
|
||||
// This is nasty, this code (the do_GetInterface(mDocShell) below)
|
||||
// *must* come *after* the above call to
|
||||
// mDocShell->SetChromeEventHandler() for the global window to get
|
||||
|
@ -2691,3 +2678,18 @@ nsFrameLoader::GetTabParent(nsITabParent** aTabParent)
|
|||
tp.forget(aTabParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetLoadContext(nsILoadContext** aLoadContext)
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
if (mRemoteBrowser) {
|
||||
loadContext = mRemoteBrowser->GetLoadContext();
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
GetDocShell(getter_AddRefs(docShell));
|
||||
loadContext = do_GetInterface(docShell);
|
||||
}
|
||||
loadContext.forget(aLoadContext);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ class AutoResetInShow;
|
|||
class nsITabParent;
|
||||
class nsIDocShellTreeItem;
|
||||
class nsIDocShellTreeOwner;
|
||||
class nsIDocShellTreeNode;
|
||||
class mozIApplication;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -388,7 +387,7 @@ private:
|
|||
bool AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
|
||||
nsIDocShellTreeOwner* aOwner,
|
||||
int32_t aParentType,
|
||||
nsIDocShellTreeNode* aParentNode);
|
||||
nsIDocShell* aParentNode);
|
||||
|
||||
nsIAtom* TypeAttrName() const {
|
||||
return mOwnerContent->IsXUL() ? nsGkAtoms::type : nsGkAtoms::mozframetype;
|
||||
|
|
|
@ -2,23 +2,20 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Test for Content Security Policy Connections</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<iframe style="width:200px;height:200px;" id='cspframe'></iframe>
|
||||
<iframe style="width:200px;height:200px;" id='cspframe2'></iframe>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var path = "/tests/content/base/test/csp/";
|
||||
|
||||
// These are test results: -1 means it hasn't run,
|
||||
// These are test results: -1 means it hasn't run,
|
||||
// true/false is the pass/fail result.
|
||||
window.tests = {
|
||||
img_good: -1,
|
||||
|
@ -55,37 +52,34 @@ window.tests = {
|
|||
object_spec_compliant_bad: -1,
|
||||
};
|
||||
|
||||
|
||||
// This is used to watch the blocked data bounce off CSP and allowed data
|
||||
// This is used to watch the blocked data bounce off CSP and allowed data
|
||||
// get sent out to the wire.
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
SpecialPowers.addObserver(this, "http-on-modify-request", false);
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
|
||||
}
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
// subject should be an nsURI, and should be either allowed or blocked.
|
||||
if (!SpecialPowers.can_QI(subject))
|
||||
return;
|
||||
|
||||
var testpat = new RegExp("testid=([a-z0-9_]+)");
|
||||
|
||||
//_good things better be allowed!
|
||||
//_bad things better be stopped!
|
||||
|
||||
if (topic === "http-on-modify-request") {
|
||||
//these things were allowed by CSP
|
||||
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
|
||||
if (!testpat.test(asciiSpec)) return;
|
||||
var testid = testpat.exec(asciiSpec)[1];
|
||||
// This is a special observer topic that is proxied from
|
||||
// http-on-modify-request in the parent process to inform us when a URI is
|
||||
// loaded
|
||||
if (topic === "specialpowers-http-notify-request") {
|
||||
var uri = data;
|
||||
if (!testpat.test(uri)) return;
|
||||
var testid = testpat.exec(uri)[1];
|
||||
|
||||
window.testResult(testid,
|
||||
/_good/.test(testid),
|
||||
asciiSpec + " allowed by csp");
|
||||
uri + " allowed by csp");
|
||||
}
|
||||
|
||||
if(topic === "csp-on-violate-policy") {
|
||||
//these were blocked... record that they were blocked
|
||||
if (topic === "csp-on-violate-policy") {
|
||||
// these were blocked... record that they were blocked
|
||||
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIURI"), "asciiSpec");
|
||||
if (!testpat.test(asciiSpec)) return;
|
||||
var testid = testpat.exec(asciiSpec)[1];
|
||||
|
@ -95,11 +89,11 @@ examiner.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
// must eventually call this to remove the listener,
|
||||
// must eventually call this to remove the listener,
|
||||
// or mochitests might get borked.
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
SpecialPowers.removeObserver(this, "http-on-modify-request");
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,7 +120,13 @@ window.testResult = function(testname, result, msg) {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{'set':[["security.csp.speccompliant", true]]},
|
||||
{'set':[["security.csp.speccompliant", true],
|
||||
// This defaults to 0 ("preload none") on mobile (B2G/Android), which
|
||||
// blocks loading the resource until the user interacts with a
|
||||
// corresponding widget, which breaks the media_* tests. We set it
|
||||
// back to the default used by desktop Firefox to get consistent
|
||||
// behavior.
|
||||
["media.preload.default", 2]]},
|
||||
function() {
|
||||
// save this for last so that our listeners are registered.
|
||||
// ... this loads the testbed of good and bad requests.
|
||||
|
|
|
@ -26,22 +26,16 @@ window.tests = {
|
|||
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
SpecialPowers.addObserver(this, "http-on-modify-request", false);
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
|
||||
}
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
// subject should be an nsURI, and should be either allowed or blocked.
|
||||
if (!SpecialPowers.can_QI(subject))
|
||||
return;
|
||||
|
||||
var testpat = new RegExp("testid=([a-zA-Z]+)");
|
||||
|
||||
if (topic === "http-on-modify-request") {
|
||||
//these things were allowed by CSP
|
||||
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
|
||||
if (!testpat.test(asciiSpec))
|
||||
return;
|
||||
var testid = testpat.exec(asciiSpec)[1];
|
||||
if (topic === "specialpowers-http-notify-request") {
|
||||
var uri = data;
|
||||
if (!testpat.test(uri)) return;
|
||||
var testid = testpat.exec(uri)[1];
|
||||
window.testResult(testid,
|
||||
/Loaded/.test(testid),
|
||||
"resource loaded");
|
||||
|
@ -70,7 +64,7 @@ examiner.prototype = {
|
|||
// or mochitests might get borked.
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
SpecialPowers.removeObserver(this, "http-on-modify-request");
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,24 +19,20 @@
|
|||
// get sent out to the wire.
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
SpecialPowers.addObserver(this, "http-on-modify-request", false);
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
|
||||
}
|
||||
examiner.prototype = {
|
||||
completedTests: 0,
|
||||
totalTests: 4,
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
// subject should be an nsURI, and should be either allowed or blocked.
|
||||
if (!SpecialPowers.can_QI(subject))
|
||||
return;
|
||||
|
||||
var testpat = new RegExp("testid=([a-z0-9_]+)");
|
||||
|
||||
if (topic === "http-on-modify-request") {
|
||||
//these things were allowed by CSP
|
||||
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
|
||||
if (!testpat.test(asciiSpec)) return;
|
||||
var testid = testpat.exec(asciiSpec)[1];
|
||||
if (topic === "specialpowers-http-notify-request") {
|
||||
// these things were allowed by CSP
|
||||
var uri = data;
|
||||
if (!testpat.test(uri)) return;
|
||||
var testid = testpat.exec(uri)[1];
|
||||
if (testid === "img_bad") {
|
||||
// img_bad should be *allowed* because the policy is report-only
|
||||
ok(true, "Inline scripts should execute (because the policy is report-only)");
|
||||
|
@ -69,7 +65,7 @@ examiner.prototype = {
|
|||
// or mochitests might get borked.
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
SpecialPowers.removeObserver(this, "http-on-modify-request");
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,29 +33,25 @@ window.tests = {
|
|||
// get sent out to the wire.
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
SpecialPowers.addObserver(this, "http-on-modify-request", false);
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
|
||||
}
|
||||
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
// subject should be an nsURI, and should be either allowed or blocked.
|
||||
if (!SpecialPowers.can_QI(subject))
|
||||
return;
|
||||
|
||||
var testpat = new RegExp("testid=([a-z0-9_]+)");
|
||||
|
||||
//_good things better be allowed!
|
||||
//_bad things better be stopped!
|
||||
|
||||
if (topic === "http-on-modify-request") {
|
||||
if (topic === "specialpowers-http-notify-request") {
|
||||
//these things were allowed by CSP
|
||||
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
|
||||
if (!testpat.test(asciiSpec)) return;
|
||||
var testid = testpat.exec(asciiSpec)[1];
|
||||
var uri = data;
|
||||
if (!testpat.test(uri)) return;
|
||||
var testid = testpat.exec(uri)[1];
|
||||
|
||||
window.testResult(testid,
|
||||
/_good/.test(testid),
|
||||
asciiSpec + " allowed by csp");
|
||||
uri + " allowed by csp");
|
||||
}
|
||||
|
||||
if(topic === "csp-on-violate-policy") {
|
||||
|
@ -73,7 +69,7 @@ examiner.prototype = {
|
|||
// or mochitests might get borked.
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
SpecialPowers.removeObserver(this, "http-on-modify-request");
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,16 +2,13 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Test for Content Security Policy "no eval" base restriction</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<iframe style="width:100%;height:300px;" id='cspframe'></iframe>
|
||||
<iframe style="width:100%;height:300px;" id='cspframe2'></iframe>
|
||||
<iframe style="width:100%;height:300px;" id='cspframe3'></iframe>
|
||||
|
@ -23,7 +20,6 @@ var evalScriptsThatRan = 0;
|
|||
var evalScriptsBlocked = 0;
|
||||
var evalScriptsTotal = 24;
|
||||
|
||||
|
||||
// called by scripts that run
|
||||
var scriptRan = function(shouldrun, testname, data) {
|
||||
evalScriptsThatRan++;
|
||||
|
|
|
@ -2,16 +2,13 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Test for Content Security Policy "no eval" in crypto.getCRMFRequest()</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<iframe style="width:100%;height:300px;" id='cspframe'></iframe>
|
||||
<iframe style="width:100%;height:300px;" id='cspframe2'></iframe>
|
||||
<iframe style="width:100%;height:300px;" id='cspframe3'></iframe>
|
||||
|
@ -24,7 +21,6 @@ var evalScriptsThatRan = 0;
|
|||
var evalScriptsBlocked = 0;
|
||||
var evalScriptsTotal = 4;
|
||||
|
||||
|
||||
// called by scripts that run
|
||||
var scriptRan = function(shouldrun, testname, data) {
|
||||
evalScriptsThatRan++;
|
||||
|
@ -39,7 +35,6 @@ var scriptBlocked = function(shouldrun, testname, data) {
|
|||
checkTestResults();
|
||||
}
|
||||
|
||||
|
||||
// Check to see if all the tests have run
|
||||
var checkTestResults = function() {
|
||||
// if any test is incomplete, keep waiting
|
||||
|
|
|
@ -2,23 +2,20 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Test for Content Security Policy Frame Ancestors directive</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<iframe style="width:100%;height:300px;" id='cspframe'></iframe>
|
||||
<iframe style="width:100%;height:300px;" id='cspframe2'></iframe>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var path = "/tests/content/base/test/csp/";
|
||||
|
||||
// These are test results: -1 means it hasn't run,
|
||||
// These are test results: -1 means it hasn't run,
|
||||
// true/false is the pass/fail result.
|
||||
var framesThatShouldLoad = {
|
||||
aa_allow: -1, /* innermost frame allows a */
|
||||
|
@ -47,7 +44,7 @@ var framesThatShouldLoad = {
|
|||
|
||||
var expectedViolationsLeft = 14;
|
||||
|
||||
// This is used to watch the blocked data bounce off CSP and allowed data
|
||||
// This is used to watch the blocked data bounce off CSP and allowed data
|
||||
// get sent out to the wire.
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
|
@ -57,7 +54,7 @@ examiner.prototype = {
|
|||
// subject should be an nsURI, and should be either allowed or blocked.
|
||||
if (!SpecialPowers.can_QI(subject))
|
||||
return;
|
||||
|
||||
|
||||
if (topic === "csp-on-violate-policy") {
|
||||
//these were blocked... record that they were blocked
|
||||
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIURI"), "asciiSpec");
|
||||
|
@ -65,7 +62,7 @@ examiner.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
// must eventually call this to remove the listener,
|
||||
// must eventually call this to remove the listener,
|
||||
// or mochitests might get borked.
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
|
|
|
@ -24,18 +24,14 @@ var totalTests = 2;
|
|||
// get sent out to the wire.
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
SpecialPowers.addObserver(this, "http-on-modify-request", false);
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
|
||||
}
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
// subject should be an nsURI, and should be either allowed or blocked.
|
||||
if(!SpecialPowers.can_QI(subject))
|
||||
return;
|
||||
|
||||
if (topic === "http-on-modify-request") {
|
||||
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
|
||||
if (asciiSpec == prefixedHeaderImgURL || asciiSpec == unprefixedHeaderImgURL) {
|
||||
is(asciiSpec, unprefixedHeaderImgURL, "Load was allowed - should be allowed by unprefixed header (blocked by prefixed)");
|
||||
if (topic === "specialpowers-http-notify-request") {
|
||||
var allowedUri = data;
|
||||
if (allowedUri == prefixedHeaderImgURL || allowedUri == unprefixedHeaderImgURL) {
|
||||
is(allowedUri, unprefixedHeaderImgURL, "Load was allowed - should be allowed by unprefixed header (blocked by prefixed)");
|
||||
testRan();
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +51,7 @@ examiner.prototype = {
|
|||
// or mochitests might get borked.
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
SpecialPowers.removeObserver(this, "http-on-modify-request");
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,22 +43,16 @@ window.violation_reports = {
|
|||
// get sent out to the wire. This also watches for violation reports to go out.
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
SpecialPowers.addObserver(this, "http-on-modify-request", false);
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
|
||||
}
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
// subject should be an nsURI, and should be either allowed or blocked.
|
||||
if(!SpecialPowers.can_QI(subject))
|
||||
return;
|
||||
|
||||
var testpat = new RegExp("testid=([a-z0-9_]+)");
|
||||
|
||||
if (topic === "http-on-modify-request") {
|
||||
var asciiSpec = SpecialPowers.getPrivilegedProps(
|
||||
SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"),
|
||||
"URI.asciiSpec");
|
||||
if (!testpat.test(asciiSpec)) return;
|
||||
var testid = testpat.exec(asciiSpec)[1];
|
||||
if (topic === "specialpowers-http-notify-request") {
|
||||
var uri = data;
|
||||
if (!testpat.test(uri)) return;
|
||||
var testid = testpat.exec(uri)[1];
|
||||
|
||||
// violation reports don't come through here, but the requested resources do
|
||||
// if the test has already finished, move on. Some things throw multiple
|
||||
|
@ -68,8 +62,8 @@ examiner.prototype = {
|
|||
} catch(e) { return; }
|
||||
|
||||
// these are requests that were allowed by CSP
|
||||
var testid = testpat.exec(asciiSpec)[1];
|
||||
window.testResult(testid, 'allowed', asciiSpec + " allowed by csp");
|
||||
var testid = testpat.exec(uri)[1];
|
||||
window.testResult(testid, 'allowed', uri + " allowed by csp");
|
||||
}
|
||||
|
||||
if(topic === "csp-on-violate-policy") {
|
||||
|
@ -112,7 +106,7 @@ examiner.prototype = {
|
|||
// or mochitests might get borked.
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
SpecialPowers.removeObserver(this, "http-on-modify-request");
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
}
|
||||
window.bug836922examiner = new examiner();
|
||||
|
|
|
@ -9,10 +9,7 @@
|
|||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<iframe style="width:200px;height:200px;" id='cspframe' sandbox="allow-same-origin"></iframe>
|
||||
<iframe style="width:200px;height:200px;" id='cspframe2' sandbox></iframe>
|
||||
<iframe style="width:200px;height:200px;" id='cspframe3' sandbox="allow-same-origin"></iframe>
|
||||
|
@ -96,28 +93,24 @@ function ok_wrapper(result, desc) {
|
|||
// get sent out to the wire.
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
SpecialPowers.addObserver(this, "http-on-modify-request", false);
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
|
||||
}
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
// subject should be an nsURI, and should be either allowed or blocked.
|
||||
if (!SpecialPowers.can_QI(subject))
|
||||
return;
|
||||
|
||||
var testpat = new RegExp("testid=([a-z0-9_]+)");
|
||||
|
||||
//_good things better be allowed!
|
||||
//_bad things better be stopped!
|
||||
|
||||
if (topic === "http-on-modify-request") {
|
||||
if (topic === "specialpowers-http-notify-request") {
|
||||
//these things were allowed by CSP
|
||||
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
|
||||
if (!testpat.test(asciiSpec)) return;
|
||||
var testid = testpat.exec(asciiSpec)[1];
|
||||
var uri = data;
|
||||
if (!testpat.test(uri)) return;
|
||||
var testid = testpat.exec(uri)[1];
|
||||
|
||||
window.testResult(testid,
|
||||
/_good/.test(testid),
|
||||
asciiSpec + " allowed by csp");
|
||||
uri + " allowed by csp");
|
||||
}
|
||||
|
||||
if(topic === "csp-on-violate-policy") {
|
||||
|
@ -135,7 +128,7 @@ examiner.prototype = {
|
|||
// or mochitests might get borked.
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
SpecialPowers.removeObserver(this, "http-on-modify-request");
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ var path = "/tests/content/base/test/csp/";
|
|||
// debugging
|
||||
function log(s) {
|
||||
return;
|
||||
dump("**" + s + "\n");
|
||||
var log = document.getElementById("log");
|
||||
log.textContent = log.textContent+s+"\n";
|
||||
}
|
||||
|
@ -27,26 +28,22 @@ function log(s) {
|
|||
// used to watch if requests are blocked by CSP or allowed through
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
SpecialPowers.addObserver(this, "http-on-modify-request", false);
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
|
||||
}
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
// subject should be an nsURI, and should be either allowed or blocked.
|
||||
if (!SpecialPowers.can_QI(subject))
|
||||
return;
|
||||
|
||||
var testpat = new RegExp("testid=([a-z0-9-]+)");
|
||||
var asciiSpec;
|
||||
var testid;
|
||||
|
||||
if (topic === "http-on-modify-request") {
|
||||
if (topic === "specialpowers-http-notify-request") {
|
||||
// request was sent
|
||||
asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
|
||||
if (!testpat.test(asciiSpec)) return;
|
||||
testid = testpat.exec(asciiSpec)[1];
|
||||
var allowedUri = data;
|
||||
if (!testpat.test(allowedUri)) return;
|
||||
testid = testpat.exec(allowedUri)[1];
|
||||
if (testExpectedResults[testid] == "completed") return;
|
||||
log("allowed: "+asciiSpec);
|
||||
window.testResult(testid, asciiSpec, true);
|
||||
log("allowed: "+allowedUri);
|
||||
window.testResult(testid, allowedUri, true);
|
||||
}
|
||||
|
||||
else if (topic === "csp-on-violate-policy") {
|
||||
|
@ -65,7 +62,7 @@ examiner.prototype = {
|
|||
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
SpecialPowers.removeObserver(this, "http-on-modify-request");
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
}
|
||||
}
|
||||
window.examiner = new examiner();
|
||||
|
@ -132,7 +129,13 @@ var testResult = function(testName, url, result) {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{'set':[["security.csp.speccompliant", true]]},
|
||||
{'set':[["security.csp.speccompliant", true],
|
||||
// This defaults to 0 ("preload none") on mobile (B2G/Android), which
|
||||
// blocks loading the resource until the user interacts with a
|
||||
// corresponding widget, which breaks the media_* tests. We set it
|
||||
// back to the default used by desktop Firefox to get consistent
|
||||
// behavior.
|
||||
["media.preload.default", 2]]},
|
||||
function() {
|
||||
// save this for last so that our listeners are registered.
|
||||
// ... this loads the testbed of good and bad requests.
|
||||
|
|
|
@ -26,25 +26,21 @@ var expectedScriptInlineViolations = 1;
|
|||
|
||||
// This is used to watch the blocked data bounce off CSP
|
||||
function examiner() {
|
||||
SpecialPowers.addObserver(this, "http-on-modify-request", false);
|
||||
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
|
||||
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
|
||||
}
|
||||
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
if (!SpecialPowers.can_QI(subject))
|
||||
return;
|
||||
|
||||
var testid_re = new RegExp("testid=([a-z0-9_]+)");
|
||||
|
||||
//_good things better be allowed!
|
||||
//_bad things better be blocked!
|
||||
|
||||
if (topic === "http-on-modify-request") {
|
||||
// these things were allowed by CSP
|
||||
var allowed_uri = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
|
||||
if (!testid_re.test(allowed_uri)) return;
|
||||
var testid = testid_re.exec(allowed_uri)[1];
|
||||
if (topic === "specialpowers-http-notify-request") {
|
||||
var uri = data;
|
||||
if (!testid_re.test(uri)) return;
|
||||
var testid = testid_re.exec(uri)[1];
|
||||
ok(/_good/.test(testid), "Allowed URI with testid " + testid);
|
||||
ranTests(1);
|
||||
}
|
||||
|
@ -59,6 +55,7 @@ examiner.prototype = {
|
|||
ranTests(1);
|
||||
} catch (e) {
|
||||
// if the subject is blocked inline, data will be a violation msg (defined at the top of contentSecurityPolicy.js)
|
||||
//dump("** exception in csp-on-violate-policy: " + e + "\n");
|
||||
var violation_msg = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsISupportsCString"), "data");
|
||||
if (/Inline Script/.test(violation_msg)) {
|
||||
if (/Inline Script had invalid nonce/.test(violation_msg))
|
||||
|
@ -73,7 +70,7 @@ examiner.prototype = {
|
|||
},
|
||||
// must eventually call this to remove the listener, or mochitests might get borked.
|
||||
remove: function() {
|
||||
SpecialPowers.removeObserver(this, "http-on-modify-request");
|
||||
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
||||
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -642,8 +642,7 @@ test(function test_FrameAncestor_ignores_userpass_bug779918() {
|
|||
.createInstance(Ci.nsIDocShell);
|
||||
docshellparent.setCurrentURI(aParentUri);
|
||||
docshellchild.setCurrentURI(aChildUri);
|
||||
docshellparent.QueryInterface(Ci.nsIDocShellTreeNode)
|
||||
.addChild(docshellchild);
|
||||
docshellparent.addChild(docshellchild);
|
||||
return cspObj.permitsAncestry(docshellchild);
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
mStops =
|
||||
gfx::gfxGradientCache::GetOrCreateGradientStops(aRT,
|
||||
mRawStops,
|
||||
gfx::EXTEND_CLAMP);
|
||||
gfx::ExtendMode::CLAMP);
|
||||
|
||||
return mStops;
|
||||
}
|
||||
|
|
|
@ -250,9 +250,9 @@ public:
|
|||
|
||||
ExtendMode mode;
|
||||
if (state.patternStyles[aStyle]->mRepeat == CanvasPattern::NOREPEAT) {
|
||||
mode = EXTEND_CLAMP;
|
||||
mode = ExtendMode::CLAMP;
|
||||
} else {
|
||||
mode = EXTEND_REPEAT;
|
||||
mode = ExtendMode::REPEAT;
|
||||
}
|
||||
mPattern = new (mSurfacePattern.addr())
|
||||
SurfacePattern(state.patternStyles[aStyle]->mSurface, mode);
|
||||
|
@ -332,7 +332,7 @@ public:
|
|||
|
||||
mTarget =
|
||||
mCtx->mTarget->CreateShadowDrawTarget(IntSize(int32_t(mTempRect.width), int32_t(mTempRect.height)),
|
||||
FORMAT_B8G8R8A8, mSigma);
|
||||
SurfaceFormat::B8G8R8A8, mSigma);
|
||||
|
||||
if (!mTarget) {
|
||||
// XXX - Deal with the situation where our temp size is too big to
|
||||
|
@ -358,6 +358,11 @@ public:
|
|||
mCtx->CurrentState().op);
|
||||
}
|
||||
|
||||
operator DrawTarget*()
|
||||
{
|
||||
return mTarget;
|
||||
}
|
||||
|
||||
DrawTarget* operator->()
|
||||
{
|
||||
return mTarget;
|
||||
|
@ -873,7 +878,7 @@ CanvasRenderingContext2D::EnsureTarget()
|
|||
if (!mForceSoftware && CheckSizeForSkiaGL(size))
|
||||
{
|
||||
glContext = GLContextProvider::CreateOffscreen(gfxIntSize(size.width, size.height),
|
||||
caps, gl::ContextFlagsNone);
|
||||
caps);
|
||||
}
|
||||
|
||||
if (glContext) {
|
||||
|
@ -1130,7 +1135,7 @@ CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
|
|||
SurfaceFormat
|
||||
CanvasRenderingContext2D::GetSurfaceFormat() const
|
||||
{
|
||||
return mOpaque ? FORMAT_B8G8R8X8 : FORMAT_B8G8R8A8;
|
||||
return mOpaque ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::B8G8R8A8;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1381,9 +1386,9 @@ CanvasRenderingContext2D::SetFillRule(const nsAString& aString)
|
|||
FillRule rule;
|
||||
|
||||
if (aString.EqualsLiteral("evenodd"))
|
||||
rule = FILL_EVEN_ODD;
|
||||
rule = FillRule::FILL_EVEN_ODD;
|
||||
else if (aString.EqualsLiteral("nonzero"))
|
||||
rule = FILL_WINDING;
|
||||
rule = FillRule::FILL_WINDING;
|
||||
else
|
||||
return;
|
||||
|
||||
|
@ -1394,9 +1399,9 @@ void
|
|||
CanvasRenderingContext2D::GetFillRule(nsAString& aString)
|
||||
{
|
||||
switch (CurrentState().fillRule) {
|
||||
case FILL_WINDING:
|
||||
case FillRule::FILL_WINDING:
|
||||
aString.AssignLiteral("nonzero"); break;
|
||||
case FILL_EVEN_ODD:
|
||||
case FillRule::FILL_EVEN_ODD:
|
||||
aString.AssignLiteral("evenodd"); break;
|
||||
}
|
||||
}
|
||||
|
@ -1620,9 +1625,9 @@ CanvasRenderingContext2D::StrokeRect(double x, double y, double w,
|
|||
}
|
||||
|
||||
if (!h) {
|
||||
CapStyle cap = CAP_BUTT;
|
||||
if (state.lineJoin == JOIN_ROUND) {
|
||||
cap = CAP_ROUND;
|
||||
CapStyle cap = CapStyle::BUTT;
|
||||
if (state.lineJoin == JoinStyle::ROUND) {
|
||||
cap = CapStyle::ROUND;
|
||||
}
|
||||
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
|
||||
StrokeLine(Point(x, y), Point(x + w, y),
|
||||
|
@ -1637,9 +1642,9 @@ CanvasRenderingContext2D::StrokeRect(double x, double y, double w,
|
|||
}
|
||||
|
||||
if (!w) {
|
||||
CapStyle cap = CAP_BUTT;
|
||||
if (state.lineJoin == JOIN_ROUND) {
|
||||
cap = CAP_ROUND;
|
||||
CapStyle cap = CapStyle::BUTT;
|
||||
if (state.lineJoin == JoinStyle::ROUND) {
|
||||
cap = CapStyle::ROUND;
|
||||
}
|
||||
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
|
||||
StrokeLine(Point(x, y), Point(x, y + h),
|
||||
|
@ -1747,10 +1752,10 @@ void CanvasRenderingContext2D::DrawSystemFocusRing(mozilla::dom::Element& aEleme
|
|||
state.shadowBlur = 0;
|
||||
state.shadowOffset.x = 0;
|
||||
state.shadowOffset.y = 0;
|
||||
state.op = mozilla::gfx::OP_OVER;
|
||||
state.op = mozilla::gfx::CompositionOp::OP_OVER;
|
||||
|
||||
state.lineCap = CAP_BUTT;
|
||||
state.lineJoin = mozilla::gfx::JOIN_MITER_OR_BEVEL;
|
||||
state.lineCap = CapStyle::BUTT;
|
||||
state.lineJoin = mozilla::gfx::JoinStyle::MITER_OR_BEVEL;
|
||||
state.lineWidth = 1;
|
||||
CurrentState().dash.Clear();
|
||||
|
||||
|
@ -1963,7 +1968,7 @@ CanvasRenderingContext2D::EnsureUserSpacePath(const CanvasWindingRule& winding)
|
|||
{
|
||||
FillRule fillRule = CurrentState().fillRule;
|
||||
if(winding == CanvasWindingRule::Evenodd)
|
||||
fillRule = FILL_EVEN_ODD;
|
||||
fillRule = FillRule::FILL_EVEN_ODD;
|
||||
|
||||
if (!mPath && !mPathBuilder && !mDSPathBuilder) {
|
||||
EnsureTarget();
|
||||
|
@ -2840,11 +2845,11 @@ CanvasRenderingContext2D::SetLineCap(const nsAString& capstyle)
|
|||
CapStyle cap;
|
||||
|
||||
if (capstyle.EqualsLiteral("butt")) {
|
||||
cap = CAP_BUTT;
|
||||
cap = CapStyle::BUTT;
|
||||
} else if (capstyle.EqualsLiteral("round")) {
|
||||
cap = CAP_ROUND;
|
||||
cap = CapStyle::ROUND;
|
||||
} else if (capstyle.EqualsLiteral("square")) {
|
||||
cap = CAP_SQUARE;
|
||||
cap = CapStyle::SQUARE;
|
||||
} else {
|
||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||
return;
|
||||
|
@ -2857,13 +2862,13 @@ void
|
|||
CanvasRenderingContext2D::GetLineCap(nsAString& capstyle)
|
||||
{
|
||||
switch (CurrentState().lineCap) {
|
||||
case CAP_BUTT:
|
||||
case CapStyle::BUTT:
|
||||
capstyle.AssignLiteral("butt");
|
||||
break;
|
||||
case CAP_ROUND:
|
||||
case CapStyle::ROUND:
|
||||
capstyle.AssignLiteral("round");
|
||||
break;
|
||||
case CAP_SQUARE:
|
||||
case CapStyle::SQUARE:
|
||||
capstyle.AssignLiteral("square");
|
||||
break;
|
||||
}
|
||||
|
@ -2875,11 +2880,11 @@ CanvasRenderingContext2D::SetLineJoin(const nsAString& joinstyle)
|
|||
JoinStyle j;
|
||||
|
||||
if (joinstyle.EqualsLiteral("round")) {
|
||||
j = JOIN_ROUND;
|
||||
j = JoinStyle::ROUND;
|
||||
} else if (joinstyle.EqualsLiteral("bevel")) {
|
||||
j = JOIN_BEVEL;
|
||||
j = JoinStyle::BEVEL;
|
||||
} else if (joinstyle.EqualsLiteral("miter")) {
|
||||
j = JOIN_MITER_OR_BEVEL;
|
||||
j = JoinStyle::MITER_OR_BEVEL;
|
||||
} else {
|
||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||
return;
|
||||
|
@ -2892,13 +2897,13 @@ void
|
|||
CanvasRenderingContext2D::GetLineJoin(nsAString& joinstyle, ErrorResult& error)
|
||||
{
|
||||
switch (CurrentState().lineJoin) {
|
||||
case JOIN_ROUND:
|
||||
case JoinStyle::ROUND:
|
||||
joinstyle.AssignLiteral("round");
|
||||
break;
|
||||
case JOIN_BEVEL:
|
||||
case JoinStyle::BEVEL:
|
||||
joinstyle.AssignLiteral("bevel");
|
||||
break;
|
||||
case JOIN_MITER_OR_BEVEL:
|
||||
case JoinStyle::MITER_OR_BEVEL:
|
||||
joinstyle.AssignLiteral("miter");
|
||||
break;
|
||||
default:
|
||||
|
@ -3094,14 +3099,17 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
|
|||
CanvasImageCache::Lookup(element, mCanvasElement, &imgSize);
|
||||
}
|
||||
|
||||
nsLayoutUtils::DirectDrawInfo drawInfo;
|
||||
|
||||
if (!srcSurf) {
|
||||
// The canvas spec says that drawImage should draw the first frame
|
||||
// of animated images
|
||||
uint32_t sfeFlags = nsLayoutUtils::SFE_WANT_FIRST_FRAME;
|
||||
// of animated images. We also don't want to rasterize vector images.
|
||||
uint32_t sfeFlags = nsLayoutUtils::SFE_WANT_FIRST_FRAME |
|
||||
nsLayoutUtils::SFE_NO_RASTERIZING_VECTORS;
|
||||
nsLayoutUtils::SurfaceFromElementResult res =
|
||||
nsLayoutUtils::SurfaceFromElement(element, sfeFlags, mTarget);
|
||||
|
||||
if (!res.mSourceSurface) {
|
||||
if (!res.mSourceSurface && !res.mDrawInfo.mImgContainer) {
|
||||
// Spec says to silently do nothing if the element is still loading.
|
||||
if (!res.mIsStillLoading) {
|
||||
error.Throw(NS_ERROR_NOT_AVAILABLE);
|
||||
|
@ -3126,12 +3134,16 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
|
|||
res.mCORSUsed);
|
||||
}
|
||||
|
||||
if (res.mImageRequest) {
|
||||
CanvasImageCache::NotifyDrawImage(element, mCanvasElement, res.mImageRequest,
|
||||
res.mSourceSurface, imgSize);
|
||||
}
|
||||
if (res.mSourceSurface) {
|
||||
if (res.mImageRequest) {
|
||||
CanvasImageCache::NotifyDrawImage(element, mCanvasElement, res.mImageRequest,
|
||||
res.mSourceSurface, imgSize);
|
||||
}
|
||||
|
||||
srcSurf = res.mSourceSurface;
|
||||
srcSurf = res.mSourceSurface;
|
||||
} else {
|
||||
drawInfo = res.mDrawInfo;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_argc == 0) {
|
||||
|
@ -3167,9 +3179,9 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
|
|||
Filter filter;
|
||||
|
||||
if (CurrentState().imageSmoothingEnabled)
|
||||
filter = mgfx::FILTER_LINEAR;
|
||||
filter = mgfx::Filter::LINEAR;
|
||||
else
|
||||
filter = mgfx::FILTER_POINT;
|
||||
filter = mgfx::Filter::POINT;
|
||||
|
||||
mgfx::Rect bounds;
|
||||
|
||||
|
@ -3178,31 +3190,77 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
|
|||
bounds = mTarget->GetTransform().TransformBounds(bounds);
|
||||
}
|
||||
|
||||
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
|
||||
DrawSurface(srcSurf,
|
||||
mgfx::Rect(dx, dy, dw, dh),
|
||||
mgfx::Rect(sx, sy, sw, sh),
|
||||
DrawSurfaceOptions(filter),
|
||||
DrawOptions(CurrentState().globalAlpha, UsedOperation()));
|
||||
if (srcSurf) {
|
||||
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
|
||||
DrawSurface(srcSurf,
|
||||
mgfx::Rect(dx, dy, dw, dh),
|
||||
mgfx::Rect(sx, sy, sw, sh),
|
||||
DrawSurfaceOptions(filter),
|
||||
DrawOptions(CurrentState().globalAlpha, UsedOperation()));
|
||||
} else {
|
||||
DrawDirectlyToCanvas(drawInfo, &bounds, dx, dy, dw, dh,
|
||||
sx, sy, sw, sh, imgSize);
|
||||
}
|
||||
|
||||
RedrawUser(gfxRect(dx, dy, dw, dh));
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::DrawDirectlyToCanvas(
|
||||
const nsLayoutUtils::DirectDrawInfo& image,
|
||||
mgfx::Rect* bounds, double dx, double dy,
|
||||
double dw, double dh, double sx, double sy,
|
||||
double sw, double sh, gfxIntSize imgSize)
|
||||
{
|
||||
gfxMatrix contextMatrix;
|
||||
|
||||
AdjustedTarget tempTarget(this, bounds->IsEmpty() ? nullptr: bounds);
|
||||
|
||||
// get any already existing transforms on the context. Include transformations used for context shadow
|
||||
if (tempTarget) {
|
||||
Matrix matrix = tempTarget->GetTransform();
|
||||
contextMatrix = gfxMatrix(matrix._11, matrix._12, matrix._21,
|
||||
matrix._22, matrix._31, matrix._32);
|
||||
}
|
||||
|
||||
gfxMatrix transformMatrix;
|
||||
transformMatrix.Translate(gfxPoint(sx, sy));
|
||||
if (dw > 0 && dh > 0) {
|
||||
transformMatrix.Scale(sw/dw, sh/dh);
|
||||
}
|
||||
transformMatrix.Translate(gfxPoint(-dx, -dy));
|
||||
|
||||
nsRefPtr<gfxContext> context = new gfxContext(tempTarget);
|
||||
context->SetMatrix(contextMatrix);
|
||||
|
||||
// FLAG_CLAMP is added for increased performance
|
||||
uint32_t modifiedFlags = image.mDrawingFlags | imgIContainer::FLAG_CLAMP;
|
||||
|
||||
nsresult rv = image.mImgContainer->
|
||||
Draw(context, GraphicsFilter::FILTER_GOOD, transformMatrix,
|
||||
gfxRect(gfxPoint(dx, dy), gfxIntSize(dw, dh)),
|
||||
nsIntRect(nsIntPoint(0, 0), gfxIntSize(imgSize.width, imgSize.height)),
|
||||
gfxIntSize(imgSize.width, imgSize.height), nullptr, image.mWhichFrame,
|
||||
modifiedFlags);
|
||||
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
|
||||
#ifdef USE_SKIA_GPU
|
||||
static bool
|
||||
IsStandardCompositeOp(CompositionOp op)
|
||||
{
|
||||
return (op == OP_SOURCE ||
|
||||
op == OP_ATOP ||
|
||||
op == OP_IN ||
|
||||
op == OP_OUT ||
|
||||
op == OP_OVER ||
|
||||
op == OP_DEST_IN ||
|
||||
op == OP_DEST_OUT ||
|
||||
op == OP_DEST_OVER ||
|
||||
op == OP_DEST_ATOP ||
|
||||
op == OP_ADD ||
|
||||
op == OP_XOR);
|
||||
return (op == CompositionOp::OP_SOURCE ||
|
||||
op == CompositionOp::OP_ATOP ||
|
||||
op == CompositionOp::OP_IN ||
|
||||
op == CompositionOp::OP_OUT ||
|
||||
op == CompositionOp::OP_OVER ||
|
||||
op == CompositionOp::OP_DEST_IN ||
|
||||
op == CompositionOp::OP_DEST_OUT ||
|
||||
op == CompositionOp::OP_DEST_OVER ||
|
||||
op == CompositionOp::OP_DEST_ATOP ||
|
||||
op == CompositionOp::OP_ADD ||
|
||||
op == CompositionOp::OP_XOR);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3214,7 +3272,7 @@ CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
|
|||
|
||||
#define CANVAS_OP_TO_GFX_OP(cvsop, op2d) \
|
||||
if (op.EqualsLiteral(cvsop)) \
|
||||
comp_op = OP_##op2d;
|
||||
comp_op = CompositionOp::OP_##op2d;
|
||||
|
||||
CANVAS_OP_TO_GFX_OP("copy", SOURCE)
|
||||
else CANVAS_OP_TO_GFX_OP("source-atop", ATOP)
|
||||
|
@ -3262,7 +3320,7 @@ CanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op,
|
|||
CompositionOp comp_op = CurrentState().op;
|
||||
|
||||
#define CANVAS_OP_TO_GFX_OP(cvsop, op2d) \
|
||||
if (comp_op == OP_##op2d) \
|
||||
if (comp_op == CompositionOp::OP_##op2d) \
|
||||
op.AssignLiteral(cvsop);
|
||||
|
||||
CANVAS_OP_TO_GFX_OP("copy", SOURCE)
|
||||
|
@ -3394,7 +3452,7 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
|
|||
} else if (gfxPlatform::GetPlatform()->SupportsAzureContent()) {
|
||||
drawDT =
|
||||
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(ceil(sw), ceil(sh)),
|
||||
FORMAT_B8G8R8A8);
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
if (!drawDT) {
|
||||
error.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
|
@ -3434,7 +3492,7 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
|
|||
mTarget->CreateSourceSurfaceFromData(img->Data(),
|
||||
IntSize(size.width, size.height),
|
||||
img->Stride(),
|
||||
FORMAT_B8G8R8A8);
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
} else {
|
||||
RefPtr<SourceSurface> snapshot = drawDT->Snapshot();
|
||||
RefPtr<DataSourceSurface> data = snapshot->GetDataSurface();
|
||||
|
@ -3454,8 +3512,8 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
|
|||
mgfx::Rect destRect(0, 0, w, h);
|
||||
mgfx::Rect sourceRect(0, 0, sw, sh);
|
||||
mTarget->DrawSurface(source, destRect, sourceRect,
|
||||
DrawSurfaceOptions(mgfx::FILTER_POINT),
|
||||
DrawOptions(1.0f, OP_SOURCE, AA_NONE));
|
||||
DrawSurfaceOptions(mgfx::Filter::POINT),
|
||||
DrawOptions(1.0f, CompositionOp::OP_SOURCE, AntialiasMode::NONE));
|
||||
mTarget->Flush();
|
||||
} else {
|
||||
mTarget->SetTransform(matrix);
|
||||
|
@ -3733,7 +3791,7 @@ CanvasRenderingContext2D::EnsureErrorTarget()
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(IntSize(1, 1), FORMAT_B8G8R8A8);
|
||||
RefPtr<DrawTarget> errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(IntSize(1, 1), SurfaceFormat::B8G8R8A8);
|
||||
MOZ_ASSERT(errorTarget, "Failed to allocate the error target!");
|
||||
|
||||
sErrorTarget = errorTarget;
|
||||
|
@ -3879,7 +3937,7 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t x, int32_t y, uint32_t w
|
|||
}
|
||||
|
||||
RefPtr<SourceSurface> sourceSurface =
|
||||
mTarget->CreateSourceSurfaceFromData(imgsurf->Data(), IntSize(w, h), imgsurf->Stride(), FORMAT_B8G8R8A8);
|
||||
mTarget->CreateSourceSurfaceFromData(imgsurf->Data(), IntSize(w, h), imgsurf->Stride(), SurfaceFormat::B8G8R8A8);
|
||||
|
||||
// In certain scenarios, requesting larger than 8k image fails. Bug 803568
|
||||
// covers the details of how to run into it, but the full detailed
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "mozilla/gfx/2D.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#include "imgIEncoder.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
class nsGlobalWindow;
|
||||
class nsXULElement;
|
||||
|
@ -579,6 +580,11 @@ protected:
|
|||
double dx, double dy, double dw, double dh,
|
||||
uint8_t optional_argc, mozilla::ErrorResult& error);
|
||||
|
||||
void DrawDirectlyToCanvas(const nsLayoutUtils::DirectDrawInfo& image,
|
||||
mozilla::gfx::Rect* bounds, double dx, double dy,
|
||||
double dw, double dh, double sx, double sy,
|
||||
double sw, double sh, gfxIntSize imgSize);
|
||||
|
||||
nsString& GetFont()
|
||||
{
|
||||
/* will initilize the value if not set, else does nothing */
|
||||
|
@ -693,7 +699,7 @@ protected:
|
|||
{
|
||||
if (NeedToDrawShadow()) {
|
||||
// In this case the shadow rendering will use the operator.
|
||||
return mozilla::gfx::OP_OVER;
|
||||
return mozilla::gfx::CompositionOp::OP_OVER;
|
||||
}
|
||||
|
||||
return CurrentState().op;
|
||||
|
@ -759,10 +765,10 @@ protected:
|
|||
globalAlpha(1.0f),
|
||||
shadowBlur(0.0),
|
||||
dashOffset(0.0f),
|
||||
op(mozilla::gfx::OP_OVER),
|
||||
fillRule(mozilla::gfx::FILL_WINDING),
|
||||
lineCap(mozilla::gfx::CAP_BUTT),
|
||||
lineJoin(mozilla::gfx::JOIN_MITER_OR_BEVEL),
|
||||
op(mozilla::gfx::CompositionOp::OP_OVER),
|
||||
fillRule(mozilla::gfx::FillRule::FILL_WINDING),
|
||||
lineCap(mozilla::gfx::CapStyle::BUTT),
|
||||
lineJoin(mozilla::gfx::JoinStyle::MITER_OR_BEVEL),
|
||||
imageSmoothingEnabled(true)
|
||||
{ }
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ WebGLContext::InitWebGL2()
|
|||
WEBGL_depth_texture,
|
||||
WEBGL_draw_buffers
|
||||
};
|
||||
const GLFeature::Enum sFeatureRequiredArr[] = {
|
||||
const GLFeature sFeatureRequiredArr[] = {
|
||||
GLFeature::blend_minmax,
|
||||
GLFeature::instanced_non_arrays,
|
||||
GLFeature::transform_feedback
|
||||
|
|
|
@ -439,8 +439,6 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
|
|||
#endif
|
||||
bool forceEnabled =
|
||||
Preferences::GetBool("webgl.force-enabled", false);
|
||||
bool useMesaLlvmPipe =
|
||||
Preferences::GetBool("gfx.prefer-mesa-llvmpipe", false);
|
||||
bool disabled =
|
||||
Preferences::GetBool("webgl.disabled", false);
|
||||
bool prefer16bit =
|
||||
|
@ -533,7 +531,7 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
|
|||
|
||||
#ifdef XP_WIN
|
||||
// allow forcing GL and not EGL/ANGLE
|
||||
if (useMesaLlvmPipe || PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL")) {
|
||||
if (PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL")) {
|
||||
preferEGL = false;
|
||||
useANGLE = false;
|
||||
useOpenGL = true;
|
||||
|
@ -555,13 +553,9 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
|
|||
|
||||
// try the default provider, whatever that is
|
||||
if (!gl && useOpenGL) {
|
||||
gl::ContextFlags flag = useMesaLlvmPipe
|
||||
? gl::ContextFlagsMesaLLVMPipe
|
||||
: gl::ContextFlagsNone;
|
||||
gl = gl::GLContextProvider::CreateOffscreen(size, caps, flag);
|
||||
gl = gl::GLContextProvider::CreateOffscreen(size, caps);
|
||||
if (gl && !InitAndValidateGL()) {
|
||||
GenerateWarning("Error during %s initialization",
|
||||
useMesaLlvmPipe ? "Mesa LLVMpipe" : "OpenGL");
|
||||
GenerateWarning("Error during OpenGL initialization");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -1296,7 +1290,7 @@ WebGLContext::MaybeRestoreContext()
|
|||
if (mContextStatus != ContextNotLost || gl == nullptr)
|
||||
return;
|
||||
|
||||
bool isEGL = gl->GetContextType() == gl::ContextTypeEGL,
|
||||
bool isEGL = gl->GetContextType() == gl::GLContextType::EGL,
|
||||
isANGLE = gl->IsANGLE();
|
||||
|
||||
GLContext::ContextResetARB resetStatus = GLContext::CONTEXT_NO_ERROR;
|
||||
|
|
|
@ -1425,6 +1425,8 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
|
|||
JS::NumberValue(uint32_t(LOCAL_GL_SRGB_EXT)) :
|
||||
JS::NumberValue(uint32_t(LOCAL_GL_LINEAR));
|
||||
}
|
||||
break;
|
||||
|
||||
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
|
||||
return JS::NumberValue(uint32_t(LOCAL_GL_RENDERBUFFER));
|
||||
|
||||
|
@ -1432,11 +1434,10 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
|
|||
{
|
||||
return WebGLObjectAsJSValue(cx, fba.Renderbuffer(), rv);
|
||||
}
|
||||
|
||||
default:
|
||||
ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
|
||||
return JS::NullValue();
|
||||
} else if (fba.Texture()) {
|
||||
switch (pname) {
|
||||
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:
|
||||
|
@ -1448,6 +1449,7 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
|
|||
JS::NumberValue(uint32_t(LOCAL_GL_SRGB_EXT)) :
|
||||
JS::NumberValue(uint32_t(LOCAL_GL_LINEAR));
|
||||
}
|
||||
break;
|
||||
|
||||
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
|
||||
return JS::NumberValue(uint32_t(LOCAL_GL_TEXTURE));
|
||||
|
@ -1467,11 +1469,10 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
|
|||
face = 0;
|
||||
return JS::Int32Value(face);
|
||||
}
|
||||
|
||||
default:
|
||||
ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
|
||||
return JS::NullValue();
|
||||
} else {
|
||||
switch (pname) {
|
||||
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
|
||||
|
@ -2151,7 +2152,7 @@ WebGLContext::LinkProgram(WebGLProgram *program)
|
|||
// Bug 750527
|
||||
if (gl->WorkAroundDriverBugs() &&
|
||||
updateInfoSucceeded &&
|
||||
gl->Vendor() == gl::GLContext::VendorNVIDIA)
|
||||
gl->Vendor() == gl::GLVendor::NVIDIA)
|
||||
{
|
||||
if (program == mCurrentProgram)
|
||||
gl->fUseProgram(progname);
|
||||
|
@ -2689,16 +2690,16 @@ WebGLContext::SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromE
|
|||
// texture sources in the first place.
|
||||
|
||||
switch (data->GetFormat()) {
|
||||
case FORMAT_B8G8R8A8:
|
||||
case SurfaceFormat::B8G8R8A8:
|
||||
*format = WebGLTexelFormat::BGRA8; // careful, our ARGB means BGRA
|
||||
break;
|
||||
case FORMAT_B8G8R8X8:
|
||||
case SurfaceFormat::B8G8R8X8:
|
||||
*format = WebGLTexelFormat::BGRX8; // careful, our RGB24 is not tightly packed. Whence BGRX8.
|
||||
break;
|
||||
case FORMAT_A8:
|
||||
case SurfaceFormat::A8:
|
||||
*format = WebGLTexelFormat::A8;
|
||||
break;
|
||||
case FORMAT_R5G6B5:
|
||||
case SurfaceFormat::R5G6B5:
|
||||
*format = WebGLTexelFormat::RGB565;
|
||||
break;
|
||||
default:
|
||||
|
@ -3118,7 +3119,7 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
|||
|
||||
if (gl->WorkAroundDriverBugs()) {
|
||||
#ifdef XP_MACOSX
|
||||
if (gl->Vendor() == gl::GLContext::VendorNVIDIA) {
|
||||
if (gl->Vendor() == gl::GLVendor::NVIDIA) {
|
||||
// Work around bug 890432
|
||||
resources.MaxExpressionComplexity = 1000;
|
||||
}
|
||||
|
@ -3222,12 +3223,12 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
|||
#ifdef XP_MACOSX
|
||||
if (gl->WorkAroundDriverBugs()) {
|
||||
// Work around bug 665578 and bug 769810
|
||||
if (gl->Vendor() == gl::GLContext::VendorATI) {
|
||||
if (gl->Vendor() == gl::GLVendor::ATI) {
|
||||
compileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
|
||||
}
|
||||
|
||||
// Work around bug 735560
|
||||
if (gl->Vendor() == gl::GLContext::VendorIntel) {
|
||||
if (gl->Vendor() == gl::GLVendor::Intel) {
|
||||
compileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -980,7 +980,7 @@ WebGLContext::InitAndValidateGL()
|
|||
|
||||
#ifdef XP_MACOSX
|
||||
if (gl->WorkAroundDriverBugs() &&
|
||||
gl->Vendor() == gl::GLContext::VendorATI) {
|
||||
gl->Vendor() == gl::GLVendor::ATI) {
|
||||
// The Mac ATI driver, in all known OSX version up to and including 10.8,
|
||||
// renders points sprites upside-down. Apple bug 11778921
|
||||
gl->fPointParameterf(LOCAL_GL_POINT_SPRITE_COORD_ORIGIN, LOCAL_GL_LOWER_LEFT);
|
||||
|
|
|
@ -724,7 +724,7 @@ void WebGLContext::Draw_cleanup()
|
|||
}
|
||||
|
||||
if (gl->WorkAroundDriverBugs()) {
|
||||
if (gl->Renderer() == gl::GLContext::RendererTegra) {
|
||||
if (gl->Renderer() == gl::GLRenderer::Tegra) {
|
||||
mDrawCallsSinceLastFlush++;
|
||||
|
||||
if (mDrawCallsSinceLastFlush >= MAX_DRAW_CALLS_SINCE_FLUSH) {
|
||||
|
|
|
@ -195,7 +195,7 @@ WebGLRenderbuffer::GetRenderbufferParameter(GLenum target, GLenum pname) const {
|
|||
case LOCAL_GL_RENDERBUFFER_STENCIL_SIZE: {
|
||||
if (NeedsDepthStencilEmu(mContext->gl, InternalFormatForGL())) {
|
||||
if (gl->WorkAroundDriverBugs() &&
|
||||
gl->Renderer() == GLContext::RendererTegra)
|
||||
gl->Renderer() == GLRenderer::Tegra)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
|
|
@ -1490,11 +1490,11 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
|
|||
ProcessingAccessKeyState aAccessKeyState,
|
||||
int32_t aModifierMask)
|
||||
{
|
||||
nsCOMPtr<nsISupports> pcContainer = aPresContext->GetContainerWeak();
|
||||
nsCOMPtr<nsIDocShell> docShell = aPresContext->GetDocShell();
|
||||
|
||||
// Alt or other accesskey modifier is down, we may need to do an accesskey
|
||||
if (mAccessKeys.Count() > 0 &&
|
||||
aModifierMask == GetAccessModifierMaskFor(pcContainer)) {
|
||||
aModifierMask == GetAccessModifierMaskFor(docShell)) {
|
||||
// Someone registered an accesskey. Find and activate it.
|
||||
nsAutoTArray<uint32_t, 10> accessCharCodes;
|
||||
nsContentUtils::GetAccessKeyCandidates(aEvent, accessCharCodes);
|
||||
|
@ -1508,7 +1508,6 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
|
|||
if (nsEventStatus_eConsumeNoDefault != *aStatus) {
|
||||
// checking all sub docshells
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode> docShell(do_QueryInterface(pcContainer));
|
||||
if (!docShell) {
|
||||
NS_WARNING("no docShellTreeNode for presContext");
|
||||
return;
|
||||
|
@ -1552,7 +1551,6 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
|
|||
|
||||
// bubble up the process to the parent docshell if necessary
|
||||
if (eAccessKeyProcessingDown != aAccessKeyState && nsEventStatus_eConsumeNoDefault != *aStatus) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(pcContainer));
|
||||
if (!docShell) {
|
||||
NS_WARNING("no docShellTreeItem for presContext");
|
||||
return;
|
||||
|
|
|
@ -22,7 +22,6 @@ class nsFrameLoader;
|
|||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIDocShell;
|
||||
class nsIDocShellTreeNode;
|
||||
class nsIDocShellTreeItem;
|
||||
class imgIContainer;
|
||||
class nsDOMDataTransfer;
|
||||
|
|
|
@ -80,31 +80,6 @@ HTMLFrameElement::ParseAttribute(int32_t aNamespaceID,
|
|||
aValue, aResult);
|
||||
}
|
||||
|
||||
void
|
||||
HTMLFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
nsGenericHTMLElement::MapScrollingAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
HTMLFrameElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
sScrollingAttributeMap,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
return FindAttributeDependence(aAttribute, map);
|
||||
}
|
||||
|
||||
nsMapRuleToAttributesFunc
|
||||
HTMLFrameElement::GetAttributeMappingFunction() const
|
||||
{
|
||||
return &MapAttributesIntoRule;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
HTMLFrameElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
|
|
|
@ -37,8 +37,6 @@ public:
|
|||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult) MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
||||
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL API
|
||||
|
|
|
@ -158,7 +158,6 @@ HTMLIFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapScrollingAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
}
|
||||
|
@ -175,7 +174,6 @@ HTMLIFrameElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
|||
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
attributes,
|
||||
sScrollingAttributeMap,
|
||||
sImageAlignAttributeMap,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
@ -220,8 +218,8 @@ HTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
// alreay been updated.
|
||||
mFrameLoader->ApplySandboxFlags(GetSandboxFlags());
|
||||
}
|
||||
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
|
||||
aNotify);
|
||||
return nsGenericHTMLFrameElement::AfterSetAttr(aNameSpaceID, aName, aValue,
|
||||
aNotify);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -171,9 +171,9 @@ LOCAL_INCLUDES += [
|
|||
'/content/events/src',
|
||||
'/content/html/document/src',
|
||||
'/content/media/',
|
||||
'/content/xbl/src',
|
||||
'/content/xul/content/src',
|
||||
'/dom/base',
|
||||
'/dom/xbl',
|
||||
'/editor/libeditor/base',
|
||||
'/editor/libeditor/text',
|
||||
'/editor/txmgr/src',
|
||||
|
|
|
@ -1431,12 +1431,6 @@ nsGenericHTMLElement::sBackgroundColorAttributeMap[] = {
|
|||
{ nullptr }
|
||||
};
|
||||
|
||||
/* static */ const Element::MappedAttributeEntry
|
||||
nsGenericHTMLElement::sScrollingAttributeMap[] = {
|
||||
{ &nsGkAtoms::scrolling },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aRuleData)
|
||||
|
@ -1675,51 +1669,6 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(const nsMappedAttributes* aAtt
|
|||
MapBGColorInto(aAttributes, aData);
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapScrollingAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
if (!(aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)))
|
||||
return;
|
||||
|
||||
// scrolling
|
||||
nsCSSValue* overflowValues[2] = {
|
||||
aData->ValueForOverflowX(),
|
||||
aData->ValueForOverflowY(),
|
||||
};
|
||||
for (uint32_t i = 0; i < ArrayLength(overflowValues); ++i) {
|
||||
if (overflowValues[i]->GetUnit() == eCSSUnit_Null) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::scrolling);
|
||||
if (value && value->Type() == nsAttrValue::eEnum) {
|
||||
int32_t mappedValue;
|
||||
switch (value->GetEnumValue()) {
|
||||
case NS_STYLE_FRAME_ON:
|
||||
case NS_STYLE_FRAME_SCROLL:
|
||||
case NS_STYLE_FRAME_YES:
|
||||
mappedValue = NS_STYLE_OVERFLOW_SCROLL;
|
||||
break;
|
||||
|
||||
case NS_STYLE_FRAME_OFF:
|
||||
case NS_STYLE_FRAME_NOSCROLL:
|
||||
case NS_STYLE_FRAME_NO:
|
||||
mappedValue = NS_STYLE_OVERFLOW_HIDDEN;
|
||||
break;
|
||||
|
||||
case NS_STYLE_FRAME_AUTO:
|
||||
mappedValue = NS_STYLE_OVERFLOW_AUTO;
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_NOTREACHED("unexpected value");
|
||||
mappedValue = NS_STYLE_OVERFLOW_AUTO;
|
||||
break;
|
||||
}
|
||||
overflowValues[i]->SetIntValue(mappedValue, eCSSUnit_Enumerated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -753,7 +753,6 @@ public:
|
|||
static const MappedAttributeEntry sDivAlignAttributeMap[];
|
||||
static const MappedAttributeEntry sBackgroundAttributeMap[];
|
||||
static const MappedAttributeEntry sBackgroundColorAttributeMap[];
|
||||
static const MappedAttributeEntry sScrollingAttributeMap[];
|
||||
|
||||
/**
|
||||
* Helper to map the align attribute into a style struct.
|
||||
|
|
|
@ -7,16 +7,22 @@
|
|||
|
||||
#include "nsGenericHTMLFrameElement.h"
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozIApplication.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "mozIApplication.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScrollable.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -275,6 +281,55 @@ nsGenericHTMLFrameElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */ int32_t
|
||||
nsGenericHTMLFrameElement::MapScrollingAttribute(const nsAttrValue* aValue)
|
||||
{
|
||||
int32_t mappedValue = nsIScrollable::Scrollbar_Auto;
|
||||
if (aValue && aValue->Type() == nsAttrValue::eEnum) {
|
||||
switch (aValue->GetEnumValue()) {
|
||||
case NS_STYLE_FRAME_OFF:
|
||||
case NS_STYLE_FRAME_NOSCROLL:
|
||||
case NS_STYLE_FRAME_NO:
|
||||
mappedValue = nsIScrollable::Scrollbar_Never;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return mappedValue;
|
||||
}
|
||||
|
||||
/* virtual */ nsresult
|
||||
nsGenericHTMLFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
bool aNotify)
|
||||
{
|
||||
if (aName == nsGkAtoms::scrolling && aNameSpaceID == kNameSpaceID_None) {
|
||||
if (mFrameLoader) {
|
||||
nsIDocShell* docshell = mFrameLoader->GetExistingDocShell();
|
||||
nsCOMPtr<nsIScrollable> scrollable = do_QueryInterface(docshell);
|
||||
if (scrollable) {
|
||||
int32_t cur;
|
||||
scrollable->GetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X, &cur);
|
||||
int32_t val = MapScrollingAttribute(aValue);
|
||||
if (cur != val) {
|
||||
scrollable->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X, val);
|
||||
scrollable->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y, val);
|
||||
nsRefPtr<nsPresContext> presContext;
|
||||
docshell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsIPresShell* shell = presContext ? presContext->GetPresShell() : nullptr;
|
||||
nsIFrame* rootScroll = shell ? shell->GetRootScrollFrame() : nullptr;
|
||||
if (rootScroll) {
|
||||
shell->FrameNeedsReflow(rootScroll, nsIPresShell::eStyleChange,
|
||||
NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
|
||||
aNotify);
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLFrameElement::DestroyContent()
|
||||
{
|
||||
|
|
|
@ -61,6 +61,9 @@ public:
|
|||
bool aNotify) MOZ_OVERRIDE;
|
||||
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify) MOZ_OVERRIDE;
|
||||
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
bool aNotify) MOZ_OVERRIDE;
|
||||
virtual void DestroyContent() MOZ_OVERRIDE;
|
||||
|
||||
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
|
||||
|
@ -73,6 +76,17 @@ public:
|
|||
void SwapFrameLoaders(nsXULElement& aOtherOwner, mozilla::ErrorResult& aError);
|
||||
|
||||
static bool BrowserFramesEnabled();
|
||||
|
||||
/**
|
||||
* Helper method to map a HTML 'scrolling' attribute value to a nsIScrollable
|
||||
* enum value. scrolling="no" (and its synonyms) maps to
|
||||
* nsIScrollable::Scrollbar_Never, and anything else (including nullptr) maps
|
||||
* to nsIScrollable::Scrollbar_Auto.
|
||||
* @param aValue the attribute value to map or nullptr
|
||||
* @return nsIScrollable::Scrollbar_Never or nsIScrollable::Scrollbar_Auto
|
||||
*/
|
||||
static int32_t MapScrollingAttribute(const nsAttrValue* aValue);
|
||||
|
||||
protected:
|
||||
// This doesn't really ensure a frame loade in all cases, only when
|
||||
// it makes sense.
|
||||
|
|
|
@ -14,7 +14,6 @@ PARALLEL_DIRS += [
|
|||
'svg',
|
||||
'xml',
|
||||
'xul',
|
||||
'xbl',
|
||||
]
|
||||
|
||||
TEST_TOOL_DIRS += ['test']
|
||||
|
|
|
@ -817,7 +817,7 @@ SVGPathData::ToPathForLengthOrPositionMeasuring() const
|
|||
// pass as aStrokeWidth doesn't matter (since it's only used to determine the
|
||||
// length of those extra little lines).
|
||||
|
||||
return BuildPath(FILL_WINDING, NS_STYLE_STROKE_LINECAP_BUTT, 0);
|
||||
return BuildPath(FillRule::FILL_WINDING, NS_STYLE_STROKE_LINECAP_BUTT, 0);
|
||||
}
|
||||
|
||||
static double
|
||||
|
|
|
@ -252,10 +252,10 @@ LOCAL_INCLUDES += [
|
|||
'/content/base/src',
|
||||
'/content/events/src',
|
||||
'/content/html/content/src',
|
||||
'/content/xbl/src',
|
||||
'/content/xml/content/src',
|
||||
'/dom',
|
||||
'/dom/smil',
|
||||
'/dom/xbl',
|
||||
'/layout/generic',
|
||||
'/layout/style',
|
||||
'/layout/svg',
|
||||
|
|
|
@ -89,7 +89,7 @@ nsSVGPathGeometryElement::CreatePathBuilder()
|
|||
FillRule
|
||||
nsSVGPathGeometryElement::GetFillRule()
|
||||
{
|
||||
FillRule fillRule = FILL_WINDING; // Equivalent to NS_STYLE_FILL_RULE_NONZERO
|
||||
FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to NS_STYLE_FILL_RULE_NONZERO
|
||||
|
||||
nsRefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr,
|
||||
|
@ -102,7 +102,7 @@ nsSVGPathGeometryElement::GetFillRule()
|
|||
NS_STYLE_FILL_RULE_EVENODD);
|
||||
|
||||
if (styleContext->StyleSVG()->mFillRule == NS_STYLE_FILL_RULE_EVENODD) {
|
||||
fillRule = FILL_EVEN_ODD;
|
||||
fillRule = FillRule::FILL_EVEN_ODD;
|
||||
}
|
||||
} else {
|
||||
// ReportToConsole
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=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/.
|
||||
|
||||
PARALLEL_DIRS += ['src', 'builtin']
|
||||
TEST_DIRS += ['test']
|
|
@ -21,9 +21,9 @@ LOCAL_INCLUDES += [
|
|||
'/content/base/src',
|
||||
'/content/events/src',
|
||||
'/content/html/content/src',
|
||||
'/content/xbl/src',
|
||||
'/content/xml/content/src',
|
||||
'/content/xml/document/src',
|
||||
'/dom/xbl',
|
||||
'/layout/generic',
|
||||
'/layout/style',
|
||||
'/layout/xul',
|
||||
|
|
|
@ -24,12 +24,12 @@ MSVC_ENABLE_PGO = True
|
|||
LOCAL_INCLUDES += [
|
||||
'/content/base/src',
|
||||
'/content/events/src',
|
||||
'/content/xbl/src',
|
||||
'/content/xml/document/src',
|
||||
'/content/xul/content/src',
|
||||
'/content/xul/templates/src',
|
||||
'/docshell/base',
|
||||
'/dom/base',
|
||||
'/dom/xbl',
|
||||
'/layout/base',
|
||||
'/layout/generic',
|
||||
'/layout/style',
|
||||
|
|
|
@ -54,6 +54,21 @@ public:
|
|||
#endif
|
||||
{}
|
||||
|
||||
LoadContext(dom::Element* aTopFrameElement,
|
||||
uint32_t aAppId,
|
||||
bool aIsContent,
|
||||
bool aUsePrivateBrowsing,
|
||||
bool aIsInBrowserElement)
|
||||
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
|
||||
, mAppId(aAppId)
|
||||
, mIsContent(aIsContent)
|
||||
, mUsePrivateBrowsing(aUsePrivateBrowsing)
|
||||
, mIsInBrowserElement(aIsInBrowserElement)
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(true)
|
||||
#endif
|
||||
{}
|
||||
|
||||
// Constructor taking reserved appId for the safebrowsing cookie.
|
||||
LoadContext(uint32_t aAppId)
|
||||
: mTopFrameElement(nullptr)
|
||||
|
|
|
@ -15,7 +15,6 @@ XPIDL_SOURCES += [
|
|||
'nsIDocShell.idl',
|
||||
'nsIDocShellLoadInfo.idl',
|
||||
'nsIDocShellTreeItem.idl',
|
||||
'nsIDocShellTreeNode.idl',
|
||||
'nsIDocShellTreeOwner.idl',
|
||||
'nsIDocumentLoaderFactory.idl',
|
||||
'nsIDownloadHistory.idl',
|
||||
|
|
|
@ -974,7 +974,6 @@ NS_IMPL_RELEASE_INHERITED(nsDocShell, nsDocLoader)
|
|||
NS_INTERFACE_MAP_BEGIN(nsDocShell)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocShell)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeItem)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeNode)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebNavigation)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScrollable)
|
||||
|
@ -1584,6 +1583,9 @@ nsDocShell::LoadURI(nsIURI * aURI,
|
|||
if (aLoadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP)
|
||||
flags |= INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
|
||||
|
||||
if (aLoadFlags & LOAD_FLAGS_FIXUP_SCHEME_TYPOS)
|
||||
flags |= INTERNAL_LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
|
||||
if (aLoadFlags & LOAD_FLAGS_FIRST_LOAD)
|
||||
flags |= INTERNAL_LOAD_FLAGS_FIRST_LOAD;
|
||||
|
||||
|
@ -3608,10 +3610,6 @@ nsDocShell::GetIsInUnload(bool* aIsInUnload)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsIDocShellTreeNode
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetChildCount(int32_t * aChildCount)
|
||||
{
|
||||
|
@ -4277,6 +4275,9 @@ nsDocShell::LoadURI(const char16_t * aURI,
|
|||
if (aLoadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
|
||||
fixupFlags |= nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
|
||||
}
|
||||
if (aLoadFlags & LOAD_FLAGS_FIXUP_SCHEME_TYPOS) {
|
||||
fixupFlags |= nsIURIFixup::FIXUP_FLAG_FIX_SCHEME_TYPOS;
|
||||
}
|
||||
nsCOMPtr<nsIInputStream> fixupStream;
|
||||
rv = sURIFixup->CreateFixupURI(uriString, fixupFlags,
|
||||
getter_AddRefs(fixupStream),
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "nsITimer.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIScrollable.h"
|
||||
#include "nsITextScroll.h"
|
||||
|
@ -155,7 +154,6 @@ public:
|
|||
|
||||
NS_DECL_NSIDOCSHELL
|
||||
NS_DECL_NSIDOCSHELLTREEITEM
|
||||
NS_DECL_NSIDOCSHELLTREENODE
|
||||
NS_DECL_NSIWEBNAVIGATION
|
||||
NS_DECL_NSIBASEWINDOW
|
||||
NS_DECL_NSISCROLLABLE
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "nsDocShellEnumerator.h"
|
||||
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
|
||||
nsDocShellEnumerator::nsDocShellEnumerator(int32_t inEnumerationDirection)
|
||||
: mRootItem(nullptr)
|
||||
|
@ -123,8 +122,6 @@ nsresult nsDocShellEnumerator::BuildDocShellArray(nsTArray<nsWeakPtr>& inItemArr
|
|||
nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem* inItem, nsTArray<nsWeakPtr>& inItemArray)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDocShellTreeNode> itemAsNode = do_QueryInterface(inItem, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
int32_t itemType;
|
||||
// add this item to the array
|
||||
|
@ -136,13 +133,13 @@ nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem*
|
|||
}
|
||||
|
||||
int32_t numChildren;
|
||||
rv = itemAsNode->GetChildCount(&numChildren);
|
||||
rv = inItem->GetChildCount(&numChildren);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
for (int32_t i = 0; i < numChildren; ++i)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> curChild;
|
||||
rv = itemAsNode->GetChildAt(i, getter_AddRefs(curChild));
|
||||
rv = inItem->GetChildAt(i, getter_AddRefs(curChild));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = BuildArrayRecursive(curChild, inItemArray);
|
||||
|
@ -156,17 +153,15 @@ nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem*
|
|||
nsresult nsDocShellBackwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem* inItem, nsTArray<nsWeakPtr>& inItemArray)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDocShellTreeNode> itemAsNode = do_QueryInterface(inItem, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
int32_t numChildren;
|
||||
rv = itemAsNode->GetChildCount(&numChildren);
|
||||
rv = inItem->GetChildCount(&numChildren);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
for (int32_t i = numChildren - 1; i >= 0; --i)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> curChild;
|
||||
rv = itemAsNode->GetChildAt(i, getter_AddRefs(curChild));
|
||||
rv = inItem->GetChildAt(i, getter_AddRefs(curChild));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = BuildArrayRecursive(curChild, inItemArray);
|
||||
|
|
|
@ -44,7 +44,7 @@ interface nsIReflowObserver;
|
|||
|
||||
typedef unsigned long nsLoadFlags;
|
||||
|
||||
[scriptable, builtinclass, uuid(55ca6545-7ce4-49ad-8117-8286ca9c61bb)]
|
||||
[scriptable, builtinclass, uuid(e3ea830d-2614-4aeb-9ec3-b8f744b03b80)]
|
||||
interface nsIDocShell : nsIDocShellTreeItem
|
||||
{
|
||||
/**
|
||||
|
@ -111,6 +111,8 @@ interface nsIDocShell : nsIDocShellTreeItem
|
|||
// Whether the load should be treated as srcdoc load, rather than a URI one.
|
||||
const long INTERNAL_LOAD_FLAGS_IS_SRCDOC = 0x40;
|
||||
|
||||
const long INTERNAL_LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x80;
|
||||
|
||||
/**
|
||||
* Loads the given URI. This method is identical to loadURI(...) except
|
||||
* that its parameter list is broken out instead of being packaged inside
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDocShellTreeNode.idl"
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDocShellTreeOwner;
|
||||
|
||||
|
@ -15,8 +15,8 @@ interface nsIDocShellTreeOwner;
|
|||
* node or a leaf.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(e35bbb39-985b-4d62-81da-73c330222e5f)]
|
||||
interface nsIDocShellTreeItem : nsIDocShellTreeNode
|
||||
[scriptable, uuid(cb16a98d-a9e4-4ee2-a450-709b92ad8a89)]
|
||||
interface nsIDocShellTreeItem : nsISupports
|
||||
{
|
||||
/*
|
||||
name of the DocShellTreeItem
|
||||
|
@ -125,5 +125,54 @@ interface nsIDocShellTreeItem : nsIDocShellTreeNode
|
|||
*/
|
||||
readonly attribute nsIDocShellTreeOwner treeOwner;
|
||||
[noscript] void setTreeOwner(in nsIDocShellTreeOwner treeOwner);
|
||||
|
||||
/*
|
||||
The current number of DocShells which are immediate children of the
|
||||
this object.
|
||||
*/
|
||||
readonly attribute long childCount;
|
||||
|
||||
/*
|
||||
Add a new child DocShellTreeItem. Adds to the end of the list.
|
||||
Note that this does NOT take a reference to the child. The child stays
|
||||
alive only as long as it's referenced from outside the docshell tree.
|
||||
@throws NS_ERROR_ILLEGAL_VALUE if child corresponds to the same
|
||||
object as this treenode or an ancestor of this treenode
|
||||
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
|
||||
*/
|
||||
void addChild(in nsIDocShellTreeItem child);
|
||||
|
||||
/*
|
||||
Removes a child DocShellTreeItem.
|
||||
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
|
||||
*/
|
||||
void removeChild(in nsIDocShellTreeItem child);
|
||||
|
||||
/**
|
||||
* Return the child at the index requested. This is 0-based.
|
||||
*
|
||||
* @throws NS_ERROR_UNEXPECTED if the index is out of range
|
||||
*/
|
||||
nsIDocShellTreeItem getChildAt(in long index);
|
||||
|
||||
/*
|
||||
Return the child DocShellTreeItem with the specified name.
|
||||
aName - This is the name of the item that is trying to be found.
|
||||
aRecurse - Is used to tell the function to recurse through children.
|
||||
Note, recursion will only happen through items of the same type.
|
||||
aSameType - If this is set only children of the same type will be returned.
|
||||
aRequestor - This is the docshellTreeItem that is requesting the find. This
|
||||
parameter is used when recursion is being used to avoid searching the same
|
||||
tree again when a child has asked a parent to search for children.
|
||||
aOriginalRequestor - The original treeitem that made the request, if any.
|
||||
This is used to ensure that we don't run into cross-site issues.
|
||||
|
||||
Note the search is depth first when recursing.
|
||||
*/
|
||||
nsIDocShellTreeItem findChildWithName(in wstring aName,
|
||||
in boolean aRecurse,
|
||||
in boolean aSameType,
|
||||
in nsIDocShellTreeItem aRequestor,
|
||||
in nsIDocShellTreeItem aOriginalRequestor);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDocShellTreeItem;
|
||||
|
||||
/**
|
||||
* The nsIDocShellTreeNode supplies the methods for interacting with children
|
||||
* of a docshell. These are essentially the methods that turn a single docshell
|
||||
* into a docshell tree.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Long-term, we probably want to merge this interface into
|
||||
* nsIDocShellTreeItem. Need to eliminate uses of this interface
|
||||
* first.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(37f1ab73-f224-44b1-82f0-d2834ab1cec0)]
|
||||
interface nsIDocShellTreeNode : nsISupports
|
||||
{
|
||||
/*
|
||||
The current number of DocShells which are immediate children of the
|
||||
this object.
|
||||
*/
|
||||
readonly attribute long childCount;
|
||||
|
||||
/*
|
||||
Add a new child DocShellTreeItem. Adds to the end of the list.
|
||||
Note that this does NOT take a reference to the child. The child stays
|
||||
alive only as long as it's referenced from outside the docshell tree.
|
||||
@throws NS_ERROR_ILLEGAL_VALUE if child corresponds to the same
|
||||
object as this treenode or an ancestor of this treenode
|
||||
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
|
||||
*/
|
||||
void addChild(in nsIDocShellTreeItem child);
|
||||
|
||||
/*
|
||||
Removes a child DocShellTreeItem.
|
||||
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
|
||||
*/
|
||||
void removeChild(in nsIDocShellTreeItem child);
|
||||
|
||||
/**
|
||||
* Return the child at the index requested. This is 0-based.
|
||||
*
|
||||
* @throws NS_ERROR_UNEXPECTED if the index is out of range
|
||||
*/
|
||||
nsIDocShellTreeItem getChildAt(in long index);
|
||||
|
||||
/*
|
||||
Return the child DocShellTreeItem with the specified name.
|
||||
aName - This is the name of the item that is trying to be found.
|
||||
aRecurse - Is used to tell the function to recurse through children.
|
||||
Note, recursion will only happen through items of the same type.
|
||||
aSameType - If this is set only children of the same type will be returned.
|
||||
aRequestor - This is the docshellTreeItem that is requesting the find. This
|
||||
parameter is used when recursion is being used to avoid searching the same
|
||||
tree again when a child has asked a parent to search for children.
|
||||
aOriginalRequestor - The original treeitem that made the request, if any.
|
||||
This is used to ensure that we don't run into cross-site issues.
|
||||
|
||||
Note the search is depth first when recursing.
|
||||
*/
|
||||
nsIDocShellTreeItem findChildWithName(in wstring aName,
|
||||
in boolean aRecurse,
|
||||
in boolean aSameType,
|
||||
in nsIDocShellTreeItem aRequestor,
|
||||
in nsIDocShellTreeItem aOriginalRequestor);
|
||||
};
|
||||
|
|
@ -16,7 +16,7 @@ interface nsIURI;
|
|||
* location, stop or restart an in process load, or determine where the object
|
||||
* has previously gone.
|
||||
*/
|
||||
[scriptable, uuid(28404f7e-0f17-4dc3-a21a-2074d8659b02)]
|
||||
[scriptable, uuid(dbd6241d-c76e-42c0-9410-930589d803a2)]
|
||||
interface nsIWebNavigation : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -191,6 +191,11 @@ interface nsIWebNavigation : nsISupports
|
|||
*/
|
||||
const unsigned long LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x100000;
|
||||
|
||||
/**
|
||||
* This flag specifies that common scheme typos should be corrected.
|
||||
*/
|
||||
const unsigned long LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x200000;
|
||||
|
||||
/* Note that flag 0x80000 is available. */
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "nsIDocShellLoadInfo.h"
|
||||
#include "nsISHContainer.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsICacheService.h"
|
||||
|
@ -1636,22 +1635,21 @@ nsSHistory::CompareFrames(nsISHEntry * aPrevEntry, nsISHEntry * aNextEntry, nsID
|
|||
int32_t pcnt=0, ncnt=0, dsCount=0;
|
||||
nsCOMPtr<nsISHContainer> prevContainer(do_QueryInterface(aPrevEntry));
|
||||
nsCOMPtr<nsISHContainer> nextContainer(do_QueryInterface(aNextEntry));
|
||||
nsCOMPtr<nsIDocShellTreeNode> dsTreeNode(do_QueryInterface(aParent));
|
||||
|
||||
if (!dsTreeNode)
|
||||
if (!aParent)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (!prevContainer || !nextContainer)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
prevContainer->GetChildCount(&pcnt);
|
||||
nextContainer->GetChildCount(&ncnt);
|
||||
dsTreeNode->GetChildCount(&dsCount);
|
||||
aParent->GetChildCount(&dsCount);
|
||||
|
||||
// Create an array for child docshells.
|
||||
nsCOMArray<nsIDocShell> docshells;
|
||||
for (int32_t i = 0; i < dsCount; ++i) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem;
|
||||
dsTreeNode->GetChildAt(i, getter_AddRefs(treeItem));
|
||||
aParent->GetChildAt(i, getter_AddRefs(treeItem));
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(treeItem);
|
||||
if (shell) {
|
||||
docshells.AppendObject(shell);
|
||||
|
|
|
@ -111,7 +111,7 @@ function xpcEnumerateContentWindows(callback) {
|
|||
if (/ChromeWindow/.exec(win)) {
|
||||
var docshellTreeNode = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeNode);
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem);
|
||||
var childCount = docshellTreeNode.childCount;
|
||||
for (var i = 0; i < childCount; ++i) {
|
||||
var childTreeNode = docshellTreeNode.getChildAt(i);
|
||||
|
|
|
@ -143,10 +143,10 @@ LOCAL_INCLUDES += [
|
|||
'../src/geolocation',
|
||||
'../src/storage',
|
||||
'../time',
|
||||
'../xbl',
|
||||
'/content/base/src',
|
||||
'/content/events/src',
|
||||
'/content/html/document/src',
|
||||
'/content/xbl/src',
|
||||
'/content/xul/document/src',
|
||||
'/layout/generic',
|
||||
'/layout/style',
|
||||
|
|
|
@ -38,8 +38,7 @@ NS_INTERFACE_MAP_END
|
|||
NS_IMETHODIMP
|
||||
nsDOMWindowList::SetDocShell(nsIDocShell* aDocShell)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
|
||||
mDocShellNode = docShellAsNode; // Weak Reference
|
||||
mDocShellNode = aDocShell; // Weak Reference
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMWindowCollection.h"
|
||||
#include <stdint.h>
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
class nsIDocShell;
|
||||
class nsIDOMWindow;
|
||||
|
@ -41,7 +41,7 @@ protected:
|
|||
// Note: this function may flush and cause mDocShellNode to become null.
|
||||
void EnsureFresh();
|
||||
|
||||
nsIDocShellTreeNode* mDocShellNode; //Weak Reference
|
||||
nsIDocShell* mDocShellNode; //Weak Reference
|
||||
};
|
||||
|
||||
#endif // nsDOMWindowList_h___
|
||||
|
|
|
@ -5468,13 +5468,13 @@ nsGlobalWindow::GetLength(uint32_t* aLength)
|
|||
already_AddRefed<nsIDOMWindow>
|
||||
nsGlobalWindow::GetChildWindow(const nsAString& aName)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeNode> dsn(do_QueryInterface(GetDocShell()));
|
||||
NS_ENSURE_TRUE(dsn, nullptr);
|
||||
nsCOMPtr<nsIDocShell> docShell(GetDocShell());
|
||||
NS_ENSURE_TRUE(docShell, nullptr);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> child;
|
||||
dsn->FindChildWithName(PromiseFlatString(aName).get(),
|
||||
false, true, nullptr, nullptr,
|
||||
getter_AddRefs(child));
|
||||
docShell->FindChildWithName(PromiseFlatString(aName).get(),
|
||||
false, true, nullptr, nullptr,
|
||||
getter_AddRefs(child));
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> child_win(do_GetInterface(child));
|
||||
return child_win.forget();
|
||||
|
|
|
@ -1926,7 +1926,10 @@ nsJSContext::GarbageCollectNow(JS::gcreason::Reason aReason,
|
|||
|
||||
JS::PrepareForFullGC(sRuntime);
|
||||
if (aIncremental == IncrementalGC) {
|
||||
MOZ_ASSERT(aShrinking == NonShrinkingGC);
|
||||
JS::IncrementalGC(sRuntime, aReason, aSliceMillis);
|
||||
} else if (aShrinking == ShrinkingGC) {
|
||||
JS::ShrinkingGC(sRuntime, aReason);
|
||||
} else {
|
||||
JS::GCForReason(sRuntime, aReason);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,12 @@ class ErrorResult {
|
|||
public:
|
||||
ErrorResult() {
|
||||
mResult = NS_OK;
|
||||
|
||||
#ifdef DEBUG
|
||||
// ErrorResult is extremely performance-sensitive code, where literally
|
||||
// every machine instruction matters. Initialize mMessage only to suppress
|
||||
// a debug-only warning from gcc 4.6.
|
||||
mMessage = nullptr;
|
||||
mMightHaveUnreportedJSException = false;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ LOCAL_INCLUDES += [
|
|||
'/content/media/webaudio',
|
||||
'/content/media/webspeech/recognition',
|
||||
'/content/svg/content/src',
|
||||
'/content/xbl/src',
|
||||
'/content/xml/content/src',
|
||||
'/content/xul/content/src',
|
||||
'/content/xul/document/src',
|
||||
|
@ -58,6 +57,7 @@ LOCAL_INCLUDES += [
|
|||
'/dom/indexedDB',
|
||||
'/dom/src/geolocation',
|
||||
'/dom/workers',
|
||||
'/dom/xbl',
|
||||
'/dom/xslt/base',
|
||||
'/dom/xslt/xpath',
|
||||
'/js/ipc',
|
||||
|
|
|
@ -208,6 +208,9 @@ IDBFactory::Create(JSContext* aCx,
|
|||
factory->mOwningObject = aOwningObject;
|
||||
factory->mContentParent = aContentParent;
|
||||
|
||||
mozilla::HoldJSObjects(factory.get());
|
||||
factory->mRootedOwningObject = true;
|
||||
|
||||
if (!IndexedDatabaseManager::IsMainProcess()) {
|
||||
ContentChild* contentChild = ContentChild::GetSingleton();
|
||||
NS_ENSURE_TRUE(contentChild, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
#include "nsIDOMWindow.h"
|
||||
#include "nsIExternalProtocolService.h"
|
||||
#include "nsIFilePicker.h"
|
||||
#include "nsIGfxInfo.h"
|
||||
#include "nsIIdleService.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsIMozBrowserFrame.h"
|
||||
|
@ -516,8 +517,6 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
|
|||
|
||||
if (aContext.IsBrowserElement() || !aContext.HasOwnApp()) {
|
||||
if (nsRefPtr<ContentParent> cp = GetNewOrUsed(aContext.IsBrowserElement())) {
|
||||
nsRefPtr<TabParent> tp(new TabParent(cp, aContext));
|
||||
tp->SetOwnerElement(aFrameElement);
|
||||
uint32_t chromeFlags = 0;
|
||||
|
||||
// Propagate the private-browsing status of the element's parent
|
||||
|
@ -537,6 +536,9 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
|
|||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME;
|
||||
}
|
||||
|
||||
nsRefPtr<TabParent> tp(new TabParent(cp, aContext, chromeFlags));
|
||||
tp->SetOwnerElement(aFrameElement);
|
||||
|
||||
PBrowserParent* browser = cp->SendPBrowserConstructor(
|
||||
tp.forget().get(), // DeallocPBrowserParent() releases this ref.
|
||||
aContext.AsIPCTabContext(),
|
||||
|
@ -599,12 +601,14 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
|
|||
sAppContentParents->Put(manifestURL, p);
|
||||
}
|
||||
|
||||
nsRefPtr<TabParent> tp = new TabParent(p, aContext);
|
||||
uint32_t chromeFlags = 0;
|
||||
|
||||
nsRefPtr<TabParent> tp = new TabParent(p, aContext, chromeFlags);
|
||||
tp->SetOwnerElement(aFrameElement);
|
||||
PBrowserParent* browser = p->SendPBrowserConstructor(
|
||||
nsRefPtr<TabParent>(tp).forget().get(), // DeallocPBrowserParent() releases this ref.
|
||||
aContext.AsIPCTabContext(),
|
||||
/* chromeFlags */ 0);
|
||||
chromeFlags);
|
||||
|
||||
p->MaybeTakeCPUWakeLock(aFrameElement);
|
||||
|
||||
|
@ -2036,7 +2040,7 @@ ContentParent::AllocPBrowserParent(const IPCTabContext& aContext,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
TabParent* parent = new TabParent(this, tc.GetTabContext());
|
||||
TabParent* parent = new TabParent(this, tc.GetTabContext(), aChromeFlags);
|
||||
|
||||
// We release this ref in DeallocPBrowserParent()
|
||||
NS_ADDREF(parent);
|
||||
|
@ -3186,6 +3190,21 @@ ContentParent::RecvRecordingDeviceEvents(const nsString& aRecordingStatus,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvGetGraphicsFeatureStatus(const int32_t& aFeature,
|
||||
int32_t* aStatus,
|
||||
bool* aSuccess)
|
||||
{
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (!gfxInfo) {
|
||||
*aSuccess = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
*aSuccess = NS_SUCCEEDED(gfxInfo->GetFeatureStatus(aFeature, aStatus));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvAddIdleObserver(const uint64_t& aObserver, const uint32_t& aIdleTimeInS)
|
||||
{
|
||||
|
|
|
@ -515,6 +515,10 @@ private:
|
|||
|
||||
virtual void ProcessingError(Result what) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvGetGraphicsFeatureStatus(const int32_t& aFeature,
|
||||
int32_t* aStatus,
|
||||
bool* aSuccess);
|
||||
|
||||
virtual bool RecvAddIdleObserver(const uint64_t& observerId, const uint32_t& aIdleTimeInS);
|
||||
virtual bool RecvRemoveIdleObserver(const uint64_t& observerId, const uint32_t& aIdleTimeInS);
|
||||
|
||||
|
|
|
@ -507,6 +507,8 @@ parent:
|
|||
bool isAudio,
|
||||
bool isVideo);
|
||||
|
||||
sync GetGraphicsFeatureStatus(int32_t aFeature) returns (int32_t aStatus, bool aSuccess);
|
||||
|
||||
AddIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
|
||||
RemoveIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
|
||||
both:
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "StructuredCloneUtils.h"
|
||||
#include "JavaScriptParent.h"
|
||||
#include "TabChild.h"
|
||||
#include "LoadContext.h"
|
||||
#include "nsNetCID.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -197,7 +198,7 @@ TabParent *TabParent::mIMETabParent = nullptr;
|
|||
|
||||
NS_IMPL_ISUPPORTS3(TabParent, nsITabParent, nsIAuthPromptProvider, nsISecureBrowserUI)
|
||||
|
||||
TabParent::TabParent(ContentParent* aManager, const TabContext& aContext)
|
||||
TabParent::TabParent(ContentParent* aManager, const TabContext& aContext, uint32_t aChromeFlags)
|
||||
: TabContext(aContext)
|
||||
, mFrameElement(nullptr)
|
||||
, mIMESelectionAnchor(0)
|
||||
|
@ -218,6 +219,7 @@ TabParent::TabParent(ContentParent* aManager, const TabContext& aContext)
|
|||
, mMarkedDestroying(false)
|
||||
, mIsDestroyed(false)
|
||||
, mAppPackageFileDescriptorSent(false)
|
||||
, mChromeFlags(aChromeFlags)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1731,5 +1733,22 @@ TabParent::RecvContentReceivedTouch(const ScrollableLayerGuid& aGuid,
|
|||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<nsILoadContext>
|
||||
TabParent::GetLoadContext()
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
if (mLoadContext) {
|
||||
loadContext = mLoadContext;
|
||||
} else {
|
||||
loadContext = new LoadContext(GetOwnerElement(),
|
||||
OwnOrContainingAppId(),
|
||||
true /* aIsContent */,
|
||||
mChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW,
|
||||
IsBrowserElement());
|
||||
mLoadContext = loadContext;
|
||||
}
|
||||
return loadContext.forget();
|
||||
}
|
||||
|
||||
} // namespace tabs
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -26,6 +26,7 @@ class nsIContent;
|
|||
class nsIPrincipal;
|
||||
class nsIURI;
|
||||
class nsIWidget;
|
||||
class nsILoadContext;
|
||||
class CpowHolder;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -58,7 +59,7 @@ class TabParent : public PBrowserParent
|
|||
typedef mozilla::layout::ScrollingBehavior ScrollingBehavior;
|
||||
|
||||
public:
|
||||
TabParent(ContentParent* aManager, const TabContext& aContext);
|
||||
TabParent(ContentParent* aManager, const TabContext& aContext, uint32_t aChromeFlags);
|
||||
virtual ~TabParent();
|
||||
Element* GetOwnerElement() const { return mFrameElement; }
|
||||
void SetOwnerElement(Element* aElement);
|
||||
|
@ -81,6 +82,8 @@ public:
|
|||
mBrowserDOMWindow = aBrowserDOMWindow;
|
||||
}
|
||||
|
||||
already_AddRefed<nsILoadContext> GetLoadContext();
|
||||
|
||||
/**
|
||||
* Return the TabParent that has decided it wants to capture an
|
||||
* event series for fast-path dispatch to its subprocess, if one
|
||||
|
@ -372,6 +375,10 @@ private:
|
|||
bool mIsDestroyed;
|
||||
// Whether we have already sent a FileDescriptor for the app package.
|
||||
bool mAppPackageFileDescriptorSent;
|
||||
|
||||
uint32_t mChromeFlags;
|
||||
|
||||
nsCOMPtr<nsILoadContext> mLoadContext;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -1848,14 +1848,13 @@ MediaManager::MediaCaptureWindowStateInternal(nsIDOMWindow* aWindow, bool* aVide
|
|||
}
|
||||
|
||||
// iterate any children of *this* window (iframes, etc)
|
||||
nsCOMPtr<nsIDocShellTreeNode> node =
|
||||
do_QueryInterface(piWin->GetDocShell());
|
||||
if (node) {
|
||||
nsCOMPtr<nsIDocShell> docShell = piWin->GetDocShell();
|
||||
if (docShell) {
|
||||
int32_t i, count;
|
||||
node->GetChildCount(&count);
|
||||
docShell->GetChildCount(&count);
|
||||
for (i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||
node->GetChildAt(i, getter_AddRefs(item));
|
||||
docShell->GetChildAt(i, getter_AddRefs(item));
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_GetInterface(item);
|
||||
|
||||
MediaCaptureWindowStateInternal(win, aVideo, aAudio);
|
||||
|
|
|
@ -77,6 +77,7 @@ PARALLEL_DIRS += [
|
|||
'telephony',
|
||||
'inputmethod',
|
||||
'webidl',
|
||||
'xbl',
|
||||
'xslt',
|
||||
]
|
||||
|
||||
|
|
|
@ -140,9 +140,9 @@ public:
|
|||
|
||||
SharedTextureHandle handle =
|
||||
gl::CreateSharedHandle(sPluginContext,
|
||||
gl::SameProcess,
|
||||
gl::SharedTextureShareType::SameProcess,
|
||||
(void*)mTextureInfo.mTexture,
|
||||
gl::TextureID);
|
||||
gl::SharedTextureBufferType::TextureID);
|
||||
|
||||
// We want forget about this now, so delete the texture. Assigning it to zero
|
||||
// ensures that we create a new one in Lock()
|
||||
|
@ -1021,9 +1021,9 @@ SharedTextureHandle nsNPAPIPluginInstance::CreateSharedHandle()
|
|||
} else if (mContentSurface) {
|
||||
EnsureGLContext();
|
||||
return gl::CreateSharedHandle(sPluginContext,
|
||||
gl::SameProcess,
|
||||
gl::SharedTextureShareType::SameProcess,
|
||||
mContentSurface,
|
||||
gl::SurfaceTexture);
|
||||
gl::SharedTextureBufferType::SurfaceTexture);
|
||||
} else return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ nsPluginInstanceOwner::GetImageContainer()
|
|||
|
||||
SharedTextureImage::Data data;
|
||||
data.mHandle = mInstance->CreateSharedHandle();
|
||||
data.mShareType = mozilla::gl::SameProcess;
|
||||
data.mShareType = mozilla::gl::SharedTextureShareType::SameProcess;
|
||||
data.mInverted = mInstance->Inverted();
|
||||
|
||||
LayoutDeviceRect r = GetPluginRect();
|
||||
|
@ -1503,11 +1503,11 @@ already_AddRefed<ImageContainer> nsPluginInstanceOwner::GetImageContainerForVide
|
|||
|
||||
SharedTextureImage::Data data;
|
||||
|
||||
data.mShareType = gl::SameProcess;
|
||||
data.mShareType = gl::SharedTextureShareType::SameProcess;
|
||||
data.mHandle = gl::CreateSharedHandle(mInstance->GLContext(),
|
||||
data.mShareType,
|
||||
aVideoInfo->mSurfaceTexture,
|
||||
gl::SurfaceTexture);
|
||||
gl::SharedTextureBufferType::SurfaceTexture);
|
||||
|
||||
// The logic below for Honeycomb is just a guess, but seems to work. We don't have a separate
|
||||
// inverted flag for video.
|
||||
|
|
|
@ -119,11 +119,9 @@ PluginProcessChild::Init()
|
|||
return false;
|
||||
}
|
||||
|
||||
mPlugin.Init(pluginFilename, ParentHandle(),
|
||||
IOThreadChild::message_loop(),
|
||||
IOThreadChild::channel());
|
||||
|
||||
return true;
|
||||
return mPlugin.Init(pluginFilename, ParentHandle(),
|
||||
IOThreadChild::message_loop(),
|
||||
IOThreadChild::channel());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче