Merge m-c to b2g-inbound.
1
aclocal.m4
vendored
@ -3,6 +3,7 @@ dnl Local autoconf macros used with mozilla
|
||||
dnl The contents of this file are under the Public Domain.
|
||||
dnl
|
||||
|
||||
builtin(include, build/autoconf/hotfixes.m4)dnl
|
||||
builtin(include, build/autoconf/acwinpaths.m4)dnl
|
||||
builtin(include, build/autoconf/hooks.m4)dnl
|
||||
builtin(include, build/autoconf/config.status.m4)dnl
|
||||
|
@ -226,8 +226,16 @@ let wrapper = {
|
||||
|
||||
// Button onclick handlers
|
||||
function handleOldSync() {
|
||||
// we just want to navigate the current tab to the new location...
|
||||
window.location = Services.urlFormatter.formatURLPref("app.support.baseURL") + "old-sync";
|
||||
let chromeWin = window
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.rootTreeItem
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindow)
|
||||
.QueryInterface(Ci.nsIDOMChromeWindow);
|
||||
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "old-sync";
|
||||
chromeWin.switchToTabHavingURI(url, true);
|
||||
}
|
||||
|
||||
function getStarted() {
|
||||
|
@ -28,11 +28,11 @@
|
||||
command="Tools:PrivateBrowsing"
|
||||
key="key_privatebrowsing"/>
|
||||
<menuitem id="menu_newRemoteWindow"
|
||||
label="New OOP Window"
|
||||
label="New e10s Window"
|
||||
hidden="true"
|
||||
command="Tools:RemoteWindow"/>
|
||||
<menuitem id="menu_newNonRemoteWindow"
|
||||
label="New In-process Window"
|
||||
label="New Non-e10s Window"
|
||||
hidden="true"
|
||||
command="Tools:NonRemoteWindow"/>
|
||||
<menuitem id="menu_openFile"
|
||||
|
@ -104,14 +104,18 @@ let gSyncUI = {
|
||||
if (!gBrowser)
|
||||
return;
|
||||
|
||||
let button = document.getElementById("sync-button");
|
||||
if (!button)
|
||||
return;
|
||||
let syncButton = document.getElementById("sync-button");
|
||||
let panelHorizontalButton = document.getElementById("PanelUI-fxa-status");
|
||||
[syncButton, panelHorizontalButton].forEach(function(button) {
|
||||
if (!button)
|
||||
return;
|
||||
button.removeAttribute("status");
|
||||
});
|
||||
|
||||
if (needsSetup && syncButton)
|
||||
syncButton.removeAttribute("tooltiptext");
|
||||
|
||||
button.removeAttribute("status");
|
||||
this._updateLastSyncTime();
|
||||
if (needsSetup)
|
||||
button.removeAttribute("tooltiptext");
|
||||
},
|
||||
|
||||
|
||||
@ -120,11 +124,12 @@ let gSyncUI = {
|
||||
if (!gBrowser)
|
||||
return;
|
||||
|
||||
let button = document.getElementById("sync-button");
|
||||
if (!button)
|
||||
return;
|
||||
|
||||
button.setAttribute("status", "active");
|
||||
["sync-button", "PanelUI-fxa-status"].forEach(function(id) {
|
||||
let button = document.getElementById(id);
|
||||
if (!button)
|
||||
return;
|
||||
button.setAttribute("status", "active");
|
||||
});
|
||||
},
|
||||
|
||||
onSyncDelay: function SUI_onSyncDelay() {
|
||||
@ -161,6 +166,11 @@ let gSyncUI = {
|
||||
this.updateUI();
|
||||
return;
|
||||
}
|
||||
// if we are still waiting for the identity manager to initialize, don't show errors
|
||||
if (Weave.Status.login == Weave.LOGIN_FAILED_NOT_READY) {
|
||||
this.updateUI();
|
||||
return;
|
||||
}
|
||||
|
||||
let title = this._stringBundle.GetStringFromName("error.login.title");
|
||||
|
||||
|
@ -2347,7 +2347,7 @@ let BrowserOnClick = {
|
||||
*/
|
||||
onE10sAboutNewTab: function(aEvent, aOwnerDoc) {
|
||||
let isTopFrame = (aOwnerDoc.defaultView.parent === aOwnerDoc.defaultView);
|
||||
if (!isTopFrame) {
|
||||
if (!isTopFrame || aEvent.button != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@
|
||||
|
||||
<!-- Sync Panel -->
|
||||
<panel id="sync-start-panel" class="sync-panel" type="arrow" hidden="true"
|
||||
noautofocus="true" level="top" onclick="this.hidePopup();"
|
||||
noautofocus="true" onclick="this.hidePopup();"
|
||||
flip="slide">
|
||||
<hbox class="sync-panel-outer">
|
||||
<image class="sync-panel-icon"/>
|
||||
@ -409,7 +409,7 @@
|
||||
|
||||
<!-- Sync Error Panel -->
|
||||
<panel id="sync-error-panel" class="sync-panel" type="arrow" hidden="true"
|
||||
noautofocus="true" level="top" onclick="this.hidePopup();"
|
||||
noautofocus="true" onclick="this.hidePopup();"
|
||||
flip="slide">
|
||||
<hbox class="sync-panel-outer">
|
||||
<image class="sync-panel-icon"/>
|
||||
|
@ -269,6 +269,8 @@ skip-if = true # browser_drag.js is disabled, as it needs to be updated for the
|
||||
[browser_locationBarCommand.js]
|
||||
skip-if = os == "linux" # Intermittent failures, bug 917535
|
||||
[browser_locationBarExternalLoad.js]
|
||||
[browser_menuButtonFitts.js]
|
||||
skip-if = os != "win" # The Fitts Law menu button is only supported on Windows (bug 969376)
|
||||
[browser_middleMouse_inherit.js]
|
||||
[browser_minimize.js]
|
||||
[browser_mixedcontent_securityflags.js]
|
||||
|
32
browser/base/content/test/general/browser_menuButtonFitts.js
Normal file
@ -0,0 +1,32 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
function test () {
|
||||
waitForExplicitFinish();
|
||||
window.maximize();
|
||||
|
||||
// Find where the nav-bar is vertically.
|
||||
var navBar = document.getElementById("nav-bar");
|
||||
var boundingRect = navBar.getBoundingClientRect();
|
||||
var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
|
||||
var xPixel = boundingRect.width - 1; // Use the last pixel of the screen since it is maximized.
|
||||
|
||||
function onPopupHidden() {
|
||||
PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
|
||||
window.restore();
|
||||
finish();
|
||||
}
|
||||
function onPopupShown() {
|
||||
PanelUI.panel.removeEventListener("popupshown", onPopupShown);
|
||||
ok(true, "Clicking at the far edge of the window opened the menu popup.");
|
||||
PanelUI.panel.addEventListener("popuphidden", onPopupHidden);
|
||||
PanelUI.hide();
|
||||
}
|
||||
registerCleanupFunction(function() {
|
||||
PanelUI.panel.removeEventListener("popupshown", onPopupShown);
|
||||
PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
|
||||
});
|
||||
PanelUI.panel.addEventListener("popupshown", onPopupShown);
|
||||
EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
|
||||
}
|
@ -30,13 +30,11 @@
|
||||
<menupopup id="customization-toolbar-menu" onpopupshowing="onViewToolbarsPopupShowing(event)"/>
|
||||
</button>
|
||||
<spacer flex="1"/>
|
||||
<label id="customization-undo-reset"
|
||||
hidden="true"
|
||||
onclick="gCustomizeMode.undoReset();"
|
||||
onkeypress="gCustomizeMode.undoReset();"
|
||||
class="text-link">
|
||||
&undoCmd.label;
|
||||
</label>
|
||||
<button id="customization-undo-reset"
|
||||
class="customizationmode-button"
|
||||
hidden="true"
|
||||
oncommand="gCustomizeMode.undoReset();"
|
||||
label="&undoCmd.label;"/>
|
||||
<button id="customization-reset-button" oncommand="gCustomizeMode.reset();" label="&customizeMode.restoreDefaults;" class="customizationmode-button"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
const isOSX = (Services.appinfo.OS === "Darwin");
|
||||
|
||||
// Right-click on the home button should
|
||||
|
@ -4,6 +4,19 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
let openUILinkInCalled = false;
|
||||
let expectOpenUILinkInCall = false;
|
||||
this.originalOpenUILinkIn = openUILinkIn;
|
||||
openUILinkIn = (aUrl, aWhichTab) => {
|
||||
is(aUrl, Services.search.defaultEngine.searchForm, "Search page should be requested to open.");
|
||||
is(aWhichTab, "current", "Should use the current tab for the search page.");
|
||||
openUILinkInCalled = true;
|
||||
if (!expectOpenUILinkInCall) {
|
||||
ok(false, "OpenUILink in was called when it shouldn't have been.");
|
||||
}
|
||||
};
|
||||
logActiveElement();
|
||||
|
||||
// Ctrl+K should open the menu panel and focus the search bar if the search bar is in the panel.
|
||||
add_task(function() {
|
||||
let searchbar = document.getElementById("searchbar");
|
||||
@ -88,28 +101,29 @@ add_task(function() {
|
||||
|
||||
// Ctrl+K should open the search page if the search bar has been customized out.
|
||||
add_task(function() {
|
||||
this.originalOpenUILinkIn = openUILinkIn;
|
||||
try {
|
||||
expectOpenUILinkInCall = true;
|
||||
CustomizableUI.removeWidgetFromArea("search-container");
|
||||
let placement = CustomizableUI.getPlacementOfWidget("search-container");
|
||||
is(placement, null, "Search container should be in palette");
|
||||
|
||||
let openUILinkInCalled = false;
|
||||
openUILinkIn = (aUrl, aWhichTab) => {
|
||||
is(aUrl, Services.search.defaultEngine.searchForm, "Search page should be requested to open.");
|
||||
is(aWhichTab, "current", "Should use the current tab for the search page.");
|
||||
openUILinkInCalled = true;
|
||||
};
|
||||
openUILinkInCalled = false;
|
||||
|
||||
sendWebSearchKeyCommand();
|
||||
yield waitForCondition(function() openUILinkInCalled);
|
||||
ok(openUILinkInCalled, "The search page should have been opened.")
|
||||
expectOpenUILinkInCall = false;
|
||||
} catch (e) {
|
||||
ok(false, e);
|
||||
}
|
||||
openUILinkIn = this.originalOpenUILinkIn;
|
||||
CustomizableUI.reset();
|
||||
});
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
openUILinkIn = this.originalOpenUILinkIn;
|
||||
delete this.originalOpenUILinkIn;
|
||||
});
|
||||
|
||||
function sendWebSearchKeyCommand() {
|
||||
if (Services.appinfo.OS === "Darwin")
|
||||
EventUtils.synthesizeKey("k", { accelKey: true });
|
||||
@ -119,7 +133,10 @@ function sendWebSearchKeyCommand() {
|
||||
|
||||
function logActiveElement() {
|
||||
let element = document.activeElement;
|
||||
info("Active element: " + element ?
|
||||
element + " (" + element.localName + "#" + element.id + "." + [...element.classList].join(".") + ")" :
|
||||
"null");
|
||||
let str = "";
|
||||
while (element && element.parentNode) {
|
||||
str = " (" + element.localName + "#" + element.id + "." + [...element.classList].join(".") + ") >" + str;
|
||||
element = element.parentNode;
|
||||
}
|
||||
info("Active element: " + element ? str : "null");
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
"use strict";
|
||||
|
||||
let Preferences = Cu.import("resource://gre/modules/Preferences.jsm", {}).Preferences;
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
let tmp = {};
|
||||
Cu.import("resource://gre/modules/FxAccounts.jsm", tmp);
|
||||
|
@ -175,6 +175,8 @@ var BrowserUI = {
|
||||
Util.dumpLn("Exception in delay load module:", ex.message);
|
||||
}
|
||||
|
||||
BrowserUI._initFirstRunContent();
|
||||
|
||||
// check for left over crash reports and submit them if found.
|
||||
BrowserUI.startupCrashCheck();
|
||||
|
||||
@ -1216,6 +1218,24 @@ var BrowserUI = {
|
||||
|
||||
prefsClearButton.disabled = false;
|
||||
},
|
||||
|
||||
_initFirstRunContent: function () {
|
||||
let dismissed = Services.prefs.getBoolPref("browser.firstrun-content.dismissed");
|
||||
let firstRunCount = Services.prefs.getIntPref("browser.firstrun.count");
|
||||
|
||||
if (!dismissed && firstRunCount > 0) {
|
||||
document.loadOverlay("chrome://browser/content/FirstRunContentOverlay.xul", null);
|
||||
}
|
||||
},
|
||||
|
||||
firstRunContentDismiss: function() {
|
||||
let firstRunElements = Elements.stack.querySelectorAll(".firstrun-content");
|
||||
for (let node of firstRunElements) {
|
||||
node.parentNode.removeChild(node);
|
||||
}
|
||||
|
||||
Services.prefs.setBoolPref("browser.firstrun-content.dismissed", true);
|
||||
},
|
||||
};
|
||||
|
||||
var PanelUI = {
|
||||
|
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/skin/firstruncontent.css" type="text/css"?>
|
||||
|
||||
<!-- 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/. -->
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
|
||||
%browserDTD;
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
%brandDTD;
|
||||
]>
|
||||
|
||||
<overlay id="firstruncontent"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<stack id="stack">
|
||||
<box id="firstrun-bg-pane" insertafter="page" class="firstrun-content"></box>
|
||||
|
||||
<box id="instruction-tabs" class="firstrun-content">
|
||||
<vbox class="instruction-content-container" align="center">
|
||||
<image class="instruction-arrow arrow-top" />
|
||||
<label class="instruction-label">&firstRunTabs.label;</label>
|
||||
</vbox>
|
||||
</box>
|
||||
|
||||
<box id="instruction-back" class="firstrun-content">
|
||||
<vbox class="instruction-content-container" align="start">
|
||||
<image class="instruction-arrow arrow-back" />
|
||||
<label class="instruction-label">&firstRunBack.label;</label>
|
||||
</vbox>
|
||||
</box>
|
||||
|
||||
<box id="instruction-plus" class="firstrun-content">
|
||||
<vbox class="instruction-content-container" align="end">
|
||||
<image class="instruction-arrow arrow-forward" />
|
||||
<label class="instruction-label">&firstRunNewTab.label;</label>
|
||||
</vbox>
|
||||
</box>
|
||||
|
||||
<appbar id="navbar">
|
||||
|
||||
<box id="instruction-star" class="firstrun-content">
|
||||
<hbox class="instruction-content-container">
|
||||
<label class="instruction-label">&firstRunStar.label;</label>
|
||||
<image class="instruction-arrow arrow-down" />
|
||||
</hbox>
|
||||
</box>
|
||||
|
||||
<box id="instruction-pin" class="firstrun-content">
|
||||
<vbox class="instruction-content-container" align="end">
|
||||
<label class="instruction-label">&firstRunPin.label;</label>
|
||||
<image class="instruction-arrow arrow-down-reverse" />
|
||||
</vbox>
|
||||
</box>
|
||||
|
||||
<box id="firstrun-gotit" class="firstrun-content">
|
||||
<button class="firstrun-button" label="&firstRunGotIt.label;" oncommand="BrowserUI.firstRunContentDismiss()" />
|
||||
</box>
|
||||
|
||||
</appbar>
|
||||
|
||||
|
||||
</stack>
|
||||
</overlay>
|
@ -99,6 +99,7 @@ chrome.jar:
|
||||
content/HistoryView.js (content/startui/HistoryView.js)
|
||||
content/TopSitesView.js (content/startui/TopSitesView.js)
|
||||
content/FirstRunOverlay.xul (content/startui/FirstRunOverlay.xul)
|
||||
content/FirstRunContentOverlay.xul (content/startui/FirstRunContentOverlay.xul)
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
content/RemoteTabsView.js (content/startui/RemoteTabsView.js)
|
||||
#endif
|
||||
|
@ -138,12 +138,9 @@
|
||||
firstRunStar.label,
|
||||
firstRunPin.label,
|
||||
firstRunGotIt.label )
|
||||
These strings appear as a content overlay the first few times a page
|
||||
These strings appear as a content overlay the first time a page
|
||||
is visited. Each one has an arrow pointing toward the feature it
|
||||
references. The code to display these strings is not enabled yet,
|
||||
but will be soon. For now, you can see this mockup for an example
|
||||
of how they are used:
|
||||
https://bug949213.bugzilla.mozilla.org/attachment.cgi?id=8363973
|
||||
references.
|
||||
-->
|
||||
<!ENTITY firstRunBack.label "Tap to go back to the previous page">
|
||||
<!ENTITY firstRunNewTab.label "Add a new tab to explore a new site">
|
||||
|
@ -136,6 +136,8 @@ pref("browser.display.startUI.maxresults", 16);
|
||||
|
||||
// Number of times to display firstrun instructions on new tab page
|
||||
pref("browser.firstrun.count", 3);
|
||||
// Has the content first run been dismissed
|
||||
pref("browser.firstrun-content.dismissed", false);
|
||||
|
||||
// Backspace and Shift+Backspace behavior
|
||||
// 0 goes Back/Forward
|
||||
|
205
browser/metro/theme/firstruncontent.css
Normal file
@ -0,0 +1,205 @@
|
||||
/* 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/. */
|
||||
|
||||
%filter substitution
|
||||
%include defines.inc
|
||||
|
||||
/* Disable firstrun in some cases */
|
||||
#stack[startpage] .firstrun-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.firstrun-content {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* bg transparent pane --------------- */
|
||||
|
||||
#firstrun-bg-pane {
|
||||
position: absolute;
|
||||
background-color: rgba(0, 0, 0, .8);
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
/* Got it button ---------------------- */
|
||||
|
||||
#firstrun-gotit {
|
||||
position: fixed;
|
||||
bottom: calc(@toolbar_height@ + 64px);
|
||||
left: 64px;
|
||||
}
|
||||
|
||||
#firstrun-gotit:-moz-locale-dir(rtl) {
|
||||
left: auto;
|
||||
right: 64px;
|
||||
}
|
||||
|
||||
.firstrun-button {
|
||||
padding: 15px 45px;
|
||||
font-family: "Segoe UI", sans-serif;
|
||||
font-size: 25px;
|
||||
background-image: -moz-linear-gradient(0deg, rgb(255, 128, 0) 0%, rgb(255, 149, 0) 100%);
|
||||
border: 0;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
/* Instructions arrows ---------------- */
|
||||
|
||||
.instruction-arrow {
|
||||
width: 76px;
|
||||
height: 76px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.instruction-arrow.arrow-top,
|
||||
.instruction-arrow.arrow-down,
|
||||
.instruction-arrow.arrow-down-reverse {
|
||||
background-image: url("chrome://browser/skin/images/arrow-top-light.png");
|
||||
}
|
||||
|
||||
.instruction-arrow.arrow-down,
|
||||
.instruction-arrow.arrow-down-reverse:-moz-locale-dir(rtl) {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.instruction-arrow.arrow-down-reverse,
|
||||
.instruction-arrow.arrow-down:-moz-locale-dir(rtl) {
|
||||
transform: rotate(180deg) scaleX(-1);
|
||||
}
|
||||
|
||||
.instruction-arrow.arrow-back,
|
||||
.instruction-arrow.arrow-forward {
|
||||
background-image: url("chrome://browser/skin/images/arrow-left-light.png");
|
||||
}
|
||||
|
||||
.instruction-arrow.arrow-forward,
|
||||
.instruction-arrow.arrow-back:-moz-locale-dir(rtl) {
|
||||
transform: rotate(180deg) scaleY(-1);
|
||||
}
|
||||
|
||||
.instruction-arrow.arrow-forward:-moz-locale-dir(rtl) {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
/* Instructions text ------------------ */
|
||||
|
||||
.instruction-content-container {
|
||||
width: 380px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
#instruction-back .instruction-content-container,
|
||||
#instruction-plus .instruction-content-container {
|
||||
width: 320px;
|
||||
}
|
||||
|
||||
.instruction-label {
|
||||
font-size: 18px;
|
||||
color: #BBB;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
#instruction-tabs {
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
#instruction-back {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 100px;
|
||||
}
|
||||
|
||||
#instruction-back:-moz-locale-dir(rtl) {
|
||||
left: auto;
|
||||
right: 100px;
|
||||
}
|
||||
|
||||
#instruction-plus {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
right: 100px;
|
||||
}
|
||||
|
||||
#instruction-plus:-moz-locale-dir(rtl) {
|
||||
right: auto;
|
||||
left: 100px;
|
||||
}
|
||||
|
||||
#instruction-star {
|
||||
position: fixed;
|
||||
bottom: @toolbar_height@;
|
||||
right: 145px;
|
||||
}
|
||||
|
||||
#instruction-star:-moz-locale-dir(rtl) {
|
||||
right: auto;
|
||||
left: 145px;
|
||||
}
|
||||
|
||||
#instruction-star .instruction-label {
|
||||
max-width: 250px;
|
||||
}
|
||||
|
||||
#instruction-star .instruction-content-container:-moz-locale-dir(rtl) {
|
||||
-moz-box-align: start;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#instruction-pin {
|
||||
position: fixed;
|
||||
bottom: @toolbar_height@;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
#instruction-pin:-moz-locale-dir(rtl) {
|
||||
right: auto;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
#instruction-pin .instruction-label {
|
||||
max-width: 250px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#instruction-pin .instruction-arrow {
|
||||
-moz-margin-end: 65px;
|
||||
}
|
||||
|
||||
/* Higher resolution images ---------------------- */
|
||||
|
||||
@media (min-resolution: @min_res_140pc@) {
|
||||
/* Load 140% image when scaled by 140% */
|
||||
.instruction-arrow.arrow-top,
|
||||
.instruction-arrow.arrow-down,
|
||||
.instruction-arrow.arrow-down-reverse {
|
||||
background-image: url("chrome://browser/skin/images/arrow-top-light@1.4x.png");
|
||||
}
|
||||
|
||||
.instruction-arrow.arrow-back,
|
||||
.instruction-arrow.arrow-forward {
|
||||
background-image: url("chrome://browser/skin/images/arrow-left-light@1.4x.png");
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-resolution: @min_res_180pc@) {
|
||||
/* Load 180% image when scaled by 180% */
|
||||
.instruction-arrow.arrow-top,
|
||||
.instruction-arrow.arrow-down,
|
||||
.instruction-arrow.arrow-down-reverse {
|
||||
background-image: url("chrome://browser/skin/images/arrow-top-light@1.8x.png");
|
||||
}
|
||||
|
||||
.instruction-arrow.arrow-back,
|
||||
.instruction-arrow.arrow-forward {
|
||||
background-image: url("chrome://browser/skin/images/arrow-left-light@1.8x.png");
|
||||
}
|
||||
}
|
BIN
browser/metro/theme/images/arrow-left-light.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
browser/metro/theme/images/arrow-left-light@1.4x.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
browser/metro/theme/images/arrow-left-light@1.8x.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
browser/metro/theme/images/arrow-top-light.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
browser/metro/theme/images/arrow-top-light@1.4x.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
browser/metro/theme/images/arrow-top-light@1.8x.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
@ -23,6 +23,7 @@ chrome.jar:
|
||||
skin/touchcontrols.css (touchcontrols.css)
|
||||
* skin/netError.css (netError.css)
|
||||
skin/firstrun.css (firstrun.css)
|
||||
* skin/firstruncontent.css (firstruncontent.css)
|
||||
* skin/start.css (start.css)
|
||||
% override chrome://global/skin/about.css chrome://browser/skin/about.css
|
||||
% override chrome://global/skin/media/videocontrols.css chrome://browser/skin/touchcontrols.css
|
||||
@ -160,6 +161,12 @@ chrome.jar:
|
||||
skin/images/arrow-left.png (images/arrow-left.png)
|
||||
skin/images/arrow-left@1.4x.png (images/arrow-left@1.4x.png)
|
||||
skin/images/arrow-left@1.8x.png (images/arrow-left@1.8x.png)
|
||||
skin/images/arrow-top-light.png (images/arrow-top-light.png)
|
||||
skin/images/arrow-top-light@1.4x.png (images/arrow-top-light@1.4x.png)
|
||||
skin/images/arrow-top-light@1.8x.png (images/arrow-top-light@1.8x.png)
|
||||
skin/images/arrow-left-light.png (images/arrow-left-light.png)
|
||||
skin/images/arrow-left-light@1.4x.png (images/arrow-left-light@1.4x.png)
|
||||
skin/images/arrow-left-light@1.8x.png (images/arrow-left-light@1.8x.png)
|
||||
|
||||
# AboutConfig specific:
|
||||
skin/images/textfield.png (images/textfield.png)
|
||||
|
@ -591,6 +591,10 @@ toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
#nav-bar #PanelUI-menu-button {
|
||||
-moz-padding-start: 7px;
|
||||
-moz-padding-end: 5px;
|
||||
}
|
||||
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):hover > .toolbarbutton-icon,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1:not([buttonover]):not([open]):hover > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
|
||||
|
@ -274,6 +274,7 @@ browser.jar:
|
||||
skin/classic/browser/sync-bg.png
|
||||
skin/classic/browser/sync-128.png
|
||||
skin/classic/browser/sync-desktopIcon.png
|
||||
skin/classic/browser/sync-horizontalbar.png
|
||||
skin/classic/browser/sync-mobileIcon.png
|
||||
skin/classic/browser/sync-notification-24.png
|
||||
skin/classic/browser/syncProgress-menuPanel.png
|
||||
@ -282,6 +283,7 @@ browser.jar:
|
||||
skin/classic/browser/syncCommon.css
|
||||
skin/classic/browser/syncQuota.css
|
||||
skin/classic/browser/syncProgress.css
|
||||
skin/classic/browser/syncProgress-horizontalbar.png
|
||||
#endif
|
||||
skin/classic/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png)
|
||||
skin/classic/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png)
|
||||
|
BIN
browser/themes/linux/sync-horizontalbar.png
Normal file
After Width: | Height: | Size: 721 B |
BIN
browser/themes/linux/syncProgress-horizontalbar.png
Normal file
After Width: | Height: | Size: 535 B |
@ -507,6 +507,13 @@ toolbar .toolbarbutton-1:not([type="menu-button"]),
|
||||
-moz-margin-start: 10px;
|
||||
}
|
||||
|
||||
#nav-bar #PanelUI-menu-button {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
-moz-margin-start: 9px;
|
||||
-moz-margin-end: 7px;
|
||||
}
|
||||
|
||||
@media not all and (min-resolution: 2dppx) {
|
||||
%include ../shared/toolbarbuttons.inc.css
|
||||
%include ../shared/menupanel.inc.css
|
||||
|
@ -11,6 +11,14 @@
|
||||
background-size: 16px, auto;
|
||||
}
|
||||
|
||||
#PanelUI-fxa-status {
|
||||
list-style-image: url(chrome://browser/skin/sync-horizontalbar@2x.png);
|
||||
}
|
||||
|
||||
#PanelUI-fxa-status[status="active"] {
|
||||
list-style-image: url(chrome://browser/skin/syncProgress-horizontalbar@2x.png);
|
||||
}
|
||||
|
||||
#PanelUI-customize {
|
||||
list-style-image: url(chrome://browser/skin/menuPanel-customize@2x.png);
|
||||
}
|
||||
@ -27,6 +35,7 @@
|
||||
list-style-image: url(chrome://browser/skin/menuPanel-exit@2x.png);
|
||||
}
|
||||
|
||||
#PanelUI-fxa-status,
|
||||
#PanelUI-customize,
|
||||
#PanelUI-help,
|
||||
#PanelUI-quit {
|
||||
|
@ -385,12 +385,16 @@ browser.jar:
|
||||
skin/classic/browser/sync-bg.png
|
||||
skin/classic/browser/sync-128.png
|
||||
skin/classic/browser/sync-desktopIcon.png
|
||||
skin/classic/browser/sync-horizontalbar.png
|
||||
skin/classic/browser/sync-horizontalbar@2x.png
|
||||
skin/classic/browser/sync-mobileIcon.png
|
||||
skin/classic/browser/sync-notification-24.png
|
||||
skin/classic/browser/syncSetup.css
|
||||
skin/classic/browser/syncCommon.css
|
||||
skin/classic/browser/syncQuota.css
|
||||
skin/classic/browser/syncProgress.css
|
||||
skin/classic/browser/syncProgress-horizontalbar.png
|
||||
skin/classic/browser/syncProgress-horizontalbar@2x.png
|
||||
#endif
|
||||
skin/classic/browser/lion/keyhole-circle.png (keyhole-circle-lion.png)
|
||||
skin/classic/browser/keyhole-circle@2x.png (keyhole-circle-lion@2x.png)
|
||||
|
BIN
browser/themes/osx/sync-horizontalbar.png
Normal file
After Width: | Height: | Size: 707 B |
BIN
browser/themes/osx/sync-horizontalbar@2x.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
browser/themes/osx/syncProgress-horizontalbar.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
browser/themes/osx/syncProgress-horizontalbar@2x.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
@ -105,13 +105,7 @@
|
||||
}
|
||||
|
||||
#customization-undo-reset {
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
%ifdef XP_MACOSX
|
||||
padding-top: 6px;
|
||||
%else
|
||||
padding-top: 7px;
|
||||
%endif
|
||||
-moz-margin-end: 10px;
|
||||
}
|
||||
|
||||
#main-window[customize-entered] #customization-panel-container {
|
||||
|
@ -26,10 +26,6 @@
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
#PanelUI-menu-button {
|
||||
margin: 0 7px 0 9px;
|
||||
}
|
||||
|
||||
.panel-subviews {
|
||||
padding: 4px;
|
||||
background-color: hsla(0,0%,100%,.97);
|
||||
@ -404,6 +400,17 @@ toolbarpaletteitem[place="palette"] > toolbaritem > toolbarbutton {
|
||||
flex: 1;
|
||||
-moz-padding-start: 15px;
|
||||
-moz-border-start-style: none;
|
||||
}
|
||||
|
||||
#PanelUI-fxa-status {
|
||||
list-style-image: url(chrome://browser/skin/sync-horizontalbar.png);
|
||||
}
|
||||
|
||||
#PanelUI-fxa-status[status="active"] {
|
||||
list-style-image: url(chrome://browser/skin/syncProgress-horizontalbar.png);
|
||||
}
|
||||
|
||||
#PanelUI-customize {
|
||||
list-style-image: url(chrome://browser/skin/menuPanel-customize.png);
|
||||
}
|
||||
|
||||
|
@ -496,6 +496,11 @@ menuitem.bookmark-item {
|
||||
-moz-box-pack: center;
|
||||
}
|
||||
|
||||
#nav-bar #PanelUI-menu-button {
|
||||
-moz-padding-start: 7px;
|
||||
-moz-padding-end: 5px;
|
||||
}
|
||||
|
||||
#nav-bar .toolbarbutton-1[type=menu]:not(#back-button):not(#forward-button):not(#feed-button):not(#social-provider-button):not(#PanelUI-menu-button) {
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
|
@ -303,12 +303,16 @@ browser.jar:
|
||||
skin/classic/browser/sync-128.png
|
||||
skin/classic/browser/sync-bg.png
|
||||
skin/classic/browser/sync-desktopIcon.png
|
||||
skin/classic/browser/sync-horizontalbar.png
|
||||
skin/classic/browser/sync-horizontalbar-XPVista7.png
|
||||
skin/classic/browser/sync-mobileIcon.png
|
||||
skin/classic/browser/sync-notification-24.png
|
||||
skin/classic/browser/syncSetup.css
|
||||
skin/classic/browser/syncCommon.css
|
||||
skin/classic/browser/syncQuota.css
|
||||
skin/classic/browser/syncProgress.css
|
||||
skin/classic/browser/syncProgress-horizontalbar.png
|
||||
skin/classic/browser/syncProgress-horizontalbar-XPVista7.png
|
||||
#endif
|
||||
skin/classic/browser/devtools/tooltip/arrow-horizontal-dark.png (../shared/devtools/tooltip/arrow-horizontal-dark.png)
|
||||
skin/classic/browser/devtools/tooltip/arrow-horizontal-dark@2x.png (../shared/devtools/tooltip/arrow-horizontal-dark@2x.png)
|
||||
@ -617,12 +621,16 @@ browser.jar:
|
||||
skin/classic/aero/browser/sync-128.png
|
||||
skin/classic/aero/browser/sync-bg.png
|
||||
skin/classic/aero/browser/sync-desktopIcon.png
|
||||
skin/classic/aero/browser/sync-horizontalbar.png
|
||||
skin/classic/aero/browser/sync-horizontalbar-XPVista7.png
|
||||
skin/classic/aero/browser/sync-mobileIcon.png
|
||||
skin/classic/aero/browser/sync-notification-24.png
|
||||
skin/classic/aero/browser/syncSetup.css
|
||||
skin/classic/aero/browser/syncCommon.css
|
||||
skin/classic/aero/browser/syncQuota.css
|
||||
skin/classic/aero/browser/syncProgress.css
|
||||
skin/classic/aero/browser/syncProgress-horizontalbar.png
|
||||
skin/classic/aero/browser/syncProgress-horizontalbar-XPVista7.png
|
||||
#endif
|
||||
#endif
|
||||
skin/classic/aero/browser/devtools/tooltip/arrow-horizontal-dark.png (../shared/devtools/tooltip/arrow-horizontal-dark.png)
|
||||
@ -633,3 +641,6 @@ browser.jar:
|
||||
skin/classic/aero/browser/devtools/tooltip/arrow-horizontal-light@2x.png (../shared/devtools/tooltip/arrow-horizontal-light@2x.png)
|
||||
skin/classic/aero/browser/devtools/tooltip/arrow-vertical-light.png (../shared/devtools/tooltip/arrow-vertical-light.png)
|
||||
skin/classic/aero/browser/devtools/tooltip/arrow-vertical-light@2x.png (../shared/devtools/tooltip/arrow-vertical-light@2x.png)
|
||||
|
||||
% override chrome://browser/skin/sync-horizontalbar.png chrome://browser/skin/sync-horizontalbar-XPVista7.png os=WINNT osversion<6.2
|
||||
% override chrome://browser/skin/syncProgress-horizontalbar.png chrome://browser/skin/syncProgress-horizontalbar-XPVista7.png os=WINNT osversion<6.2
|
||||
|
BIN
browser/themes/windows/sync-horizontalbar-XPVista7.png
Normal file
After Width: | Height: | Size: 721 B |
BIN
browser/themes/windows/sync-horizontalbar.png
Normal file
After Width: | Height: | Size: 546 B |
BIN
browser/themes/windows/syncProgress-horizontalbar-XPVista7.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
browser/themes/windows/syncProgress-horizontalbar.png
Normal file
After Width: | Height: | Size: 370 B |
24
build/autoconf/hotfixes.m4
Normal file
@ -0,0 +1,24 @@
|
||||
dnl This Source Code Form is subject to the terms of the Mozilla Public
|
||||
dnl dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
dnl dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
dnl Set of hotfixes to address issues in autoconf 2.13
|
||||
|
||||
dnl Divert AC_CHECK_FUNC so that the #includes it uses can't interfere
|
||||
dnl with the function it tests.
|
||||
dnl So, when testing e.g. posix_memalign, any #include that AC_CHECK_FUNC
|
||||
dnl prints is replaced with:
|
||||
dnl #define posix_memalign innocuous_posix_memalign
|
||||
dnl #include "theinclude"
|
||||
dnl #undef posix_memalign
|
||||
dnl This avoids double declaration of that function when the header normally
|
||||
dnl declares it, while the test itself is just expecting the function not to be
|
||||
dnl declared at all, and declares it differently (which doesn't matter for the
|
||||
dnl test itself).
|
||||
dnl More recent versions of autoconf are essentially doing this.
|
||||
define([ac_cv_func_], [ac_cv_func2_])dnl
|
||||
define([_AC_CHECK_FUNC],defn([AC_CHECK_FUNC]))dnl
|
||||
define([AC_CHECK_FUNC], [dnl
|
||||
patsubst(_AC_CHECK_FUNC($@), [#include.*], [#define $1 innocuous_$1
|
||||
\&
|
||||
#undef $1])])dnl
|
@ -5,3 +5,20 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME']
|
||||
|
||||
main = add_android_eclipse_project('Robocop', OBJDIR + '/AndroidManifest.xml')
|
||||
main.package_name = 'org.mozilla.roboexample.test'
|
||||
main.res = SRCDIR + '/res'
|
||||
main.recursive_make_targets += [
|
||||
OBJDIR + '/AndroidManifest.xml',
|
||||
TOPOBJDIR + '/mobile/android/base/tests/TestConstants.java']
|
||||
main.extra_jars += [SRCDIR + '/robotium-solo-4.3.1.jar']
|
||||
main.assets = TOPSRCDIR + '/mobile/android/base/tests/assets'
|
||||
main.referenced_projects += ['Fennec']
|
||||
|
||||
main.add_classpathentry('harness', SRCDIR,
|
||||
dstdir='harness/org/mozilla/gecko')
|
||||
main.add_classpathentry('src', TOPSRCDIR + '/mobile/android/base/tests',
|
||||
dstdir='src/org/mozilla/gecko/tests')
|
||||
main.add_classpathentry('generated', TOPOBJDIR + '/mobile/android/base/tests',
|
||||
dstdir='generated/org/mozilla/gecko/tests')
|
||||
|
@ -20,7 +20,7 @@ interface nsIContentSecurityPolicy;
|
||||
[ptr] native JSPrincipals(JSPrincipals);
|
||||
[ptr] native PrincipalArray(nsTArray<nsCOMPtr<nsIPrincipal> >);
|
||||
|
||||
[scriptable, builtinclass, uuid(f09d8a53-a6c8-4f68-b329-9a76a709d24e)]
|
||||
[scriptable, builtinclass, uuid(204555e7-04ad-4cc8-9f0e-840615cc43e8)]
|
||||
interface nsIPrincipal : nsISerializable
|
||||
{
|
||||
/**
|
||||
@ -31,9 +31,9 @@ interface nsIPrincipal : nsISerializable
|
||||
boolean equals(in nsIPrincipal other);
|
||||
|
||||
/**
|
||||
* Like equals, but doesn't take document.domain changes into account.
|
||||
* Like equals, but takes document.domain changes into account.
|
||||
*/
|
||||
boolean equalsIgnoringDomain(in nsIPrincipal other);
|
||||
boolean equalsConsideringDomain(in nsIPrincipal other);
|
||||
|
||||
%{C++
|
||||
inline bool Equals(nsIPrincipal* aOther) {
|
||||
@ -41,9 +41,9 @@ interface nsIPrincipal : nsISerializable
|
||||
return NS_SUCCEEDED(Equals(aOther, &equal)) && equal;
|
||||
}
|
||||
|
||||
inline bool EqualsIgnoringDomain(nsIPrincipal* aOther) {
|
||||
inline bool EqualsConsideringDomain(nsIPrincipal* aOther) {
|
||||
bool equal = false;
|
||||
return NS_SUCCEEDED(EqualsIgnoringDomain(aOther, &equal)) && equal;
|
||||
return NS_SUCCEEDED(EqualsConsideringDomain(aOther, &equal)) && equal;
|
||||
}
|
||||
%}
|
||||
|
||||
@ -91,10 +91,10 @@ interface nsIPrincipal : nsISerializable
|
||||
boolean subsumes(in nsIPrincipal other);
|
||||
|
||||
/**
|
||||
* Same as the previous method, subsumes(), but for codebase principals
|
||||
* ignores changes to document.domain.
|
||||
* Same as the previous method, subsumes(), but takes document.domain into
|
||||
* account.
|
||||
*/
|
||||
boolean subsumesIgnoringDomain(in nsIPrincipal other);
|
||||
boolean subsumesConsideringDomain(in nsIPrincipal other);
|
||||
|
||||
%{C++
|
||||
inline bool Subsumes(nsIPrincipal* aOther) {
|
||||
@ -102,9 +102,9 @@ interface nsIPrincipal : nsISerializable
|
||||
return NS_SUCCEEDED(Subsumes(aOther, &subsumes)) && subsumes;
|
||||
}
|
||||
|
||||
inline bool SubsumesIgnoringDomain(nsIPrincipal* aOther) {
|
||||
inline bool SubsumesConsideringDomain(nsIPrincipal* aOther) {
|
||||
bool subsumes = false;
|
||||
return NS_SUCCEEDED(SubsumesIgnoringDomain(aOther, &subsumes)) && subsumes;
|
||||
return NS_SUCCEEDED(SubsumesConsideringDomain(aOther, &subsumes)) && subsumes;
|
||||
}
|
||||
%}
|
||||
|
||||
|
@ -51,14 +51,14 @@ public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSISERIALIZABLE
|
||||
NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD EqualsIgnoringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD EqualsConsideringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD GetHashValue(uint32_t* aHashValue);
|
||||
NS_IMETHOD GetURI(nsIURI** aURI);
|
||||
NS_IMETHOD GetDomain(nsIURI** aDomain);
|
||||
NS_IMETHOD SetDomain(nsIURI* aDomain);
|
||||
NS_IMETHOD GetOrigin(char** aOrigin);
|
||||
NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD SubsumesIgnoringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD SubsumesConsideringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD CheckMayLoad(nsIURI* uri, bool report, bool allowIfInheritsPrincipal);
|
||||
NS_IMETHOD GetJarPrefix(nsACString& aJarPrefix);
|
||||
NS_IMETHOD GetAppStatus(uint16_t* aAppStatus);
|
||||
@ -134,14 +134,14 @@ public:
|
||||
NS_DECL_NSIEXPANDEDPRINCIPAL
|
||||
NS_DECL_NSISERIALIZABLE
|
||||
NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD EqualsIgnoringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD EqualsConsideringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD GetHashValue(uint32_t* aHashValue);
|
||||
NS_IMETHOD GetURI(nsIURI** aURI);
|
||||
NS_IMETHOD GetDomain(nsIURI** aDomain);
|
||||
NS_IMETHOD SetDomain(nsIURI* aDomain);
|
||||
NS_IMETHOD GetOrigin(char** aOrigin);
|
||||
NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD SubsumesIgnoringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD SubsumesConsideringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD CheckMayLoad(nsIURI* uri, bool report, bool allowIfInheritsPrincipal);
|
||||
NS_IMETHOD GetJarPrefix(nsACString& aJarPrefix);
|
||||
NS_IMETHOD GetAppStatus(uint16_t* aAppStatus);
|
||||
|
@ -75,9 +75,6 @@ public:
|
||||
ReportError(JSContext* cx, const nsAString& messageTag,
|
||||
nsIURI* aSource, nsIURI* aTarget);
|
||||
|
||||
static nsresult
|
||||
CheckSameOriginPrincipal(nsIPrincipal* aSubject,
|
||||
nsIPrincipal* aObject);
|
||||
static uint32_t
|
||||
HashPrincipalByOrigin(nsIPrincipal* aPrincipal);
|
||||
|
||||
@ -128,19 +125,6 @@ private:
|
||||
// when this happens -- this means that there was no JS running.
|
||||
nsIPrincipal*
|
||||
doGetSubjectPrincipal(nsresult* rv);
|
||||
|
||||
nsresult
|
||||
CheckPropertyAccessImpl(uint32_t aAction,
|
||||
nsAXPCNativeCallContext* aCallContext,
|
||||
JSContext* cx, JSObject* aJSObject,
|
||||
nsISupports* aObj,
|
||||
nsIClassInfo* aClassInfo,
|
||||
const char* aClassName, jsid aProperty);
|
||||
|
||||
nsresult
|
||||
CheckSameOriginDOMProp(nsIPrincipal* aSubject,
|
||||
nsIPrincipal* aObject,
|
||||
uint32_t aAction);
|
||||
|
||||
nsresult
|
||||
GetCodebasePrincipalInternal(nsIURI* aURI, uint32_t aAppId,
|
||||
|
@ -134,7 +134,7 @@ nsNullPrincipal::Equals(nsIPrincipal *aOther, bool *aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipal::EqualsIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
nsNullPrincipal::EqualsConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
return Equals(aOther, aResult);
|
||||
}
|
||||
@ -211,7 +211,7 @@ nsNullPrincipal::Subsumes(nsIPrincipal *aOther, bool *aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipal::SubsumesIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
nsNullPrincipal::SubsumesConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
return Subsumes(aOther, aResult);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ nsPrincipal::GetOrigin(char **aOrigin)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrincipal::Equals(nsIPrincipal *aOther, bool *aResult)
|
||||
nsPrincipal::EqualsConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
*aResult = false;
|
||||
|
||||
@ -245,14 +245,36 @@ nsPrincipal::Equals(nsIPrincipal *aOther, bool *aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Codebases are equal if they have the same origin.
|
||||
*aResult = NS_SUCCEEDED(
|
||||
nsScriptSecurityManager::CheckSameOriginPrincipal(this, aOther));
|
||||
if (!nsScriptSecurityManager::AppAttributesEqual(this, aOther)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If either the subject or the object has changed its principal by
|
||||
// explicitly setting document.domain then the other must also have
|
||||
// done so in order to be considered the same origin. This prevents
|
||||
// DNS spoofing based on document.domain (154930)
|
||||
|
||||
nsCOMPtr<nsIURI> thisURI;
|
||||
this->GetDomain(getter_AddRefs(thisURI));
|
||||
bool thisSetDomain = !!thisURI;
|
||||
if (!thisURI) {
|
||||
this->GetURI(getter_AddRefs(thisURI));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> otherURI;
|
||||
aOther->GetDomain(getter_AddRefs(otherURI));
|
||||
bool otherSetDomain = !!otherURI;
|
||||
if (!otherURI) {
|
||||
aOther->GetURI(getter_AddRefs(otherURI));
|
||||
}
|
||||
|
||||
*aResult = thisSetDomain == otherSetDomain &&
|
||||
nsScriptSecurityManager::SecurityCompareURIs(thisURI, otherURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrincipal::EqualsIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
nsPrincipal::Equals(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
*aResult = false;
|
||||
|
||||
@ -292,9 +314,9 @@ nsPrincipal::Subsumes(nsIPrincipal *aOther, bool *aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrincipal::SubsumesIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
nsPrincipal::SubsumesConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
return EqualsIgnoringDomain(aOther, aResult);
|
||||
return EqualsConsideringDomain(aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -639,15 +661,15 @@ typedef nsresult (NS_STDCALL nsIPrincipal::*nsIPrincipalMemFn)(nsIPrincipal* aOt
|
||||
bool* aResult);
|
||||
#define CALL_MEMBER_FUNCTION(THIS,MEM_FN) ((THIS)->*(MEM_FN))
|
||||
|
||||
// nsExpandedPrincipal::Equals and nsExpandedPrincipal::EqualsIgnoringDomain
|
||||
// nsExpandedPrincipal::Equals and nsExpandedPrincipal::EqualsConsideringDomain
|
||||
// shares the same logic. The difference only that Equals requires 'this'
|
||||
// and 'aOther' to Subsume each other while EqualsIgnoringDomain requires
|
||||
// bidirectional SubsumesIgnoringDomain.
|
||||
// and 'aOther' to Subsume each other while EqualsConsideringDomain requires
|
||||
// bidirectional SubsumesConsideringDomain.
|
||||
static nsresult
|
||||
Equals(nsExpandedPrincipal* aThis, nsIPrincipalMemFn aFn, nsIPrincipal* aOther,
|
||||
bool* aResult)
|
||||
{
|
||||
// If (and only if) 'aThis' and 'aOther' both Subsume/SubsumesIgnoringDomain
|
||||
// If (and only if) 'aThis' and 'aOther' both Subsume/SubsumesConsideringDomain
|
||||
// each other, then they are Equal.
|
||||
*aResult = false;
|
||||
// Calling the corresponding subsume function on this (aFn).
|
||||
@ -669,14 +691,14 @@ nsExpandedPrincipal::Equals(nsIPrincipal* aOther, bool* aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExpandedPrincipal::EqualsIgnoringDomain(nsIPrincipal* aOther, bool* aResult)
|
||||
nsExpandedPrincipal::EqualsConsideringDomain(nsIPrincipal* aOther, bool* aResult)
|
||||
{
|
||||
return ::Equals(this, &nsIPrincipal::SubsumesIgnoringDomain, aOther, aResult);
|
||||
return ::Equals(this, &nsIPrincipal::SubsumesConsideringDomain, aOther, aResult);
|
||||
}
|
||||
|
||||
// nsExpandedPrincipal::Subsumes and nsExpandedPrincipal::SubsumesIgnoringDomain
|
||||
// nsExpandedPrincipal::Subsumes and nsExpandedPrincipal::SubsumesConsideringDomain
|
||||
// shares the same logic. The difference only that Subsumes calls are replaced
|
||||
//with SubsumesIgnoringDomain calls in the second case.
|
||||
//with SubsumesConsideringDomain calls in the second case.
|
||||
static nsresult
|
||||
Subsumes(nsExpandedPrincipal* aThis, nsIPrincipalMemFn aFn, nsIPrincipal* aOther,
|
||||
bool* aResult)
|
||||
@ -721,9 +743,9 @@ nsExpandedPrincipal::Subsumes(nsIPrincipal* aOther, bool* aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExpandedPrincipal::SubsumesIgnoringDomain(nsIPrincipal* aOther, bool* aResult)
|
||||
nsExpandedPrincipal::SubsumesConsideringDomain(nsIPrincipal* aOther, bool* aResult)
|
||||
{
|
||||
return ::Subsumes(this, &nsIPrincipal::SubsumesIgnoringDomain, aOther, aResult);
|
||||
return ::Subsumes(this, &nsIPrincipal::SubsumesConsideringDomain, aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -486,71 +486,6 @@ nsScriptSecurityManager::CheckSameOriginURI(nsIURI* aSourceURI,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
nsScriptSecurityManager::CheckSameOriginPrincipal(nsIPrincipal* aSubject,
|
||||
nsIPrincipal* aObject)
|
||||
{
|
||||
/*
|
||||
** Get origin of subject and object and compare.
|
||||
*/
|
||||
if (aSubject == aObject)
|
||||
return NS_OK;
|
||||
|
||||
if (!AppAttributesEqual(aSubject, aObject)) {
|
||||
return NS_ERROR_DOM_PROP_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
// Default to false, and change if that turns out wrong.
|
||||
bool subjectSetDomain = false;
|
||||
bool objectSetDomain = false;
|
||||
|
||||
nsCOMPtr<nsIURI> subjectURI;
|
||||
nsCOMPtr<nsIURI> objectURI;
|
||||
|
||||
aSubject->GetDomain(getter_AddRefs(subjectURI));
|
||||
if (!subjectURI) {
|
||||
aSubject->GetURI(getter_AddRefs(subjectURI));
|
||||
} else {
|
||||
subjectSetDomain = true;
|
||||
}
|
||||
|
||||
aObject->GetDomain(getter_AddRefs(objectURI));
|
||||
if (!objectURI) {
|
||||
aObject->GetURI(getter_AddRefs(objectURI));
|
||||
} else {
|
||||
objectSetDomain = true;
|
||||
}
|
||||
|
||||
if (SecurityCompareURIs(subjectURI, objectURI))
|
||||
{ // If either the subject or the object has changed its principal by
|
||||
// explicitly setting document.domain then the other must also have
|
||||
// done so in order to be considered the same origin. This prevents
|
||||
// DNS spoofing based on document.domain (154930)
|
||||
|
||||
// If both or neither explicitly set their domain, allow the access
|
||||
if (subjectSetDomain == objectSetDomain)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Access tests failed, so now report error.
|
||||
*/
|
||||
return NS_ERROR_DOM_PROP_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
// It's important that
|
||||
//
|
||||
// CheckSameOriginPrincipal(A, B) == NS_OK
|
||||
//
|
||||
// imply
|
||||
//
|
||||
// HashPrincipalByOrigin(A) == HashPrincipalByOrigin(B)
|
||||
//
|
||||
// if principals A and B could ever be used as keys in a hashtable.
|
||||
// Violation of this invariant leads to spurious failures of hashtable
|
||||
// lookups. See bug 454850.
|
||||
|
||||
/*static*/ uint32_t
|
||||
nsScriptSecurityManager::HashPrincipalByOrigin(nsIPrincipal* aPrincipal)
|
||||
{
|
||||
@ -581,33 +516,6 @@ nsScriptSecurityManager::AppAttributesEqual(nsIPrincipal* aFirst,
|
||||
(aFirst->GetIsInBrowserElement() == aSecond->GetIsInBrowserElement()));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptSecurityManager::CheckSameOriginDOMProp(nsIPrincipal* aSubject,
|
||||
nsIPrincipal* aObject,
|
||||
uint32_t aAction)
|
||||
{
|
||||
nsresult rv;
|
||||
bool subsumes;
|
||||
rv = aSubject->Subsumes(aObject, &subsumes);
|
||||
if (NS_SUCCEEDED(rv) && !subsumes) {
|
||||
rv = NS_ERROR_DOM_PROP_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return NS_OK;
|
||||
|
||||
/*
|
||||
* Content can't ever touch chrome (we check for UniversalXPConnect later)
|
||||
*/
|
||||
if (aObject == mSystemPrincipal)
|
||||
return NS_ERROR_DOM_PROP_ACCESS_DENIED;
|
||||
|
||||
/*
|
||||
** Access tests failed, so now report error.
|
||||
*/
|
||||
return NS_ERROR_DOM_PROP_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::CheckLoadURIFromScript(JSContext *cx, nsIURI *aURI)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ nsSystemPrincipal::Equals(nsIPrincipal *other, bool *result)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSystemPrincipal::EqualsIgnoringDomain(nsIPrincipal *other, bool *result)
|
||||
nsSystemPrincipal::EqualsConsideringDomain(nsIPrincipal *other, bool *result)
|
||||
{
|
||||
return Equals(other, result);
|
||||
}
|
||||
@ -92,7 +92,7 @@ nsSystemPrincipal::Subsumes(nsIPrincipal *other, bool *result)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSystemPrincipal::SubsumesIgnoringDomain(nsIPrincipal *other, bool *result)
|
||||
nsSystemPrincipal::SubsumesConsideringDomain(nsIPrincipal *other, bool *result)
|
||||
{
|
||||
*result = true;
|
||||
return NS_OK;
|
||||
|
@ -1,3 +1,7 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
file_disableScript.html
|
||||
|
||||
[test_disableScript.xul]
|
||||
[test_principal_jarprefix_origin_appid_appstatus.html]
|
||||
# jarPrefix test doesn't work on Windows, see bug 776296.
|
||||
|
@ -14,7 +14,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=840488
|
||||
target="_blank">Mozilla Bug 840488</a>
|
||||
</body>
|
||||
|
||||
<iframe id="root" name="root" onload="go();" type="content"/>
|
||||
<iframe id="root" name="root" type="content"/>
|
||||
<iframe id="chromeFrame" name="chromeFrame" type="content"/>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
@ -32,7 +33,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=840488
|
||||
const path = "/tests/caps/tests/mochitest/file_disableScript.html";
|
||||
const uri = "http://www.example.com" + path;
|
||||
var rootFrame = document.getElementById('root');
|
||||
rootFrame.setAttribute('src', uri + "?name=rootframe");
|
||||
var chromeFrame = document.getElementById('chromeFrame');
|
||||
navigateFrame(rootFrame, uri + "?name=rootframe").then(function() {
|
||||
navigateFrame(chromeFrame, "file_disableScript.html").then(go);
|
||||
});
|
||||
|
||||
function navigateFrame(ifr, src) {
|
||||
let deferred = Promise.defer();
|
||||
@ -137,16 +141,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=840488
|
||||
}
|
||||
|
||||
function go() {
|
||||
rootFrame.setAttribute('onload', null);
|
||||
var rootWin = rootFrame.contentWindow;
|
||||
var chromeWin = chromeFrame.contentWindow;
|
||||
|
||||
// Test simple docshell enable/disable.
|
||||
var rootWin = rootFrame.contentWindow;
|
||||
checkScriptEnabled(rootWin, true);
|
||||
setScriptEnabledForDocShell(rootWin, false);
|
||||
checkScriptEnabled(rootWin, false);
|
||||
setScriptEnabledForDocShell(rootWin, true);
|
||||
checkScriptEnabled(rootWin, true);
|
||||
|
||||
// Privileged frames are immune to docshell flags.
|
||||
ok(ssm.isSystemPrincipal(chromeWin.document.nodePrincipal), "Sanity check for System Principal");
|
||||
setScriptEnabledForDocShell(chromeWin, false);
|
||||
checkScriptEnabled(chromeWin, true);
|
||||
setScriptEnabledForDocShell(chromeWin, true);
|
||||
|
||||
// Play around with the docshell tree and make sure everything works as
|
||||
// we expect.
|
||||
addFrame(rootWin, 'parent', true).then(function() {
|
||||
@ -209,6 +219,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=840488
|
||||
return reloadFrame(rootFrame);
|
||||
}).then(function() {
|
||||
checkScriptEnabled(rootWin, false);
|
||||
checkScriptEnabled(chromeWin, true);
|
||||
setScriptEnabledForBrowser(true);
|
||||
return reloadFrame(rootFrame);
|
||||
}).then(function() {
|
||||
@ -223,6 +234,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=840488
|
||||
Cu.unblockScriptForGlobal(rootWin);
|
||||
checkScriptEnabled(rootWin, true);
|
||||
Cu.blockScriptForGlobal(rootWin);
|
||||
try {
|
||||
Cu.blockScriptForGlobal(chromeWin);
|
||||
ok(false, "Should have thrown");
|
||||
} catch (e) {
|
||||
ok(/may not be disabled/.test(e),
|
||||
"Shouldn't be able to programmatically block script for system globals");
|
||||
}
|
||||
return reloadFrame(rootFrame);
|
||||
}).then(function() {
|
||||
checkScriptEnabled(rootWin, true);
|
||||
|
@ -5665,10 +5665,6 @@ already_AddRefed<nsINode>
|
||||
nsIDocument::ImportNode(nsINode& aNode, bool aDeep, ErrorResult& rv) const
|
||||
{
|
||||
nsINode* imported = &aNode;
|
||||
rv = nsContentUtils::CheckSameOrigin(this, imported);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
switch (imported->NodeType()) {
|
||||
case nsIDOMNode::ATTRIBUTE_NODE:
|
||||
@ -5925,12 +5921,6 @@ nsIDocument::CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
|
||||
ErrorResult& rv) const
|
||||
{
|
||||
nsINode* root = &aRoot;
|
||||
nsresult res = nsContentUtils::CheckSameOrigin(this, root);
|
||||
if (NS_FAILED(res)) {
|
||||
rv.Throw(res);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<NodeIterator> iterator = new NodeIterator(root, aWhatToShow,
|
||||
aFilter);
|
||||
return iterator.forget();
|
||||
@ -5974,12 +5964,6 @@ nsIDocument::CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
|
||||
ErrorResult& rv) const
|
||||
{
|
||||
nsINode* root = &aRoot;
|
||||
nsresult res = nsContentUtils::CheckSameOrigin(this, root);
|
||||
if (NS_FAILED(res)) {
|
||||
rv.Throw(res);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<TreeWalker> walker = new TreeWalker(root, aWhatToShow, aFilter);
|
||||
return walker.forget();
|
||||
}
|
||||
@ -6688,10 +6672,6 @@ nsINode*
|
||||
nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
|
||||
{
|
||||
nsINode* adoptedNode = &aAdoptedNode;
|
||||
rv = nsContentUtils::CheckSameOrigin(this, adoptedNode);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Scope firing mutation events so that we don't carry any state that
|
||||
// might be stale
|
||||
@ -11113,16 +11093,12 @@ nsIDocument::GetMozPointerLockElement()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Make sure pointer locked element is in the same document and domain.
|
||||
// Make sure pointer locked element is in the same document.
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedDoc);
|
||||
if (pointerLockedDoc != this) {
|
||||
return nullptr;
|
||||
}
|
||||
nsresult rv = nsContentUtils::CheckSameOrigin(this, pointerLockedElement);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pointerLockedElement;
|
||||
}
|
||||
|
@ -3143,7 +3143,7 @@ nsObjectLoadingContent::GetContentDocument()
|
||||
}
|
||||
|
||||
// Return null for cross-origin contentDocument.
|
||||
if (!nsContentUtils::GetSubjectPrincipal()->Subsumes(sub_doc->NodePrincipal())) {
|
||||
if (!nsContentUtils::GetSubjectPrincipal()->SubsumesConsideringDomain(sub_doc->NodePrincipal())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -56,13 +56,7 @@ DoDrawImageSecurityCheck(dom::HTMLCanvasElement *aCanvasElement,
|
||||
if (CORSUsed)
|
||||
return;
|
||||
|
||||
// Ignore document.domain in this check.
|
||||
bool subsumes;
|
||||
nsresult rv =
|
||||
aCanvasElement->NodePrincipal()->SubsumesIgnoringDomain(aPrincipal,
|
||||
&subsumes);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && subsumes) {
|
||||
if (aCanvasElement->NodePrincipal()->Subsumes(aPrincipal)) {
|
||||
// This canvas has access to that image anyway
|
||||
return;
|
||||
}
|
||||
|
@ -895,6 +895,7 @@ protected:
|
||||
// -------------------------------------------------------------------------
|
||||
// WebGL extensions (implemented in WebGLContextExtensions.cpp)
|
||||
enum WebGLExtensionID {
|
||||
EXT_frag_depth,
|
||||
EXT_sRGB,
|
||||
EXT_texture_filter_anisotropic,
|
||||
OES_element_index_uint,
|
||||
|
@ -17,6 +17,7 @@ using namespace mozilla::gl;
|
||||
|
||||
// must match WebGLContext::WebGLExtensionID
|
||||
static const char *sExtensionNames[] = {
|
||||
"EXT_frag_depth",
|
||||
"EXT_sRGB",
|
||||
"EXT_texture_filter_anisotropic",
|
||||
"OES_element_index_uint",
|
||||
@ -139,6 +140,8 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
|
||||
return WebGLExtensionSRGB::IsSupported(this);
|
||||
case WEBGL_draw_buffers:
|
||||
return WebGLExtensionDrawBuffers::IsSupported(this);
|
||||
case EXT_frag_depth:
|
||||
return WebGLExtensionFragDepth::IsSupported(this);
|
||||
default:
|
||||
// For warnings-as-errors.
|
||||
break;
|
||||
@ -295,6 +298,9 @@ WebGLContext::EnableExtension(WebGLExtensionID ext)
|
||||
case EXT_sRGB:
|
||||
obj = new WebGLExtensionSRGB(this);
|
||||
break;
|
||||
case EXT_frag_depth:
|
||||
obj = new WebGLExtensionFragDepth(this);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false, "should not get there.");
|
||||
}
|
||||
|
@ -530,6 +530,18 @@ WebGLContext::CopyTexImage2D(GLenum target,
|
||||
return ErrorInvalidValue("copyTexImage2D: with level > 0, width and height must be powers of two");
|
||||
}
|
||||
|
||||
if (internalformat == LOCAL_GL_DEPTH_COMPONENT ||
|
||||
internalformat == LOCAL_GL_DEPTH_STENCIL)
|
||||
return ErrorInvalidOperation("copyTexImage2D: a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL isn't supported");
|
||||
|
||||
WebGLTexture *tex = activeBoundTextureForTarget(target);
|
||||
if (!tex)
|
||||
return ErrorInvalidOperation("copyTexImage2D: no texture bound to this target");
|
||||
|
||||
if (mBoundFramebuffer)
|
||||
if (!mBoundFramebuffer->CheckAndInitializeAttachments())
|
||||
return ErrorInvalidFramebufferOperation("copyTexImage2D: incomplete framebuffer");
|
||||
|
||||
bool texFormatRequiresAlpha = internalformat == LOCAL_GL_RGBA ||
|
||||
internalformat == LOCAL_GL_ALPHA ||
|
||||
internalformat == LOCAL_GL_LUMINANCE_ALPHA;
|
||||
@ -539,18 +551,6 @@ WebGLContext::CopyTexImage2D(GLenum target,
|
||||
return ErrorInvalidOperation("copyTexImage2D: texture format requires an alpha channel "
|
||||
"but the framebuffer doesn't have one");
|
||||
|
||||
if (internalformat == LOCAL_GL_DEPTH_COMPONENT ||
|
||||
internalformat == LOCAL_GL_DEPTH_STENCIL)
|
||||
return ErrorInvalidOperation("copyTexImage2D: a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL isn't supported");
|
||||
|
||||
if (mBoundFramebuffer)
|
||||
if (!mBoundFramebuffer->CheckAndInitializeAttachments())
|
||||
return ErrorInvalidFramebufferOperation("copyTexImage2D: incomplete framebuffer");
|
||||
|
||||
WebGLTexture *tex = activeBoundTextureForTarget(target);
|
||||
if (!tex)
|
||||
return ErrorInvalidOperation("copyTexImage2D: no texture bound to this target");
|
||||
|
||||
// copyTexImage2D only generates textures with type = UNSIGNED_BYTE
|
||||
GLenum type = LOCAL_GL_UNSIGNED_BYTE;
|
||||
|
||||
@ -639,16 +639,6 @@ WebGLContext::CopyTexSubImage2D(GLenum target,
|
||||
return ErrorInvalidValue("copyTexSubImage2D: yoffset+height is too large");
|
||||
|
||||
GLenum internalFormat = imageInfo.InternalFormat();
|
||||
bool texFormatRequiresAlpha = (internalFormat == LOCAL_GL_RGBA ||
|
||||
internalFormat == LOCAL_GL_ALPHA ||
|
||||
internalFormat == LOCAL_GL_LUMINANCE_ALPHA);
|
||||
bool fboFormatHasAlpha = mBoundFramebuffer ? mBoundFramebuffer->ColorAttachment(0).HasAlpha()
|
||||
: bool(gl->GetPixelFormat().alpha > 0);
|
||||
|
||||
if (texFormatRequiresAlpha && !fboFormatHasAlpha)
|
||||
return ErrorInvalidOperation("copyTexSubImage2D: texture format requires an alpha channel "
|
||||
"but the framebuffer doesn't have one");
|
||||
|
||||
if (IsGLDepthFormat(internalFormat) ||
|
||||
IsGLDepthStencilFormat(internalFormat))
|
||||
{
|
||||
@ -659,6 +649,16 @@ WebGLContext::CopyTexSubImage2D(GLenum target,
|
||||
if (!mBoundFramebuffer->CheckAndInitializeAttachments())
|
||||
return ErrorInvalidFramebufferOperation("copyTexSubImage2D: incomplete framebuffer");
|
||||
|
||||
bool texFormatRequiresAlpha = (internalFormat == LOCAL_GL_RGBA ||
|
||||
internalFormat == LOCAL_GL_ALPHA ||
|
||||
internalFormat == LOCAL_GL_LUMINANCE_ALPHA);
|
||||
bool fboFormatHasAlpha = mBoundFramebuffer ? mBoundFramebuffer->ColorAttachment(0).HasAlpha()
|
||||
: bool(gl->GetPixelFormat().alpha > 0);
|
||||
|
||||
if (texFormatRequiresAlpha && !fboFormatHasAlpha)
|
||||
return ErrorInvalidOperation("copyTexSubImage2D: texture format requires an alpha channel "
|
||||
"but the framebuffer doesn't have one");
|
||||
|
||||
if (imageInfo.HasUninitializedImageData()) {
|
||||
tex->DoDeferredImageInitialization(target, level);
|
||||
}
|
||||
@ -3087,6 +3087,9 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
||||
resources.MaxFragmentUniformVectors = mGLMaxFragmentUniformVectors;
|
||||
resources.MaxDrawBuffers = mGLMaxDrawBuffers;
|
||||
|
||||
if (IsExtensionEnabled(EXT_frag_depth))
|
||||
resources.EXT_frag_depth = 1;
|
||||
|
||||
if (IsExtensionEnabled(OES_standard_derivatives))
|
||||
resources.OES_standard_derivatives = 1;
|
||||
|
||||
|
33
content/canvas/src/WebGLExtensionFragDepth.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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 "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
#include "GLContext.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionFragDepth::WebGLExtensionFragDepth(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
MOZ_ASSERT(IsSupported(context),
|
||||
"Should not construct extension object if unsupported.");
|
||||
}
|
||||
|
||||
WebGLExtensionFragDepth::~WebGLExtensionFragDepth()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLExtensionFragDepth::IsSupported(const WebGLContext* context)
|
||||
{
|
||||
gl::GLContext* gl = context->GL();
|
||||
|
||||
return gl->IsSupported(gl::GLFeature::frag_depth);
|
||||
}
|
||||
|
||||
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionFragDepth)
|
@ -108,6 +108,18 @@ public:
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionFragDepth
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionFragDepth(WebGLContext*);
|
||||
virtual ~WebGLExtensionFragDepth();
|
||||
|
||||
static bool IsSupported(const WebGLContext* context);
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionLoseContext
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
|
@ -50,6 +50,8 @@ WebGLFramebuffer::Attachment::IsDeleteRequested() const
|
||||
bool
|
||||
WebGLFramebuffer::Attachment::HasAlpha() const
|
||||
{
|
||||
MOZ_ASSERT(HasImage());
|
||||
|
||||
GLenum format = 0;
|
||||
if (Texture() && Texture()->HasImageInfoAt(mTexImageTarget, mTexImageLevel))
|
||||
format = Texture()->ImageInfoAt(mTexImageTarget, mTexImageLevel).InternalFormat();
|
||||
@ -75,7 +77,9 @@ WebGLFramebuffer::Attachment::HasUninitializedImageData() const
|
||||
|
||||
if (Renderbuffer()) {
|
||||
return Renderbuffer()->HasUninitializedImageData();
|
||||
} else if (Texture()) {
|
||||
}
|
||||
|
||||
if (Texture()) {
|
||||
MOZ_ASSERT(Texture()->HasImageInfoAt(mTexImageTarget, mTexImageLevel));
|
||||
return Texture()->ImageInfoAt(mTexImageTarget, mTexImageLevel).HasUninitializedImageData();
|
||||
}
|
||||
@ -90,11 +94,13 @@ WebGLFramebuffer::Attachment::SetImageDataStatus(WebGLImageDataStatus newStatus)
|
||||
if (!HasImage())
|
||||
return;
|
||||
|
||||
if (mRenderbufferPtr) {
|
||||
mRenderbufferPtr->SetImageDataStatus(newStatus);
|
||||
if (Renderbuffer()) {
|
||||
Renderbuffer()->SetImageDataStatus(newStatus);
|
||||
return;
|
||||
} else if (mTexturePtr) {
|
||||
mTexturePtr->SetImageDataStatus(mTexImageTarget, mTexImageLevel, newStatus);
|
||||
}
|
||||
|
||||
if (Texture()) {
|
||||
Texture()->SetImageDataStatus(mTexImageTarget, mTexImageLevel, newStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -106,7 +112,8 @@ WebGLFramebuffer::Attachment::HasImage() const
|
||||
{
|
||||
if (Texture() && Texture()->HasImageInfoAt(mTexImageTarget, mTexImageLevel))
|
||||
return true;
|
||||
else if (Renderbuffer())
|
||||
|
||||
if (Renderbuffer())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -120,7 +127,9 @@ WebGLFramebuffer::Attachment::RectangleObject() const
|
||||
if (Texture()) {
|
||||
MOZ_ASSERT(Texture()->HasImageInfoAt(mTexImageTarget, mTexImageLevel));
|
||||
return Texture()->ImageInfoAt(mTexImageTarget, mTexImageLevel);
|
||||
} else if (Renderbuffer()) {
|
||||
}
|
||||
|
||||
if (Renderbuffer()) {
|
||||
return *Renderbuffer();
|
||||
}
|
||||
|
||||
@ -228,10 +237,10 @@ WebGLFramebuffer::Attachment::IsComplete() const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mTexturePtr) {
|
||||
MOZ_ASSERT(mTexturePtr->HasImageInfoAt(mTexImageTarget, mTexImageLevel));
|
||||
if (Texture()) {
|
||||
MOZ_ASSERT(Texture()->HasImageInfoAt(mTexImageTarget, mTexImageLevel));
|
||||
const WebGLTexture::ImageInfo& imageInfo =
|
||||
mTexturePtr->ImageInfoAt(mTexImageTarget, mTexImageLevel);
|
||||
Texture()->ImageInfoAt(mTexImageTarget, mTexImageLevel);
|
||||
GLenum internalFormat = imageInfo.InternalFormat();
|
||||
|
||||
if (mAttachmentPoint == LOCAL_GL_DEPTH_ATTACHMENT)
|
||||
@ -250,8 +259,8 @@ WebGLFramebuffer::Attachment::IsComplete() const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mRenderbufferPtr) {
|
||||
GLenum internalFormat = mRenderbufferPtr->InternalFormat();
|
||||
if (Renderbuffer()) {
|
||||
GLenum internalFormat = Renderbuffer()->InternalFormat();
|
||||
|
||||
if (mAttachmentPoint == LOCAL_GL_DEPTH_ATTACHMENT)
|
||||
return IsValidFBORenderbufferDepthFormat(internalFormat);
|
||||
@ -438,7 +447,8 @@ WebGLFramebuffer::GetAttachment(GLenum attachment) const
|
||||
void
|
||||
WebGLFramebuffer::DetachTexture(const WebGLTexture* tex)
|
||||
{
|
||||
for (size_t i = 0; i < mColorAttachments.Length(); i++) {
|
||||
size_t count = mColorAttachments.Length();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (mColorAttachments[i].Texture() == tex) {
|
||||
FramebufferTexture2D(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0, LOCAL_GL_TEXTURE_2D, nullptr, 0);
|
||||
// a texture might be attached more that once while editing the framebuffer
|
||||
@ -456,7 +466,8 @@ WebGLFramebuffer::DetachTexture(const WebGLTexture* tex)
|
||||
void
|
||||
WebGLFramebuffer::DetachRenderbuffer(const WebGLRenderbuffer* rb)
|
||||
{
|
||||
for (size_t i = 0; i < mColorAttachments.Length(); i++) {
|
||||
size_t count = mColorAttachments.Length();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (mColorAttachments[0].Renderbuffer() == rb) {
|
||||
FramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0, LOCAL_GL_RENDERBUFFER, nullptr);
|
||||
// a renderbuffer might be attached more that once while editing the framebuffer
|
||||
@ -476,7 +487,8 @@ WebGLFramebuffer::HasDefinedAttachments() const
|
||||
{
|
||||
bool hasAttachments = false;
|
||||
|
||||
for (size_t i = 0; i < mColorAttachments.Length(); i++) {
|
||||
size_t count = mColorAttachments.Length();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
hasAttachments |= mColorAttachments[i].IsDefined();
|
||||
}
|
||||
|
||||
@ -491,7 +503,7 @@ WebGLFramebuffer::HasDefinedAttachments() const
|
||||
static bool
|
||||
IsIncomplete(const WebGLFramebuffer::Attachment& cur)
|
||||
{
|
||||
return cur.IsDefined() && !cur.IsComplete();
|
||||
return cur.IsDefined() && !cur.IsComplete();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -499,7 +511,8 @@ WebGLFramebuffer::HasIncompleteAttachments() const
|
||||
{
|
||||
bool hasIncomplete = false;
|
||||
|
||||
for (size_t i = 0; i < mColorAttachments.Length(); i++) {
|
||||
size_t count = mColorAttachments.Length();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
hasIncomplete |= IsIncomplete(mColorAttachments[i]);
|
||||
}
|
||||
|
||||
@ -516,7 +529,8 @@ WebGLFramebuffer::GetAnyRectObject() const
|
||||
{
|
||||
MOZ_ASSERT(HasDefinedAttachments());
|
||||
|
||||
for (size_t i = 0; i < mColorAttachments.Length(); i++) {
|
||||
size_t count = mColorAttachments.Length();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (mColorAttachments[i].HasImage())
|
||||
return mColorAttachments[i].RectangleObject();
|
||||
}
|
||||
@ -552,7 +566,8 @@ WebGLFramebuffer::AllImageRectsMatch() const
|
||||
// Alright, we have *a* rect, let's check all the others.
|
||||
bool imageRectsMatch = true;
|
||||
|
||||
for (size_t i = 0; i < mColorAttachments.Length(); i++) {
|
||||
size_t count = mColorAttachments.Length();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (mColorAttachments[i].HasImage())
|
||||
imageRectsMatch &= RectsMatch(mColorAttachments[i], rect);
|
||||
}
|
||||
@ -591,7 +606,7 @@ WebGLFramebuffer::PrecheckFramebufferStatus() const
|
||||
return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
|
||||
|
||||
if (!AllImageRectsMatch())
|
||||
return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; // No consistent size
|
||||
return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; // Inconsistent sizes
|
||||
|
||||
if (HasDepthStencilConflict())
|
||||
return LOCAL_GL_FRAMEBUFFER_UNSUPPORTED;
|
||||
@ -616,7 +631,6 @@ WebGLFramebuffer::CheckFramebufferStatus() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool
|
||||
WebGLFramebuffer::CheckAndInitializeAttachments()
|
||||
{
|
||||
@ -626,7 +640,7 @@ WebGLFramebuffer::CheckAndInitializeAttachments()
|
||||
return false;
|
||||
|
||||
// Cool! We've checked out ok. Just need to initialize.
|
||||
size_t colorAttachmentCount = size_t(mColorAttachments.Length());
|
||||
size_t colorAttachmentCount = mColorAttachments.Length();
|
||||
|
||||
// Check if we need to initialize anything
|
||||
{
|
||||
@ -764,7 +778,8 @@ FinalizeDrawAndReadBuffers(GLContext* aGL, bool aColorBufferDefined)
|
||||
void
|
||||
WebGLFramebuffer::FinalizeAttachments() const
|
||||
{
|
||||
for (size_t i = 0; i < ColorAttachmentCount(); i++) {
|
||||
size_t count = ColorAttachmentCount();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (ColorAttachment(i).IsDefined())
|
||||
ColorAttachment(i).FinalizeAttachment(LOCAL_GL_COLOR_ATTACHMENT0 + i);
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ if CONFIG['MOZ_WEBGL']:
|
||||
'WebGLExtensionDepthTexture.cpp',
|
||||
'WebGLExtensionDrawBuffers.cpp',
|
||||
'WebGLExtensionElementIndexUint.cpp',
|
||||
'WebGLExtensionFragDepth.cpp',
|
||||
'WebGLExtensionInstancedArrays.cpp',
|
||||
'WebGLExtensionLoseContext.cpp',
|
||||
'WebGLExtensionSRGB.cpp',
|
||||
|
@ -79,7 +79,7 @@ nsGenericHTMLFrameElement::GetContentDocument()
|
||||
nsIDocument *doc = win->GetDoc();
|
||||
|
||||
// Return null for cross-origin contentDocument.
|
||||
if (!nsContentUtils::GetSubjectPrincipal()->Subsumes(doc->NodePrincipal())) {
|
||||
if (!nsContentUtils::GetSubjectPrincipal()->SubsumesConsideringDomain(doc->NodePrincipal())) {
|
||||
return nullptr;
|
||||
}
|
||||
return doc;
|
||||
|
@ -295,11 +295,7 @@ SVGFEImageElement::OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ignore document.domain in this check.
|
||||
bool subsumes;
|
||||
rv = aReferencePrincipal->SubsumesIgnoringDomain(principal, &subsumes);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && subsumes) {
|
||||
if (aReferencePrincipal->Subsumes(principal)) {
|
||||
// The page is allowed to read from the image.
|
||||
return false;
|
||||
}
|
||||
|
@ -7438,7 +7438,9 @@ JSObject* nsGlobalWindow::CallerGlobal()
|
||||
// isn't, something is screwy, and we want to clamp to the cx global.
|
||||
JS::Rooted<JSObject*> scriptedGlobal(cx, JS_GetScriptedGlobal(cx));
|
||||
JS::Rooted<JSObject*> cxGlobal(cx, JS::CurrentGlobalOrNull(cx));
|
||||
if (!xpc::AccessCheck::subsumes(cxGlobal, scriptedGlobal)) {
|
||||
nsIPrincipal* scriptedPrin = nsContentUtils::GetObjectPrincipal(scriptedGlobal);
|
||||
nsIPrincipal* cxPrin = nsContentUtils::GetObjectPrincipal(cxGlobal);
|
||||
if (!cxPrin->SubsumesConsideringDomain(scriptedPrin)) {
|
||||
NS_WARNING("Something nasty is happening! Applying countermeasures...");
|
||||
return cxGlobal;
|
||||
}
|
||||
@ -7718,7 +7720,7 @@ PostMessageEvent::Run()
|
||||
// don't do that in other places it seems better to hold the line for
|
||||
// now. Long-term, we want HTML5 to address this so that we can
|
||||
// be compliant while being safer.
|
||||
if (!targetPrin->EqualsIgnoringDomain(mProvidedPrincipal)) {
|
||||
if (!targetPrin->Equals(mProvidedPrincipal)) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ public:
|
||||
nsresult Get(nsIPrincipal* aSubject, nsIVariant** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIVariant> result;
|
||||
if (aSubject->Subsumes(mOrigin)) {
|
||||
if (aSubject->SubsumesConsideringDomain(mOrigin)) {
|
||||
result = mValue;
|
||||
} else {
|
||||
result = CreateVoidVariant();
|
||||
|
@ -2971,6 +2971,16 @@ AsmJSCacheOpenEntryForWrite(JS::Handle<JSObject*> aGlobal,
|
||||
aHandle);
|
||||
}
|
||||
|
||||
static void
|
||||
OnLargeAllocationFailure()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> os =
|
||||
mozilla::services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(nullptr, "memory-pressure", MOZ_UTF16("heap-minimize"));
|
||||
}
|
||||
}
|
||||
|
||||
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
|
||||
void
|
||||
@ -3027,6 +3037,8 @@ nsJSContext::EnsureStatics()
|
||||
};
|
||||
JS::SetAsmJSCacheOps(sRuntime, &asmJSCacheOps);
|
||||
|
||||
JS::SetLargeAllocationFailureCallback(sRuntime, OnLargeAllocationFailure);
|
||||
|
||||
// Set these global xpconnect options...
|
||||
Preferences::RegisterCallbackAndCall(ReportAllJSExceptionsPrefChangedCallback,
|
||||
"dom.report_all_js_exceptions");
|
||||
|
@ -908,7 +908,7 @@ nsLocation::CallerSubsumes()
|
||||
return false;
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(outer);
|
||||
bool subsumes = false;
|
||||
nsresult rv = nsContentUtils::GetSubjectPrincipal()->Subsumes(sop->GetPrincipal(), &subsumes);
|
||||
nsresult rv = nsContentUtils::GetSubjectPrincipal()->SubsumesConsideringDomain(sop->GetPrincipal(), &subsumes);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
return subsumes;
|
||||
}
|
||||
|
@ -1380,6 +1380,11 @@ DOMInterfaces = {
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionFragDepth': {
|
||||
'nativeType': 'mozilla::WebGLExtensionFragDepth',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionLoseContext': {
|
||||
'nativeType': 'mozilla::WebGLExtensionLoseContext',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
|
@ -319,29 +319,7 @@ DOMStorage::PrincipalEquals(nsIPrincipal* aPrincipal)
|
||||
bool
|
||||
DOMStorage::CanAccess(nsIPrincipal* aPrincipal)
|
||||
{
|
||||
// Allow C++ callers to access the storage
|
||||
if (!aPrincipal) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// For content, either the code base or domain must be the same. When code
|
||||
// base is the same, this is enough to say it is safe for a page to access
|
||||
// this storage.
|
||||
|
||||
bool subsumes;
|
||||
nsresult rv = aPrincipal->SubsumesIgnoringDomain(mPrincipal, &subsumes);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!subsumes) {
|
||||
nsresult rv = aPrincipal->Subsumes(mPrincipal, &subsumes);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return subsumes;
|
||||
return !aPrincipal || aPrincipal->Subsumes(mPrincipal);
|
||||
}
|
||||
|
||||
nsTArray<nsString>*
|
||||
|
@ -91,17 +91,7 @@ PrincipalsEqual(nsIPrincipal* aObjectPrincipal, nsIPrincipal* aSubjectPrincipal)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool equals;
|
||||
nsresult rv = aSubjectPrincipal->EqualsIgnoringDomain(aObjectPrincipal, &equals);
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && equals,
|
||||
"Trying to get DOM storage for wrong principal!");
|
||||
|
||||
if (NS_FAILED(rv) || !equals) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return aSubjectPrincipal->Equals(aObjectPrincipal);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(DOMStorageManager,
|
||||
|
@ -822,6 +822,11 @@ interface WebGLExtensionElementIndexUint
|
||||
{
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface WebGLExtensionFragDepth
|
||||
{
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface WebGLExtensionLoseContext {
|
||||
void loseContext();
|
||||
|
@ -75,7 +75,11 @@ FileReaderSync::ReadAsArrayBuffer(JSContext* aCx,
|
||||
}
|
||||
|
||||
uint32_t bufferLength = JS_GetArrayBufferByteLength(jsArrayBuffer);
|
||||
uint8_t* arrayBuffer = JS_GetArrayBufferData(jsArrayBuffer);
|
||||
uint8_t* arrayBuffer = JS_GetStableArrayBufferData(aCx, jsArrayBuffer);
|
||||
if (!arrayBuffer) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
rv = blob->GetInternalStream(getter_AddRefs(stream));
|
||||
|
@ -133,6 +133,7 @@ static const char *sExtensionNames[] = {
|
||||
"GL_EXT_framebuffer_sRGB",
|
||||
"GL_KHR_debug",
|
||||
"GL_ARB_half_float_pixel",
|
||||
"GL_EXT_frag_depth",
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
@ -90,6 +90,7 @@ MOZ_BEGIN_ENUM_CLASS(GLFeature)
|
||||
element_index_uint,
|
||||
ES2_compatibility,
|
||||
ES3_compatibility,
|
||||
frag_depth,
|
||||
framebuffer_blit,
|
||||
framebuffer_multisample,
|
||||
framebuffer_object,
|
||||
@ -410,6 +411,7 @@ public:
|
||||
EXT_framebuffer_sRGB,
|
||||
KHR_debug,
|
||||
ARB_half_float_pixel,
|
||||
EXT_frag_depth,
|
||||
Extensions_Max,
|
||||
Extensions_End
|
||||
};
|
||||
@ -1160,7 +1162,7 @@ public:
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fGetObjectPtrLabel(GLvoid* ptr, GLsizei bufSize, GLsizei* length, GLchar* label) {
|
||||
void fGetObjectPtrLabel(const GLvoid* ptr, GLsizei bufSize, GLsizei* length, GLchar* label) {
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fGetObjectPtrLabel);
|
||||
mSymbols.fGetObjectPtrLabel(ptr, bufSize, length, label);
|
||||
@ -1191,7 +1193,7 @@ public:
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fTexParameteriv(GLenum target, GLenum pname, GLint* params) {
|
||||
void fTexParameteriv(GLenum target, GLenum pname, const GLint* params) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fTexParameteriv(target, pname, params);
|
||||
AFTER_GL_CALL;
|
||||
@ -1225,13 +1227,13 @@ public:
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fGetTexParameterfv(GLenum target, GLenum pname, const GLfloat *params) {
|
||||
void fGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fGetTexParameterfv(target, pname, params);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fGetTexParameteriv(GLenum target, GLenum pname, const GLint *params) {
|
||||
void fGetTexParameteriv(GLenum target, GLenum pname, GLint* params) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fGetTexParameteriv(target, pname, params);
|
||||
AFTER_GL_CALL;
|
||||
@ -1334,7 +1336,7 @@ public:
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fObjectPtrLabel(GLvoid* ptr, GLsizei length, const GLchar* label) {
|
||||
void fObjectPtrLabel(const GLvoid* ptr, GLsizei length, const GLchar* label) {
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fObjectPtrLabel);
|
||||
mSymbols.fObjectPtrLabel(ptr, length, label);
|
||||
|
@ -111,6 +111,15 @@ static const FeatureInfo sFeatureInfoArr[] = {
|
||||
GLContext::Extensions_End
|
||||
}
|
||||
},
|
||||
{
|
||||
"frag_depth",
|
||||
200, // OpenGL version
|
||||
300, // OpenGL ES version
|
||||
{
|
||||
GLContext::EXT_frag_depth,
|
||||
GLContext::Extensions_End
|
||||
}
|
||||
},
|
||||
{
|
||||
"framebuffer_blit",
|
||||
300, // OpenGL version
|
||||
|
@ -142,12 +142,12 @@ GrGLvoid glCullFace_mozilla(GrGLenum mode)
|
||||
|
||||
GrGLvoid glDeleteBuffers_mozilla(GrGLsizei n, const GrGLuint* buffers)
|
||||
{
|
||||
return sGLContext.get()->fDeleteBuffers(n, const_cast<GrGLuint*>(buffers));
|
||||
return sGLContext.get()->fDeleteBuffers(n, buffers);
|
||||
}
|
||||
|
||||
GrGLvoid glDeleteFramebuffers_mozilla(GrGLsizei n, const GrGLuint* framebuffers)
|
||||
{
|
||||
return sGLContext.get()->fDeleteFramebuffers(n, const_cast<GrGLuint*>(framebuffers));
|
||||
return sGLContext.get()->fDeleteFramebuffers(n, framebuffers);
|
||||
}
|
||||
|
||||
GrGLvoid glDeleteProgram_mozilla(GrGLuint program)
|
||||
@ -157,7 +157,7 @@ GrGLvoid glDeleteProgram_mozilla(GrGLuint program)
|
||||
|
||||
GrGLvoid glDeleteRenderbuffers_mozilla(GrGLsizei n, const GrGLuint* renderbuffers)
|
||||
{
|
||||
return sGLContext.get()->fDeleteRenderbuffers(n, const_cast<GrGLuint*>(renderbuffers));
|
||||
return sGLContext.get()->fDeleteRenderbuffers(n, renderbuffers);
|
||||
}
|
||||
|
||||
GrGLvoid glDeleteShader_mozilla(GrGLuint shader)
|
||||
@ -167,7 +167,7 @@ GrGLvoid glDeleteShader_mozilla(GrGLuint shader)
|
||||
|
||||
GrGLvoid glDeleteTextures_mozilla(GrGLsizei n, const GrGLuint* textures)
|
||||
{
|
||||
return sGLContext.get()->fDeleteTextures(n, const_cast<GrGLuint*>(textures));
|
||||
return sGLContext.get()->fDeleteTextures(n, textures);
|
||||
}
|
||||
|
||||
GrGLvoid glDepthMask_mozilla(GrGLboolean flag)
|
||||
@ -447,7 +447,7 @@ GrGLvoid glTexParameteri_mozilla(GrGLenum target, GrGLenum pname, GrGLint param)
|
||||
|
||||
GrGLvoid glTexParameteriv_mozilla(GrGLenum target, GrGLenum pname, const GrGLint* params)
|
||||
{
|
||||
return sGLContext.get()->fTexParameteriv(target, pname, const_cast<GrGLint*>(params));
|
||||
return sGLContext.get()->fTexParameteriv(target, pname, params);
|
||||
}
|
||||
|
||||
GrGLvoid glTexSubImage2D_mozilla(GrGLenum target, GrGLint level,
|
||||
@ -619,7 +619,7 @@ GrGLvoid glGenQueries_mozilla(GrGLsizei n, GrGLuint* ids)
|
||||
|
||||
GrGLvoid glDeleteQueries_mozilla(GrGLsizei n, const GrGLuint* ids)
|
||||
{
|
||||
return sGLContext.get()->fDeleteQueries(n, const_cast<GrGLuint*>(ids));
|
||||
return sGLContext.get()->fDeleteQueries(n, ids);
|
||||
}
|
||||
|
||||
GrGLvoid glBeginQuery_mozilla(GrGLenum target, GrGLuint id)
|
||||
@ -651,7 +651,7 @@ GrGLvoid glGetQueryObjectuiv_mozilla(GrGLuint id, GrGLenum pname, GrGLuint* para
|
||||
|
||||
GrGLvoid glDrawBuffers_mozilla(GrGLsizei n, const GrGLenum* bufs)
|
||||
{
|
||||
return sGLContext.get()->fDrawBuffers(n, const_cast<GrGLenum*>(bufs));
|
||||
return sGLContext.get()->fDrawBuffers(n, bufs);
|
||||
}
|
||||
|
||||
// GLContext supports glMapBuffer on everything (GL_OES_mapbuffer)
|
||||
|
@ -139,7 +139,7 @@ struct GLContextSymbols
|
||||
PFNGLGETQUERYOBJECTUIVPROC fGetQueryObjectuiv;
|
||||
typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
|
||||
PFNGLTEXPARAMETERIPROC fTexParameteri;
|
||||
typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* param);
|
||||
typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint* param);
|
||||
PFNGLTEXPARAMETERIVPROC fTexParameteriv;
|
||||
typedef void (GLAPIENTRY * PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
|
||||
PFNGLTEXPARAMETERFPROC fTexParameterf;
|
||||
@ -149,9 +149,9 @@ struct GLContextSymbols
|
||||
PFNGLGETTEXIMAGEPROC fGetTexImage;
|
||||
typedef void (GLAPIENTRY * PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params);
|
||||
PFNGLGETTEXLEVELPARAMETERIVPROC fGetTexLevelParameteriv;
|
||||
typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
|
||||
typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
|
||||
PFNGLGETTEXPARAMETERFVPROC fGetTexParameterfv;
|
||||
typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
|
||||
typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
PFNGLGETTEXPARAMETERIVPROC fGetTexParameteriv;
|
||||
typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params);
|
||||
PFNGLGETUNIFORMFVPROC fGetUniformfv;
|
||||
@ -464,9 +464,9 @@ struct GLContextSymbols
|
||||
PFNGLOBJECTLABEL fObjectLabel;
|
||||
typedef void (GLAPIENTRY * PFNGLGETOBJECTLABEL) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar* label);
|
||||
PFNGLGETOBJECTLABEL fGetObjectLabel;
|
||||
typedef void (GLAPIENTRY * PFNGLOBJECTPTRLABEL) (GLvoid* ptr, GLsizei length, const GLchar* label);
|
||||
typedef void (GLAPIENTRY * PFNGLOBJECTPTRLABEL) (const GLvoid* ptr, GLsizei length, const GLchar* label);
|
||||
PFNGLOBJECTPTRLABEL fObjectPtrLabel;
|
||||
typedef void (GLAPIENTRY * PFNGLGETOBJECTPTRLABEL) (GLvoid* ptr, GLsizei bufSize, GLsizei* length, GLchar* label);
|
||||
typedef void (GLAPIENTRY * PFNGLGETOBJECTPTRLABEL) (const GLvoid* ptr, GLsizei bufSize, GLsizei* length, GLchar* label);
|
||||
PFNGLGETOBJECTPTRLABEL fGetObjectPtrLabel;
|
||||
};
|
||||
|
||||
|
@ -156,7 +156,8 @@ GLReadTexImageHelper::DidGLErrorOccur(const char* str)
|
||||
}
|
||||
|
||||
static bool
|
||||
GetActualReadFormats(GLContext* gl, GLenum destFormat, GLenum destType,
|
||||
GetActualReadFormats(GLContext* gl,
|
||||
GLenum destFormat, GLenum destType,
|
||||
GLenum& readFormat, GLenum& readType)
|
||||
{
|
||||
if (destFormat == LOCAL_GL_RGBA &&
|
||||
@ -231,16 +232,43 @@ static void SwapRAndBComponents(DataSourceSurface* surf)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
CalcStride(int width, int pixelSize, int alignment)
|
||||
{
|
||||
MOZ_ASSERT(alignment);
|
||||
|
||||
int stride = width * pixelSize;
|
||||
if (stride % alignment) { // Extra at the end of the line?
|
||||
int alignmentCount = stride / alignment;
|
||||
stride = (alignmentCount+1) * alignment;
|
||||
}
|
||||
return stride;
|
||||
}
|
||||
|
||||
static int
|
||||
GuessAlignment(int width, int pixelSize, int stride)
|
||||
{
|
||||
int alignment = 8; // Max GLES allows.
|
||||
while (CalcStride(width, pixelSize, alignment) != stride) {
|
||||
alignment /= 2;
|
||||
if (!alignment) {
|
||||
MOZ_ASSERT(alignment);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return alignment;
|
||||
}
|
||||
|
||||
void
|
||||
ReadPixelsIntoImageSurface(GLContext* gl, gfxImageSurface* dest) {
|
||||
gl->MakeCurrent();
|
||||
MOZ_ASSERT(dest->GetSize() != gfxIntSize(0, 0));
|
||||
|
||||
/* gfxImageFormat::ARGB32:
|
||||
* RGBA+UByte: be[RGBA], le[ABGR]
|
||||
* RGBA+UInt: le[RGBA]
|
||||
* BGRA+UInt: le[BGRA]
|
||||
* BGRA+UIntRev: le[ARGB]
|
||||
* RGBA+UByte: be[RGBA], le[ABGR]
|
||||
* RGBA+UInt: be[ABGR], le[RGBA]
|
||||
* BGRA+UInt: be[ARGB], le[BGRA]
|
||||
* BGRA+UIntRev: be[BGRA], le[ARGB]
|
||||
*
|
||||
* gfxImageFormat::RGB16_565:
|
||||
* RGB+UShort: le[rrrrrggg,gggbbbbb]
|
||||
@ -269,7 +297,7 @@ ReadPixelsIntoImageSurface(GLContext* gl, gfxImageSurface* dest) {
|
||||
default:
|
||||
MOZ_CRASH("Bad format.");
|
||||
}
|
||||
MOZ_ASSERT(dest->Stride() == dest->Width() * destPixelSize);
|
||||
MOZ_ASSERT(dest->Width() * destPixelSize <= dest->Stride());
|
||||
|
||||
GLenum readFormat = destFormat;
|
||||
GLenum readType = destType;
|
||||
@ -279,7 +307,7 @@ ReadPixelsIntoImageSurface(GLContext* gl, gfxImageSurface* dest) {
|
||||
|
||||
nsAutoPtr<gfxImageSurface> tempSurf;
|
||||
gfxImageSurface* readSurf = nullptr;
|
||||
int readPixelSize = 0;
|
||||
int readAlignment = 0;
|
||||
if (needsTempSurf) {
|
||||
if (gl->DebugMode()) {
|
||||
NS_WARNING("Needing intermediary surface for ReadPixels. This will be slow!");
|
||||
@ -294,7 +322,7 @@ ReadPixelsIntoImageSurface(GLContext* gl, gfxImageSurface* dest) {
|
||||
break;
|
||||
}
|
||||
case LOCAL_GL_RGB: {
|
||||
MOZ_ASSERT(readPixelSize == 2);
|
||||
MOZ_ASSERT(destPixelSize == 2);
|
||||
MOZ_ASSERT(readType == LOCAL_GL_UNSIGNED_SHORT_5_6_5_REV);
|
||||
readFormatGFX = SurfaceFormat::R5G6B5;
|
||||
break;
|
||||
@ -307,17 +335,17 @@ ReadPixelsIntoImageSurface(GLContext* gl, gfxImageSurface* dest) {
|
||||
switch (readType) {
|
||||
case LOCAL_GL_UNSIGNED_BYTE: {
|
||||
MOZ_ASSERT(readFormat == LOCAL_GL_RGBA);
|
||||
readPixelSize = 4;
|
||||
readAlignment = 1;
|
||||
break;
|
||||
}
|
||||
case LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV: {
|
||||
MOZ_ASSERT(readFormat == LOCAL_GL_BGRA);
|
||||
readPixelSize = 4;
|
||||
readAlignment = 4;
|
||||
break;
|
||||
}
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_6_5_REV: {
|
||||
MOZ_ASSERT(readFormat == LOCAL_GL_RGB);
|
||||
readPixelSize = 2;
|
||||
readAlignment = 2;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@ -330,16 +358,20 @@ ReadPixelsIntoImageSurface(GLContext* gl, gfxImageSurface* dest) {
|
||||
false);
|
||||
readSurf = tempSurf;
|
||||
} else {
|
||||
readPixelSize = destPixelSize;
|
||||
// Figure out alignment. We don't need to know why, we just need it
|
||||
// to be valid.
|
||||
readAlignment = GuessAlignment(dest->Width(),
|
||||
destPixelSize,
|
||||
dest->Stride());
|
||||
readSurf = dest;
|
||||
}
|
||||
MOZ_ASSERT(readPixelSize);
|
||||
MOZ_ASSERT(readAlignment);
|
||||
|
||||
GLint currentPackAlignment = 0;
|
||||
gl->fGetIntegerv(LOCAL_GL_PACK_ALIGNMENT, ¤tPackAlignment);
|
||||
|
||||
if (currentPackAlignment != readPixelSize)
|
||||
gl->fPixelStorei(LOCAL_GL_PACK_ALIGNMENT, readPixelSize);
|
||||
if (currentPackAlignment != readAlignment)
|
||||
gl->fPixelStorei(LOCAL_GL_PACK_ALIGNMENT, readAlignment);
|
||||
|
||||
GLsizei width = dest->Width();
|
||||
GLsizei height = dest->Height();
|
||||
@ -351,7 +383,7 @@ ReadPixelsIntoImageSurface(GLContext* gl, gfxImageSurface* dest) {
|
||||
readSurf->Data());
|
||||
readSurf->MarkDirty();
|
||||
|
||||
if (currentPackAlignment != readPixelSize)
|
||||
if (currentPackAlignment != readAlignment)
|
||||
gl->fPixelStorei(LOCAL_GL_PACK_ALIGNMENT, currentPackAlignment);
|
||||
|
||||
if (readSurf != dest) {
|
||||
@ -387,6 +419,8 @@ ReadPixelsIntoImageSurface(GLContext* gl, gfxImageSurface* dest) {
|
||||
if (!alphaBits) {
|
||||
const uint32_t alphaMask = gfxPackedPixelNoPreMultiply(0xff,0,0,0);
|
||||
|
||||
MOZ_ASSERT(dest->Width() * destPixelSize == dest->Stride());
|
||||
|
||||
dest->Flush();
|
||||
uint32_t* itr = (uint32_t*)dest->Data();
|
||||
uint32_t testPixel = *itr;
|
||||
|
@ -294,8 +294,7 @@ SharedSurface_Basic::~SharedSurface_Basic()
|
||||
if (!mGL->MakeCurrent())
|
||||
return;
|
||||
|
||||
GLuint tex = mTex;
|
||||
mGL->fDeleteTextures(1, &tex);
|
||||
mGL->fDeleteTextures(1, &mTex);
|
||||
}
|
||||
|
||||
void
|
||||
@ -339,8 +338,7 @@ SharedSurface_GLTexture::~SharedSurface_GLTexture()
|
||||
if (!mGL->MakeCurrent())
|
||||
return;
|
||||
|
||||
GLuint tex = mTex;
|
||||
mGL->fDeleteTextures(1, &tex);
|
||||
mGL->fDeleteTextures(1, &mTex);
|
||||
|
||||
if (mSync) {
|
||||
mGL->fDeleteSync(mSync);
|
||||
|
@ -141,7 +141,7 @@ SharedSurface_Gralloc::~SharedSurface_Gralloc()
|
||||
DEBUG_PRINT("[SharedSurface_Gralloc %p] destroyed\n", this);
|
||||
|
||||
mGL->MakeCurrent();
|
||||
mGL->fDeleteTextures(1, (GLuint*)&mProdTex);
|
||||
mGL->fDeleteTextures(1, &mProdTex);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -566,8 +566,8 @@ BufferTextureClient::Lock(OpenMode aMode)
|
||||
// XXX - Turn this into a fatal assertion as soon as Bug 952507 is fixed
|
||||
NS_WARN_IF_FALSE(!mLocked, "The TextureClient is already Locked!");
|
||||
mOpenMode = aMode;
|
||||
mLocked = true;
|
||||
return IsValid() && IsAllocated();
|
||||
mLocked = IsValid() && IsAllocated();;
|
||||
return mLocked;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -843,6 +843,24 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
||||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
* Augment the generic Rooted<T> interface when T = JSObject* with
|
||||
* class-querying and downcasting operations.
|
||||
*
|
||||
* Given a Rooted<JSObject*> obj, one can view
|
||||
* Handle<StringObject*> h = obj.as<StringObject*>();
|
||||
* as an optimization of
|
||||
* Rooted<StringObject*> rooted(cx, &obj->as<StringObject*>());
|
||||
* Handle<StringObject*> h = rooted;
|
||||
*/
|
||||
template <>
|
||||
class RootedBase<JSObject*>
|
||||
{
|
||||
public:
|
||||
template <class U>
|
||||
JS::Handle<U*> as() const;
|
||||
};
|
||||
|
||||
/*
|
||||
* Mark a stack location as a root for the rooting analysis, without actually
|
||||
* rooting it in release builds. This should only be used for stack locations
|
||||
|
1
js/src/aclocal.m4
vendored
@ -3,6 +3,7 @@ dnl Local autoconf macros used with mozilla
|
||||
dnl The contents of this file are under the Public Domain.
|
||||
dnl
|
||||
|
||||
builtin(include, ../../build/autoconf/hotfixes.m4)dnl
|
||||
builtin(include, ../../build/autoconf/acwinpaths.m4)dnl
|
||||
builtin(include, ../../build/autoconf/hooks.m4)dnl
|
||||
builtin(include, ../../build/autoconf/config.status.m4)dnl
|
||||
|
@ -2414,7 +2414,10 @@ ImplicitConvert(JSContext* cx,
|
||||
// Convert ArrayBuffer to pointer without any copy.
|
||||
// Just as with C arrays, we make no effort to
|
||||
// keep the ArrayBuffer alive.
|
||||
*static_cast<void**>(buffer) = JS_GetArrayBufferData(valObj);
|
||||
void* p = JS_GetStableArrayBufferData(cx, valObj);
|
||||
if (!p)
|
||||
return false;
|
||||
*static_cast<void**>(buffer) = p;
|
||||
break;
|
||||
} if (!JSVAL_IS_PRIMITIVE(val) && JS_IsTypedArrayObject(valObj)) {
|
||||
if(!CanConvertTypedArrayItemTo(baseType, valObj, cx)) {
|
||||
|
15
js/src/jit-test/tests/parallel/bug970427.js
Normal file
@ -0,0 +1,15 @@
|
||||
// XXXshu: I tried wrapping the entire test in an |if (pjs)|, but the timing
|
||||
// is fragile and it no longer reproduced the bug, thus getting this value at
|
||||
// the beginning.
|
||||
var pjs = getBuildConfiguration().parallelJS;
|
||||
function f(a, b) {
|
||||
var o = a;
|
||||
gczeal(2);
|
||||
}
|
||||
f(3, 4);
|
||||
var len = 5000;
|
||||
var iters = 100;
|
||||
for (var i = 0; i < iters; i++) {
|
||||
var par = pjs ? Array.buildPar(len, fill) : true;
|
||||
}
|
||||
function fill(i) { return 10/i; }
|
@ -44,7 +44,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
||||
CHECK_SAME(v, INT_TO_JSVAL(size));
|
||||
|
||||
// Modifying the underlying data should update the value returned through the view
|
||||
uint8_t *data = JS_GetArrayBufferData(obj);
|
||||
uint8_t *data = JS_GetStableArrayBufferData(cx, obj);
|
||||
CHECK(data != nullptr);
|
||||
*reinterpret_cast<uint32_t*>(data) = MAGIC_VALUE_2;
|
||||
CHECK(JS_GetElement(cx, view, 0, &v));
|
||||
@ -74,13 +74,13 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
||||
// Transfer to a new ArrayBuffer
|
||||
JS::RootedObject dst(cx, JS_NewArrayBufferWithContents(cx, contents));
|
||||
CHECK(JS_IsArrayBufferObject(dst));
|
||||
data = JS_GetArrayBufferData(obj);
|
||||
data = JS_GetStableArrayBufferData(cx, obj);
|
||||
|
||||
JS::RootedObject dstview(cx, JS_NewInt32ArrayWithBuffer(cx, dst, 0, -1));
|
||||
CHECK(dstview != nullptr);
|
||||
|
||||
CHECK_EQUAL(JS_GetArrayBufferByteLength(dst), size);
|
||||
data = JS_GetArrayBufferData(dst);
|
||||
data = JS_GetStableArrayBufferData(cx, dst);
|
||||
CHECK(data != nullptr);
|
||||
CHECK_EQUAL(*reinterpret_cast<uint32_t*>(data), MAGIC_VALUE_2);
|
||||
CHECK(JS_GetElement(cx, dstview, 0, &v));
|
||||
|
@ -37,7 +37,7 @@ BEGIN_TEST(testTypedArrays)
|
||||
CHECK(!JS_IsArrayBufferObject(dummy));
|
||||
|
||||
CHECK_EQUAL(JS_GetArrayBufferByteLength(buffer), nbytes);
|
||||
memset(JS_GetArrayBufferData(buffer), 1, nbytes);
|
||||
memset(JS_GetStableArrayBufferData(cx, buffer), 1, nbytes);
|
||||
|
||||
ok = ok &&
|
||||
TestArrayFromBuffer<JS_NewInt8ArrayWithBuffer, JS_NewInt8ArrayFromArray, int8_t, JS_GetInt8ArrayData>(cx) &&
|
||||
@ -97,7 +97,7 @@ TestArrayFromBuffer(JSContext *cx)
|
||||
size_t nbytes = elts * sizeof(Element);
|
||||
RootedObject buffer(cx, JS_NewArrayBuffer(cx, nbytes));
|
||||
uint8_t *bufdata;
|
||||
CHECK(bufdata = JS_GetArrayBufferData(buffer));
|
||||
CHECK(bufdata = JS_GetStableArrayBufferData(cx, buffer));
|
||||
memset(bufdata, 1, nbytes);
|
||||
|
||||
{
|
||||
@ -113,7 +113,7 @@ TestArrayFromBuffer(JSContext *cx)
|
||||
|
||||
Element *data;
|
||||
CHECK(data = GetData(array));
|
||||
CHECK(bufdata = JS_GetArrayBufferData(buffer));
|
||||
CHECK(bufdata = JS_GetStableArrayBufferData(cx, buffer));
|
||||
CHECK_EQUAL((void*) data, (void*) bufdata);
|
||||
|
||||
CHECK_EQUAL(*bufdata, 1);
|
||||
|
@ -6297,3 +6297,9 @@ JSAutoByteString::encodeLatin1(ExclusiveContext *cx, JSString *str)
|
||||
mBytes = LossyTwoByteCharsToNewLatin1CharsZ(cx, linear->range()).c_str();
|
||||
return mBytes;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS::SetLargeAllocationFailureCallback(JSRuntime *rt, JS::LargeAllocationFailureCallback lafc)
|
||||
{
|
||||
rt->largeAllocationFailureCallback = lafc;
|
||||
}
|
||||
|
@ -3173,9 +3173,9 @@ JS_StealArrayBufferContents(JSContext *cx, JS::HandleObject obj, void **contents
|
||||
* the number of payload bytes required. The pointer to pass to
|
||||
* JS_NewArrayBufferWithContents is returned in |contents|. The pointer to the
|
||||
* |nbytes| of usable memory is returned in |data|. (*|contents| will contain a
|
||||
* header before |data|.) The only legal operations on *|contents| is to free
|
||||
* it, or pass it to JS_NewArrayBufferWithContents or
|
||||
* JS_ReallocateArrayBufferContents.
|
||||
* header before |data|.) The only legal operations on *|contents| are to pass
|
||||
* it to either JS_NewArrayBufferWithContents or
|
||||
* JS_ReallocateArrayBufferContents, or free it with js_free or JS_free.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_AllocateArrayBufferContents(JSContext *maybecx, uint32_t nbytes, void **contents, uint8_t **data);
|
||||
@ -4919,6 +4919,20 @@ class MOZ_STACK_CLASS JS_PUBLIC_API(ForOfIterator) {
|
||||
bool materializeArrayIterator();
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* If a large allocation fails, the JS engine may call the large-allocation-
|
||||
* failure callback, if set, to allow the embedding to flush caches, possibly
|
||||
* perform shrinking GCs, etc. to make some room so that the allocation will
|
||||
* succeed if retried.
|
||||
*/
|
||||
|
||||
typedef void
|
||||
(* LargeAllocationFailureCallback)();
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
SetLargeAllocationFailureCallback(JSRuntime *rt, LargeAllocationFailureCallback afc);
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
#endif /* jsapi_h */
|
||||
|
@ -555,16 +555,6 @@ struct JSContext : public js::ExclusiveContext,
|
||||
void enterGenerator(JSGenerator *gen);
|
||||
void leaveGenerator(JSGenerator *gen);
|
||||
|
||||
void *onOutOfMemory(void *p, size_t nbytes) {
|
||||
return runtime()->onOutOfMemory(p, nbytes, this);
|
||||
}
|
||||
void updateMallocCounter(size_t nbytes) {
|
||||
runtime()->updateMallocCounter(zone(), nbytes);
|
||||
}
|
||||
void reportAllocationOverflow() {
|
||||
js_ReportAllocationOverflow(this);
|
||||
}
|
||||
|
||||
bool isExceptionPending() {
|
||||
return throwing;
|
||||
}
|
||||
|
@ -1347,18 +1347,6 @@ JS_IsArrayBufferObject(JSObject *obj);
|
||||
extern JS_FRIEND_API(uint32_t)
|
||||
JS_GetArrayBufferByteLength(JSObject *obj);
|
||||
|
||||
/*
|
||||
* Return a pointer to an array buffer's data. The buffer is still owned by the
|
||||
* array buffer object, and should not be modified on another thread. The
|
||||
* returned pointer is stable across GCs.
|
||||
*
|
||||
* |obj| must have passed a JS_IsArrayBufferObject test, or somehow be known
|
||||
* that it would pass such a test: it is an ArrayBuffer or a wrapper of an
|
||||
* ArrayBuffer, and the unwrapping will succeed.
|
||||
*/
|
||||
extern JS_FRIEND_API(uint8_t *)
|
||||
JS_GetArrayBufferData(JSObject *obj);
|
||||
|
||||
/*
|
||||
* Return the number of elements in a typed array.
|
||||
*
|
||||
@ -1407,13 +1395,17 @@ JS_GetArrayBufferViewByteLength(JSObject *obj);
|
||||
/*
|
||||
* Return a pointer to the start of the data referenced by a typed array. The
|
||||
* data is still owned by the typed array, and should not be modified on
|
||||
* another thread.
|
||||
* another thread. Furthermore, the pointer can become invalid on GC (if the
|
||||
* data is small and fits inside the array's GC header), so callers must take
|
||||
* care not to hold on across anything that could GC.
|
||||
*
|
||||
* |obj| must have passed a JS_Is*Array test, or somehow be known that it would
|
||||
* pass such a test: it is a typed array or a wrapper of a typed array, and the
|
||||
* unwrapping will succeed.
|
||||
*/
|
||||
|
||||
extern JS_FRIEND_API(uint8_t *)
|
||||
JS_GetArrayBufferData(JSObject *obj);
|
||||
extern JS_FRIEND_API(int8_t *)
|
||||
JS_GetInt8ArrayData(JSObject *obj);
|
||||
extern JS_FRIEND_API(uint8_t *)
|
||||
@ -1433,6 +1425,13 @@ JS_GetFloat32ArrayData(JSObject *obj);
|
||||
extern JS_FRIEND_API(double *)
|
||||
JS_GetFloat64ArrayData(JSObject *obj);
|
||||
|
||||
/*
|
||||
* Stable versions of the above functions where the buffer remains valid as long
|
||||
* as the object is live.
|
||||
*/
|
||||
extern JS_FRIEND_API(uint8_t *)
|
||||
JS_GetStableArrayBufferData(JSContext *cx, JSObject *obj);
|
||||
|
||||
/*
|
||||
* Same as above, but for any kind of ArrayBufferView. Prefer the type-specific
|
||||
* versions when possible.
|
||||
|
@ -1210,6 +1210,15 @@ class JSObject : public js::ObjectImpl
|
||||
void operator=(const JSObject &other) MOZ_DELETE;
|
||||
};
|
||||
|
||||
template <class U>
|
||||
MOZ_ALWAYS_INLINE JS::Handle<U*>
|
||||
js::RootedBase<JSObject*>::as() const
|
||||
{
|
||||
const JS::Rooted<JSObject*> &self = *static_cast<const JS::Rooted<JSObject*>*>(this);
|
||||
JS_ASSERT(self->is<U>());
|
||||
return Handle<U*>::fromMarkedLocation(reinterpret_cast<U* const*>(self.address()));
|
||||
}
|
||||
|
||||
/*
|
||||
* The only sensible way to compare JSObject with == is by identity. We use
|
||||
* const& instead of * as a syntactic way to assert non-null. This leads to an
|
||||
|
@ -1294,6 +1294,7 @@ ScriptSource::setSourceCopy(ExclusiveContext *cx, const jschar *src, uint32_t le
|
||||
argumentsNotIncluded_ = argumentsNotIncluded;
|
||||
|
||||
// There are several cases where source compression is not a good idea:
|
||||
// - If the script is tiny, then compression will save little or no space.
|
||||
// - If the script is enormous, then decompression can take seconds. With
|
||||
// lazy parsing, decompression is not uncommon, so this can significantly
|
||||
// increase latency.
|
||||
@ -1320,8 +1321,9 @@ ScriptSource::setSourceCopy(ExclusiveContext *cx, const jschar *src, uint32_t le
|
||||
#else
|
||||
bool canCompressOffThread = false;
|
||||
#endif
|
||||
const size_t TINY_SCRIPT = 256;
|
||||
const size_t HUGE_SCRIPT = 5 * 1024 * 1024;
|
||||
if (length < HUGE_SCRIPT && canCompressOffThread) {
|
||||
if (TINY_SCRIPT <= length && length < HUGE_SCRIPT && canCompressOffThread) {
|
||||
task->ss = this;
|
||||
task->chars = src;
|
||||
ready_ = false;
|
||||
@ -1360,48 +1362,46 @@ SourceCompressionTask::work()
|
||||
// threadsafe. We have to use the js_* variants.
|
||||
|
||||
#ifdef USE_ZLIB
|
||||
const size_t COMPRESS_THRESHOLD = 512;
|
||||
if (nbytes >= COMPRESS_THRESHOLD) {
|
||||
// Try to keep the maximum memory usage down by only allocating half the
|
||||
// size of the string, first.
|
||||
size_t firstSize = nbytes / 2;
|
||||
if (!ss->adjustDataSize(firstSize))
|
||||
return false;
|
||||
Compressor comp(reinterpret_cast<const unsigned char *>(chars), nbytes);
|
||||
if (!comp.init())
|
||||
return false;
|
||||
comp.setOutput(ss->data.compressed, firstSize);
|
||||
bool cont = !abort_;
|
||||
while (cont) {
|
||||
switch (comp.compressMore()) {
|
||||
case Compressor::CONTINUE:
|
||||
break;
|
||||
case Compressor::MOREOUTPUT: {
|
||||
if (comp.outWritten() == nbytes) {
|
||||
cont = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// The compressed output is greater than half the size of the
|
||||
// original string. Reallocate to the full size.
|
||||
if (!ss->adjustDataSize(nbytes))
|
||||
return false;
|
||||
comp.setOutput(ss->data.compressed, nbytes);
|
||||
break;
|
||||
}
|
||||
case Compressor::DONE:
|
||||
// Try to keep the maximum memory usage down by only allocating half the
|
||||
// size of the string, first.
|
||||
size_t firstSize = nbytes / 2;
|
||||
if (!ss->adjustDataSize(firstSize))
|
||||
return false;
|
||||
Compressor comp(reinterpret_cast<const unsigned char *>(chars), nbytes);
|
||||
if (!comp.init())
|
||||
return false;
|
||||
comp.setOutput(ss->data.compressed, firstSize);
|
||||
bool cont = !abort_;
|
||||
while (cont) {
|
||||
switch (comp.compressMore()) {
|
||||
case Compressor::CONTINUE:
|
||||
break;
|
||||
case Compressor::MOREOUTPUT: {
|
||||
if (comp.outWritten() == nbytes) {
|
||||
cont = false;
|
||||
break;
|
||||
case Compressor::OOM:
|
||||
return false;
|
||||
}
|
||||
cont = cont && !abort_;
|
||||
|
||||
// The compressed output is greater than half the size of the
|
||||
// original string. Reallocate to the full size.
|
||||
if (!ss->adjustDataSize(nbytes))
|
||||
return false;
|
||||
comp.setOutput(ss->data.compressed, nbytes);
|
||||
break;
|
||||
}
|
||||
case Compressor::DONE:
|
||||
cont = false;
|
||||
break;
|
||||
case Compressor::OOM:
|
||||
return false;
|
||||
}
|
||||
compressedLength = comp.outWritten();
|
||||
if (abort_ || compressedLength == nbytes)
|
||||
compressedLength = 0;
|
||||
cont = cont && !abort_;
|
||||
}
|
||||
compressedLength = comp.outWritten();
|
||||
if (abort_ || compressedLength == nbytes)
|
||||
compressedLength = 0;
|
||||
#endif
|
||||
|
||||
if (compressedLength == 0) {
|
||||
if (!ss->adjustDataSize(nbytes))
|
||||
return false;
|
||||
|
@ -361,6 +361,15 @@ class ScriptSource
|
||||
{
|
||||
friend class SourceCompressionTask;
|
||||
|
||||
// A note on concurrency:
|
||||
//
|
||||
// The source may be compressed by a worker thread during parsing. (See
|
||||
// SourceCompressionTask.) When compression is running in the background,
|
||||
// ready() returns false. The compression thread touches the |data| union
|
||||
// and |compressedLength_|. Therefore, it is not safe to read these members
|
||||
// unless ready() is true. With that said, users of the public ScriptSource
|
||||
// API should be fine.
|
||||
|
||||
union {
|
||||
// Before setSourceCopy or setSource are successfully called, this union
|
||||
// has a nullptr pointer. When the script source is ready,
|
||||
@ -416,7 +425,7 @@ class ScriptSource
|
||||
bool hasIntroductionOffset_:1;
|
||||
|
||||
public:
|
||||
ScriptSource(JSPrincipals *originPrincipals)
|
||||
explicit ScriptSource(JSPrincipals *originPrincipals)
|
||||
: refs(0),
|
||||
length_(0),
|
||||
compressedLength_(0),
|
||||
@ -451,7 +460,7 @@ class ScriptSource
|
||||
bool ready() const { return ready_; }
|
||||
void setSourceRetrievable() { sourceRetrievable_ = true; }
|
||||
bool sourceRetrievable() const { return sourceRetrievable_; }
|
||||
bool hasSourceData() const { return !!data.source || !ready(); }
|
||||
bool hasSourceData() const { return !ready() || !!data.source; }
|
||||
uint32_t length() const {
|
||||
JS_ASSERT(hasSourceData());
|
||||
return length_;
|
||||
|
@ -1175,8 +1175,6 @@ ForkJoinOperation::parallelExecution(ExecutionStatus *status)
|
||||
// functions such as ForkJoin().
|
||||
JS_ASSERT(ForkJoinContext::current() == nullptr);
|
||||
|
||||
ForkJoinActivation activation(cx_);
|
||||
|
||||
uint16_t from, to;
|
||||
if (!computeBounds(&from, &to)) {
|
||||
*status = ExecutionFatal;
|
||||
@ -1189,6 +1187,7 @@ ForkJoinOperation::parallelExecution(ExecutionStatus *status)
|
||||
return RedLight;
|
||||
}
|
||||
|
||||
ForkJoinActivation activation(cx_);
|
||||
ThreadPool *threadPool = &cx_->runtime()->threadPool;
|
||||
ForkJoinShared shared(cx_, threadPool, fun_, from, to, &bailoutRecords_[0]);
|
||||
if (!shared.init()) {
|
||||
|
@ -302,10 +302,11 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
|
||||
useHelperThreads_(useHelperThreads),
|
||||
parallelIonCompilationEnabled_(true),
|
||||
parallelParsingEnabled_(true),
|
||||
isWorkerRuntime_(false)
|
||||
isWorkerRuntime_(false),
|
||||
#ifdef DEBUG
|
||||
, enteredPolicy(nullptr)
|
||||
enteredPolicy(nullptr),
|
||||
#endif
|
||||
largeAllocationFailureCallback(nullptr)
|
||||
{
|
||||
liveRuntimesCount++;
|
||||
|
||||
|