Merge mozilla-central into birch
@ -203,8 +203,6 @@
|
||||
<string>%APP_VERSION%</string>
|
||||
<key>NSAppleScriptEnabled</key>
|
||||
<true/>
|
||||
<key>CGDisableCoalescedUpdates</key>
|
||||
<true/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.5</string>
|
||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||
|
@ -877,7 +877,7 @@ pref("browser.ssl_override_behavior", 2);
|
||||
// 0 - do not show domain
|
||||
// 1 - show effectiveTLD + 1 (e.g. mozilla.org)
|
||||
// 2 - show full domain (e.g. bugzilla.mozilla.org)
|
||||
pref("browser.identity.ssl_domain_display", 1);
|
||||
pref("browser.identity.ssl_domain_display", 0);
|
||||
|
||||
// True if the user should be prompted when a web application supports
|
||||
// offline apps.
|
||||
@ -980,7 +980,6 @@ pref("services.sync.prefs.sync.browser.download.manager.scanWhenDone", true);
|
||||
pref("services.sync.prefs.sync.browser.download.manager.showWhenStarting", true);
|
||||
pref("services.sync.prefs.sync.browser.formfill.enable", true);
|
||||
pref("services.sync.prefs.sync.browser.link.open_newwindow", true);
|
||||
pref("services.sync.prefs.sync.browser.newtabpage.enabled", true);
|
||||
pref("services.sync.prefs.sync.browser.offline-apps.notify", true);
|
||||
pref("services.sync.prefs.sync.browser.safebrowsing.enabled", true);
|
||||
pref("services.sync.prefs.sync.browser.safebrowsing.malware.enabled", true);
|
||||
@ -996,7 +995,6 @@ pref("services.sync.prefs.sync.browser.tabs.warnOnClose", true);
|
||||
pref("services.sync.prefs.sync.browser.tabs.warnOnOpen", true);
|
||||
pref("services.sync.prefs.sync.browser.tabs.onTop", true);
|
||||
pref("services.sync.prefs.sync.browser.urlbar.autocomplete.enabled", true);
|
||||
pref("services.sync.prefs.sync.browser.urlbar.autoFill", true);
|
||||
pref("services.sync.prefs.sync.browser.urlbar.default.behavior", true);
|
||||
pref("services.sync.prefs.sync.browser.urlbar.maxRichResults", true);
|
||||
pref("services.sync.prefs.sync.dom.disable_open_during_load", true);
|
||||
@ -1005,7 +1003,6 @@ pref("services.sync.prefs.sync.dom.disable_window_move_resize", true);
|
||||
pref("services.sync.prefs.sync.dom.event.contextmenu.enabled", true);
|
||||
pref("services.sync.prefs.sync.extensions.personas.current", true);
|
||||
pref("services.sync.prefs.sync.extensions.update.enabled", true);
|
||||
pref("services.sync.prefs.sync.general.smoothScroll", true);
|
||||
pref("services.sync.prefs.sync.intl.accept_languages", true);
|
||||
pref("services.sync.prefs.sync.javascript.enabled", true);
|
||||
pref("services.sync.prefs.sync.layout.spellcheckDefault", true);
|
||||
@ -1055,6 +1052,10 @@ pref("devtools.inspector.htmlPanelOpen", false);
|
||||
pref("devtools.inspector.sidebarOpen", false);
|
||||
pref("devtools.inspector.activeSidebar", "ruleview");
|
||||
|
||||
// Enable the Layout View
|
||||
pref("devtools.layoutview.enabled", false);
|
||||
pref("devtools.layoutview.open", false);
|
||||
|
||||
// Enable the Debugger
|
||||
pref("devtools.debugger.enabled", false);
|
||||
|
||||
|
@ -45,8 +45,6 @@ html {
|
||||
font: message-box;
|
||||
font-size: 100%;
|
||||
background-color: hsl(0,0%,90%);
|
||||
background-image: url(chrome://browser/content/abouthome/noise.png),
|
||||
-moz-linear-gradient(hsla(0,0%,100%,.7), hsla(0,0%,100%,.4));
|
||||
color: #000;
|
||||
height: 100%;
|
||||
}
|
||||
@ -57,6 +55,8 @@ body {
|
||||
-moz-box-orient: vertical;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url(chrome://browser/content/abouthome/noise.png),
|
||||
-moz-linear-gradient(hsla(0,0%,100%,.7), hsla(0,0%,100%,.4));
|
||||
}
|
||||
|
||||
input,
|
||||
|
@ -2686,30 +2686,11 @@ function SetPageProxyState(aState)
|
||||
if (aState == "valid") {
|
||||
gLastValidURLStr = gURLBar.value;
|
||||
gURLBar.addEventListener("input", UpdatePageProxyState, false);
|
||||
|
||||
PageProxySetIcon(gBrowser.getIcon());
|
||||
} else if (aState == "invalid") {
|
||||
gURLBar.removeEventListener("input", UpdatePageProxyState, false);
|
||||
PageProxyClearIcon();
|
||||
}
|
||||
}
|
||||
|
||||
function PageProxySetIcon (aURL)
|
||||
{
|
||||
if (!gProxyFavIcon)
|
||||
return;
|
||||
|
||||
if (!aURL)
|
||||
PageProxyClearIcon();
|
||||
else if (gProxyFavIcon.getAttribute("src") != aURL)
|
||||
gProxyFavIcon.setAttribute("src", aURL);
|
||||
}
|
||||
|
||||
function PageProxyClearIcon ()
|
||||
{
|
||||
gProxyFavIcon.removeAttribute("src");
|
||||
}
|
||||
|
||||
function PageProxyClickHandler(aEvent)
|
||||
{
|
||||
if (aEvent.button == 1 && gPrefService.getBoolPref("middlemouse.paste"))
|
||||
@ -4629,11 +4610,6 @@ var XULBrowserWindow = {
|
||||
return "_blank";
|
||||
},
|
||||
|
||||
onLinkIconAvailable: function (aIconURL) {
|
||||
if (gProxyFavIcon && gBrowser.userTypedValue === null)
|
||||
PageProxySetIcon(aIconURL); // update the favicon in the URL bar
|
||||
},
|
||||
|
||||
onProgressChange: function (aWebProgress, aRequest,
|
||||
aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress) {
|
||||
|
@ -542,9 +542,8 @@
|
||||
<hbox id="identity-box-inner" align="center">
|
||||
<hbox id="page-proxy-stack"
|
||||
onclick="PageProxyClickHandler(event);">
|
||||
<image id="page-proxy-favicon" validate="never"
|
||||
pageproxystate="invalid"
|
||||
onerror="this.removeAttribute('src');"/>
|
||||
<image id="page-proxy-favicon"
|
||||
pageproxystate="invalid"/>
|
||||
</hbox>
|
||||
<hbox id="identity-icon-labels">
|
||||
<label id="identity-icon-label" class="plain" flex="1"/>
|
||||
|
@ -100,3 +100,15 @@ html|*#highlighter-nodeinfobar-tagname {
|
||||
.devtools-toolbarbutton:not([label]) > .toolbarbutton-text {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#inspector-layoutview-container > iframe {
|
||||
-moz-transition-property: height;
|
||||
-moz-transition-duration: 0.1s;
|
||||
/* header size */
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
#inspector-layoutview-container > iframe[open] {
|
||||
/* header size + layout view size: 22px + 155px */
|
||||
height: 177px;
|
||||
}
|
||||
|
@ -528,8 +528,16 @@ nsContextMenu.prototype = {
|
||||
this.onCanvas = true;
|
||||
}
|
||||
else if (this.target instanceof HTMLVideoElement) {
|
||||
this.onVideo = true;
|
||||
this.mediaURL = this.target.currentSrc || this.target.src;
|
||||
// Firefox always creates a HTMLVideoElement when loading an ogg file
|
||||
// directly. If the media is actually audio, be smarter and provide a
|
||||
// context menu with audio operations.
|
||||
if (this.target.readyState >= this.target.HAVE_METADATA &&
|
||||
(this.target.videoWidth == 0 || this.target.videoHeight == 0)) {
|
||||
this.onAudio = true;
|
||||
} else {
|
||||
this.onVideo = true;
|
||||
}
|
||||
}
|
||||
else if (this.target instanceof HTMLAudioElement) {
|
||||
this.onAudio = true;
|
||||
|
@ -77,6 +77,7 @@ _TEST_FILES = \
|
||||
# test_contextmenu.html is disabled on Linux due to bug 513558
|
||||
ifneq (gtk2,$(MOZ_WIDGET_TOOLKIT))
|
||||
_TEST_FILES += \
|
||||
audio.ogg \
|
||||
test_contextmenu.html \
|
||||
subtst_contextmenu.html \
|
||||
$(NULL)
|
||||
|
BIN
browser/base/content/test/audio.ogg
Normal file
@ -1,6 +1,9 @@
|
||||
/* Tests for correct behaviour of getEffectiveHost on identity handler */
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref("browser.identity.ssl_domain_display");
|
||||
});
|
||||
|
||||
ok(gIdentityHandler, "gIdentityHandler should exist");
|
||||
|
||||
@ -72,34 +75,48 @@ let gCurrentTest, gCurrentTestIndex = -1, gTestDesc;
|
||||
// Go through the tests in both directions, to add additional coverage for
|
||||
// transitions between different states.
|
||||
let gForward = true;
|
||||
let gCheckETLD = false;
|
||||
function nextTest() {
|
||||
if (gForward)
|
||||
gCurrentTestIndex++;
|
||||
else
|
||||
gCurrentTestIndex--;
|
||||
if (!gCheckETLD) {
|
||||
if (gForward)
|
||||
gCurrentTestIndex++;
|
||||
else
|
||||
gCurrentTestIndex--;
|
||||
|
||||
if (gCurrentTestIndex == tests.length) {
|
||||
// Went too far, reverse
|
||||
gCurrentTestIndex--;
|
||||
gForward = false;
|
||||
if (gCurrentTestIndex == tests.length) {
|
||||
// Went too far, reverse
|
||||
gCurrentTestIndex--;
|
||||
gForward = false;
|
||||
}
|
||||
|
||||
if (gCurrentTestIndex == -1) {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", checkResult, true);
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
gCurrentTest = tests[gCurrentTestIndex];
|
||||
gTestDesc = "#" + gCurrentTestIndex + " (" + gCurrentTest.name + ")";
|
||||
if (!gForward)
|
||||
gTestDesc += " (second time)";
|
||||
if (gCurrentTest.isHTTPS) {
|
||||
gCheckETLD = true;
|
||||
Services.prefs.setIntPref("browser.identity.ssl_domain_display", 1);
|
||||
}
|
||||
content.location = gCurrentTest.location;
|
||||
} else {
|
||||
gCheckETLD = false;
|
||||
gTestDesc = "#" + gCurrentTestIndex + " (" + gCurrentTest.name + " without eTLD in identity icon label)";
|
||||
if (!gForward)
|
||||
gTestDesc += " (second time)";
|
||||
Services.prefs.clearUserPref("browser.identity.ssl_domain_display");
|
||||
content.location.reload(true);
|
||||
}
|
||||
|
||||
if (gCurrentTestIndex == -1) {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", checkResult, true);
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
gCurrentTest = tests[gCurrentTestIndex];
|
||||
gTestDesc = "#" + gCurrentTestIndex + " (" + gCurrentTest.name + ")";
|
||||
if (!gForward)
|
||||
gTestDesc += " (second time)";
|
||||
content.location = gCurrentTest.location;
|
||||
}
|
||||
|
||||
function checkResult() {
|
||||
if (gCurrentTest.isHTTPS) {
|
||||
if (gCurrentTest.isHTTPS && Services.prefs.getIntPref("browser.identity.ssl_domain_display") == 1) {
|
||||
// Check that the effective host is displayed in the UI
|
||||
let label = document.getElementById("identity-icon-label");
|
||||
is(label.value, gCurrentTest.effectiveHost, "effective host is displayed in identity icon label for test " + gTestDesc);
|
||||
|
@ -13,6 +13,7 @@ Browser context menu subtest.
|
||||
<img id="test-image" src="ctxmenu-image.png">
|
||||
<canvas id="test-canvas" width="100" height="100" style="background-color: blue"></canvas>
|
||||
<video controls id="test-video-ok" src="video.ogg" width="100" height="100" style="background-color: green"></video>
|
||||
<video id="test-audio-in-video" src="audio.ogg" width="100" height="100" style="background-color: red"></video>
|
||||
<video controls id="test-video-bad" src="bogus.duh" width="100" height="100" style="background-color: orange"></video>
|
||||
<video controls id="test-video-bad2" width="100" height="100" style="background-color: yellow">
|
||||
<source src="bogus.duh" type="video/durrrr;">
|
||||
|
@ -369,10 +369,25 @@ function runTest(testNum) {
|
||||
"context-sendvideo", true
|
||||
].concat(inspectItems));
|
||||
closeContextMenu();
|
||||
openContextMenuFor(video_bad); // Invoke context menu for next test.
|
||||
openContextMenuFor(audio_in_video); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 9:
|
||||
// Context menu for a video (with an audio-only file)
|
||||
checkContextMenu(["context-media-play", true,
|
||||
"context-media-mute", true,
|
||||
"context-media-showcontrols", true,
|
||||
"---", null,
|
||||
"context-copyaudiourl", true,
|
||||
"---", null,
|
||||
"context-saveaudio", true,
|
||||
"context-sendaudio", true
|
||||
].concat(inspectItems));
|
||||
closeContextMenu();
|
||||
openContextMenuFor(video_bad); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 10:
|
||||
// Context menu for a video (with an INVALID media source)
|
||||
checkContextMenu(["context-media-play", false,
|
||||
"context-media-mute", false,
|
||||
@ -391,7 +406,7 @@ function runTest(testNum) {
|
||||
openContextMenuFor(video_bad2); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 10:
|
||||
case 11:
|
||||
// Context menu for a video (with an INVALID media source)
|
||||
checkContextMenu(["context-media-play", false,
|
||||
"context-media-mute", false,
|
||||
@ -410,7 +425,7 @@ function runTest(testNum) {
|
||||
openContextMenuFor(iframe); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 11:
|
||||
case 12:
|
||||
// Context menu for an iframe
|
||||
checkContextMenu(["context-back", false,
|
||||
"context-forward", false,
|
||||
@ -445,7 +460,7 @@ function runTest(testNum) {
|
||||
openContextMenuFor(video_in_iframe); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 12:
|
||||
case 13:
|
||||
// Context menu for a video in an iframe
|
||||
checkContextMenu(["context-media-play", true,
|
||||
"context-media-mute", true,
|
||||
@ -476,7 +491,7 @@ function runTest(testNum) {
|
||||
openContextMenuFor(image_in_iframe); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 13:
|
||||
case 14:
|
||||
// Context menu for an image in an iframe
|
||||
checkContextMenu(["context-viewimage", true,
|
||||
"context-copyimage-contents", true,
|
||||
@ -503,7 +518,7 @@ function runTest(testNum) {
|
||||
openContextMenuFor(textarea, false, true); // Invoke context menu for next test, but wait for the spellcheck.
|
||||
break;
|
||||
|
||||
case 14:
|
||||
case 15:
|
||||
// Context menu for textarea
|
||||
checkContextMenu(["*chubbiness", true, // spelling suggestion
|
||||
"spell-add-to-dictionary", true,
|
||||
@ -528,14 +543,14 @@ function runTest(testNum) {
|
||||
openContextMenuFor(text); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 15:
|
||||
case 16:
|
||||
// Re-check context menu for plain text to make sure it hasn't changed
|
||||
checkContextMenu(plainTextItems);
|
||||
closeContextMenu();
|
||||
openContextMenuFor(textarea, false, true); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 17:
|
||||
// Context menu for textarea after a word has been added
|
||||
// to the dictionary
|
||||
checkContextMenu(["spell-undo-add-to-dictionary", true,
|
||||
@ -560,7 +575,7 @@ function runTest(testNum) {
|
||||
openContextMenuFor(contenteditable);
|
||||
break;
|
||||
|
||||
case 17:
|
||||
case 18:
|
||||
// Context menu for contenteditable
|
||||
checkContextMenu(["spell-no-suggestions", false,
|
||||
"spell-add-to-dictionary", true,
|
||||
@ -585,7 +600,7 @@ function runTest(testNum) {
|
||||
openContextMenuFor(inputspell); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 18:
|
||||
case 19:
|
||||
// Context menu for spell-check input
|
||||
checkContextMenu(["*prodigality", true, // spelling suggestion
|
||||
"spell-add-to-dictionary", true,
|
||||
@ -610,13 +625,13 @@ function runTest(testNum) {
|
||||
openContextMenuFor(link); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 19:
|
||||
case 20:
|
||||
executeCopyCommand("cmd_copyLink", "http://mozilla.com/");
|
||||
closeContextMenu();
|
||||
openContextMenuFor(pagemenu); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 20:
|
||||
case 21:
|
||||
// Context menu for element with assigned content context menu
|
||||
checkContextMenu(["+Plain item", {type: "", icon: "", checked: false, disabled: false},
|
||||
"+Disabled item", {type: "", icon: "", checked: false, disabled: true},
|
||||
@ -659,7 +674,7 @@ function runTest(testNum) {
|
||||
openContextMenuFor(pagemenu, true); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 21:
|
||||
case 22:
|
||||
// Context menu for element with assigned content context menu
|
||||
// The shift key should bypass content context menu processing
|
||||
checkContextMenu(["context-back", false,
|
||||
@ -682,7 +697,7 @@ function runTest(testNum) {
|
||||
openContextMenuFor(selecttext); // Invoke context menu for next test.
|
||||
return;
|
||||
|
||||
case 22:
|
||||
case 23:
|
||||
// Context menu for selected text
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
// This test is only enabled on Mac due to bug 736399.
|
||||
@ -698,7 +713,7 @@ function runTest(testNum) {
|
||||
openContextMenuFor(selecttextlink); // Invoke context menu for next test.
|
||||
return;
|
||||
|
||||
case 23:
|
||||
case 24:
|
||||
// Context menu for selected text which matches valid URL pattern
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
// This test is only enabled on Mac due to bug 736399.
|
||||
@ -742,7 +757,8 @@ function runTest(testNum) {
|
||||
var testNum = 1;
|
||||
var subwindow, chromeWin, contextMenu, lastElement;
|
||||
var text, link, mailto, input, img, canvas, video_ok, video_bad, video_bad2,
|
||||
iframe, video_in_iframe, image_in_iframe, textarea, contenteditable, inputspell, pagemenu, plainTextItems;
|
||||
iframe, video_in_iframe, image_in_iframe, textarea, contenteditable,
|
||||
inputspell, pagemenu, plainTextItems, audio_in_video;
|
||||
|
||||
function startTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
@ -772,6 +788,7 @@ function startTest() {
|
||||
img = subwindow.document.getElementById("test-image");
|
||||
canvas = subwindow.document.getElementById("test-canvas");
|
||||
video_ok = subwindow.document.getElementById("test-video-ok");
|
||||
audio_in_video = subwindow.document.getElementById("test-audio-in-video");
|
||||
video_bad = subwindow.document.getElementById("test-video-bad");
|
||||
video_bad2 = subwindow.document.getElementById("test-video-bad2");
|
||||
iframe = subwindow.document.getElementById("test-iframe");
|
||||
|
@ -69,7 +69,7 @@
|
||||
#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
#define NS_RSS "http://purl.org/rss/1.0/"
|
||||
|
||||
#define MAX_BYTES 512
|
||||
#define MAX_BYTES 512u
|
||||
|
||||
NS_IMPL_ISUPPORTS3(nsFeedSniffer,
|
||||
nsIContentSniffer,
|
||||
@ -313,19 +313,22 @@ nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request,
|
||||
nsresult rv = ConvertEncodedData(request, data, length);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
const char* testData =
|
||||
mDecodedData.IsEmpty() ? (const char*)data : mDecodedData.get();
|
||||
|
||||
// The strategy here is based on that described in:
|
||||
// http://blogs.msdn.com/rssteam/articles/PublishersGuide.aspx
|
||||
// for interoperarbility purposes.
|
||||
|
||||
// We cap the number of bytes to scan at MAX_BYTES to prevent picking up
|
||||
// false positives by accidentally reading document content, e.g. a "how to
|
||||
// make a feed" page.
|
||||
if (length > MAX_BYTES)
|
||||
length = MAX_BYTES;
|
||||
const char* testData;
|
||||
if (mDecodedData.IsEmpty()) {
|
||||
testData = (const char*)data;
|
||||
length = NS_MIN(length, MAX_BYTES);
|
||||
} else {
|
||||
testData = mDecodedData.get();
|
||||
length = NS_MIN(mDecodedData.Length(), MAX_BYTES);
|
||||
}
|
||||
|
||||
// The strategy here is based on that described in:
|
||||
// http://blogs.msdn.com/rssteam/articles/PublishersGuide.aspx
|
||||
// for interoperarbility purposes.
|
||||
|
||||
// Thus begins the actual sniffing.
|
||||
nsDependentCSubstring dataString((const char*)testData, length);
|
||||
|
@ -58,6 +58,8 @@ _TEST_FILES = bug408328-data.xml \
|
||||
test_bug589543.html \
|
||||
bug589543-data.xml \
|
||||
test_registerHandler.html \
|
||||
valid-feed.xml \
|
||||
valid-unsniffable-feed.xml \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
@ -53,6 +53,7 @@ _CHROME_FILES = \
|
||||
test_423060.xul \
|
||||
test_bug368464.html \
|
||||
test_bug408328.html \
|
||||
test_maxSniffing.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_HTTP_FILES)
|
||||
|
37
browser/components/feeds/test/chrome/test_maxSniffing.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=739040
|
||||
-->
|
||||
<head>
|
||||
<title>Test that we only sniff 512 bytes</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=739040">Mozilla Bug 739040</a>
|
||||
<p id="display">
|
||||
<iframe id="validTestFrame" src="http://mochi.test:8888/tests/browser/components/feeds/test/valid-feed.xml"></iframe>
|
||||
<iframe id="unsniffableTestFrame" src="http://mochi.test:8888/tests/browser/components/feeds/test/valid-unsniffable-feed.xml"></iframe>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 739040 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function() {
|
||||
is($("validTestFrame").contentDocument.documentElement.id, "feedHandler",
|
||||
"valid feed should be sniffed");
|
||||
isnot($("unsniffableTestFrame").contentDocument.documentElement.id, "feedHandler",
|
||||
"unsniffable feed should not be sniffed");
|
||||
});
|
||||
addLoadEvent(SimpleTest.finish);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
23
browser/components/feeds/test/valid-feed.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
|
||||
<title>Example Feed</title>
|
||||
<link href="http://example.org/"/>
|
||||
<updated>2010-08-22T18:30:02Z</updated>
|
||||
|
||||
<author>
|
||||
<name>John Doe</name>
|
||||
</author>
|
||||
<id>urn:uuid:e2df8375-99be-4848-b05e-b9d407555267</id>
|
||||
|
||||
<entry>
|
||||
|
||||
<title>Item</title>
|
||||
<link href="http://example.org/first"/>
|
||||
<id>urn:uuid:9e0f4bed-33d3-4a9d-97ab-ecaa31b3f14a</id>
|
||||
<updated>2010-08-22T18:30:02Z</updated>
|
||||
|
||||
<summary>Some text.</summary>
|
||||
</entry>
|
||||
|
||||
</feed>
|
32
browser/components/feeds/test/valid-unsniffable-feed.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 512 bytes!
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
-->
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
|
||||
<title>Example Feed</title>
|
||||
<link href="http://example.org/"/>
|
||||
<updated>2010-08-22T18:30:02Z</updated>
|
||||
|
||||
<author>
|
||||
<name>John Doe</name>
|
||||
</author>
|
||||
<id>urn:uuid:e2df8375-99be-4848-b05e-b9d407555267</id>
|
||||
|
||||
<entry>
|
||||
|
||||
<title>Item</title>
|
||||
<link href="http://example.org/first"/>
|
||||
<id>urn:uuid:9e0f4bed-33d3-4a9d-97ab-ecaa31b3f14a</id>
|
||||
<updated>2010-08-22T18:30:02Z</updated>
|
||||
|
||||
<summary>Some text.</summary>
|
||||
</entry>
|
||||
|
||||
</feed>
|
@ -1450,33 +1450,32 @@ SessionStoreService.prototype = {
|
||||
undoCloseTab: function sss_undoCloseTab(aWindow, aIndex) {
|
||||
if (!aWindow.__SSi)
|
||||
throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
|
||||
|
||||
|
||||
var closedTabs = this._windows[aWindow.__SSi]._closedTabs;
|
||||
|
||||
// default to the most-recently closed tab
|
||||
aIndex = aIndex || 0;
|
||||
if (!(aIndex in closedTabs))
|
||||
throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
|
||||
|
||||
|
||||
// fetch the data of closed tab, while removing it from the array
|
||||
let closedTab = closedTabs.splice(aIndex, 1).shift();
|
||||
let closedTabState = closedTab.state;
|
||||
|
||||
this._setWindowStateBusy(aWindow);
|
||||
// create a new tab
|
||||
let browser = aWindow.gBrowser;
|
||||
let tab = browser.addTab();
|
||||
let tabbrowser = aWindow.gBrowser;
|
||||
let tab = tabbrowser.addTab();
|
||||
|
||||
// restore tab content
|
||||
this.restoreHistoryPrecursor(aWindow, [tab], [closedTabState], 1, 0, 0);
|
||||
|
||||
// restore the tab's position
|
||||
browser.moveTabTo(tab, closedTab.pos);
|
||||
|
||||
// focus the tab's content area
|
||||
let content = browser.getBrowserForTab(tab).contentWindow;
|
||||
aWindow.setTimeout(function() { content.focus(); }, 0);
|
||||
|
||||
// restore the tab's position
|
||||
tabbrowser.moveTabTo(tab, closedTab.pos);
|
||||
|
||||
// focus the tab's content area (bug 342432)
|
||||
tab.linkedBrowser.focus();
|
||||
|
||||
return tab;
|
||||
},
|
||||
|
||||
|
@ -55,6 +55,7 @@ DIRS = \
|
||||
tilt \
|
||||
scratchpad \
|
||||
debugger \
|
||||
layoutview \
|
||||
shared \
|
||||
$(NULL)
|
||||
|
||||
|
@ -56,6 +56,7 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource:///modules/TreePanel.jsm");
|
||||
Cu.import("resource:///modules/highlighter.jsm");
|
||||
Cu.import("resource:///modules/devtools/LayoutView.jsm");
|
||||
Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
|
||||
|
||||
// Inspector notifications dispatched through the nsIObserverService.
|
||||
@ -367,10 +368,10 @@ InspectorUI.prototype = {
|
||||
*/
|
||||
toggleSidebar: function IUI_toggleSidebar()
|
||||
{
|
||||
if (!this.isSidebarOpen) {
|
||||
this.showSidebar();
|
||||
if (!this.sidebar.visible) {
|
||||
this.sidebar.show();
|
||||
} else {
|
||||
this.hideSidebar();
|
||||
this.sidebar.hide();
|
||||
}
|
||||
},
|
||||
|
||||
@ -1405,6 +1406,12 @@ InspectorStyleSidebar.prototype = {
|
||||
|
||||
destroy: function ISS_destroy()
|
||||
{
|
||||
// close the Layout View
|
||||
if (this._layoutview) {
|
||||
this._layoutview.destroy();
|
||||
this._layoutview = null;
|
||||
}
|
||||
|
||||
for each (let toolID in Object.getOwnPropertyNames(this._tools)) {
|
||||
this.removeTool(toolID);
|
||||
}
|
||||
@ -1514,10 +1521,19 @@ InspectorStyleSidebar.prototype = {
|
||||
|
||||
this._inspector._sidebarOpen = true;
|
||||
Services.prefs.setBoolPref("devtools.inspector.sidebarOpen", true);
|
||||
|
||||
// Instantiate the Layout View if needed.
|
||||
if (Services.prefs.getBoolPref("devtools.layoutview.enabled")
|
||||
&& !this._layoutview) {
|
||||
this._layoutview = new LayoutView({
|
||||
document: this._chromeDoc,
|
||||
inspector: this._inspector,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Hides the sidebar, updating the stored visiblity pref.
|
||||
* Hides the sidebar, updating the stored visibility pref.
|
||||
*/
|
||||
hide: function ISS_hide()
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ function runInspectorTests()
|
||||
ok(!InspectorUI.toolbar.hidden, "toolbar is visible");
|
||||
ok(InspectorUI.inspecting, "Inspector is inspecting");
|
||||
ok(!InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is not open");
|
||||
ok(!InspectorUI.isSidebarOpen, "Inspector Sidebar is not open");
|
||||
ok(!InspectorUI.sidebar.visible, "Inspector sidebar should not visible.");
|
||||
ok(InspectorUI.highlighter, "Highlighter is up");
|
||||
InspectorUI.inspectNode(doc.body);
|
||||
InspectorUI.stopInspecting();
|
||||
@ -91,6 +91,10 @@ function treePanelTests()
|
||||
InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY);
|
||||
ok(InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is open");
|
||||
|
||||
InspectorUI.toggleSidebar();
|
||||
ok(InspectorUI.sidebar.visible, "Inspector Sidebar should be open");
|
||||
InspectorUI.toggleSidebar();
|
||||
ok(!InspectorUI.sidebar.visible, "Inspector Sidebar should be closed");
|
||||
InspectorUI.sidebar.show();
|
||||
InspectorUI.currentInspector.once("sidebaractivated-computedview",
|
||||
stylePanelTests)
|
||||
|
@ -9,6 +9,8 @@ browser.jar:
|
||||
content/browser/devtools/csshtmltree.xul (styleinspector/csshtmltree.xul)
|
||||
content/browser/devtools/cssruleview.xul (styleinspector/cssruleview.xul)
|
||||
content/browser/devtools/styleinspector.css (styleinspector/styleinspector.css)
|
||||
* content/browser/devtools/layoutview/view.xhtml (layoutview/view.xhtml)
|
||||
content/browser/devtools/layoutview/view.css (layoutview/view.css)
|
||||
content/browser/orion.js (sourceeditor/orion/orion.js)
|
||||
* content/browser/source-editor-overlay.xul (sourceeditor/source-editor-overlay.xul)
|
||||
* content/browser/debugger.xul (debugger/debugger.xul)
|
||||
|
317
browser/devtools/layoutview/LayoutView.jsm
Normal file
@ -0,0 +1,317 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla Layout Module.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2012
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Paul Rouget <paul@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource:///modules/inspector.jsm");
|
||||
Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
|
||||
|
||||
var EXPORTED_SYMBOLS = ["LayoutView"];
|
||||
|
||||
function LayoutView(aOptions)
|
||||
{
|
||||
this.chromeDoc = aOptions.document;
|
||||
this.inspector = aOptions.inspector;
|
||||
this.browser = this.inspector.chromeWindow.gBrowser;
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
LayoutView.prototype = {
|
||||
init: function LV_init() {
|
||||
|
||||
this.update = this.update.bind(this);
|
||||
this.onMessage = this.onMessage.bind(this);
|
||||
|
||||
this.isOpen = false;
|
||||
this.documentReady = false;
|
||||
|
||||
// Is the layout view was open before?
|
||||
if (!("_layoutViewIsOpen" in this.inspector)) {
|
||||
this.inspector._layoutViewIsOpen =
|
||||
Services.prefs.getBoolPref("devtools.layoutview.open");
|
||||
}
|
||||
|
||||
// We update the values when:
|
||||
// a node is locked
|
||||
// we get the MozAfterPaint event and the node is locked
|
||||
function onLock() {
|
||||
this.undim();
|
||||
this.update();
|
||||
// We make sure we never add 2 listeners.
|
||||
if (!this.trackingPaint) {
|
||||
this.browser.addEventListener("MozAfterPaint", this.update, true);
|
||||
this.trackingPaint = true;
|
||||
}
|
||||
}
|
||||
|
||||
function onUnlock() {
|
||||
this.browser.removeEventListener("MozAfterPaint", this.update, true);
|
||||
this.trackingPaint = false;
|
||||
this.dim();
|
||||
}
|
||||
|
||||
this.onLock = onLock.bind(this);
|
||||
this.onUnlock = onUnlock.bind(this);
|
||||
this.inspector.on("locked", this.onLock);
|
||||
this.inspector.on("unlocked", this.onUnlock);
|
||||
|
||||
// Build the layout view in the sidebar.
|
||||
this.buildView();
|
||||
|
||||
// Get messages from the iframe.
|
||||
this.inspector.chromeWindow.addEventListener("message", this.onMessage, true);
|
||||
|
||||
// Store for the different dimensions of the node.
|
||||
// 'selector' refers to the element that holds the value in view.xhtml;
|
||||
// 'property' is what we are measuring;
|
||||
// 'value' is the computed dimension, computed in update().
|
||||
this.map = {
|
||||
marginTop: {selector: ".margin.top > span",
|
||||
property: "margin-top",
|
||||
value: undefined},
|
||||
marginBottom: {selector: ".margin.bottom > span",
|
||||
property: "margin-bottom",
|
||||
value: undefined},
|
||||
marginLeft: {selector: ".margin.left > span",
|
||||
property: "margin-left",
|
||||
value: undefined},
|
||||
marginRight: {selector: ".margin.right > span",
|
||||
property: "margin-right",
|
||||
value: undefined},
|
||||
paddingTop: {selector: ".padding.top > span",
|
||||
property: "padding-top",
|
||||
value: undefined},
|
||||
paddingBottom: {selector: ".padding.bottom > span",
|
||||
property: "padding-bottom",
|
||||
value: undefined},
|
||||
paddingLeft: {selector: ".padding.left > span",
|
||||
property: "padding-left",
|
||||
value: undefined},
|
||||
paddingRight: {selector: ".padding.right > span",
|
||||
property: "padding-right",
|
||||
value: undefined},
|
||||
borderTop: {selector: ".border.top > span",
|
||||
property: "border-top-width",
|
||||
value: undefined},
|
||||
borderBottom: {selector: ".border.bottom > span",
|
||||
property: "border-bottom-width",
|
||||
value: undefined},
|
||||
borderLeft: {selector: ".border.left > span",
|
||||
property: "border-left-width",
|
||||
value: undefined},
|
||||
borderRight: {selector: ".border.right > span",
|
||||
property: "border-right-width",
|
||||
value: undefined},
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy the nodes. Remove listeners.
|
||||
*/
|
||||
destroy: function LV_destroy() {
|
||||
this.inspector.removeListener("locked", this.onLock);
|
||||
this.inspector.removeListener("unlocked", this.onUnlock);
|
||||
this.browser.removeEventListener("MozAfterPaint", this.update, true);
|
||||
this.inspector.chromeWindow.removeEventListener("message", this.onMessage, true);
|
||||
this.close();
|
||||
this.iframe = null;
|
||||
this.view.parentNode.removeChild(this.view);
|
||||
},
|
||||
|
||||
/**
|
||||
* Build the Layout container:
|
||||
*
|
||||
* <vbox id="inspector-layoutview-container">
|
||||
* <iframe src="chrome://browser/content/devtools/layoutview/view.xhtml"/>
|
||||
* </vbox>
|
||||
*/
|
||||
buildView: function LV_buildPanel() {
|
||||
this.iframe = this.chromeDoc.createElement("iframe");
|
||||
this.iframe.setAttribute("src", "chrome://browser/content/devtools/layoutview/view.xhtml");
|
||||
|
||||
this.view = this.chromeDoc.createElement("vbox");
|
||||
this.view.id = "inspector-layoutview-container";
|
||||
this.view.appendChild(this.iframe);
|
||||
|
||||
let sidebar = this.chromeDoc.getElementById("devtools-sidebar-box");
|
||||
sidebar.appendChild(this.view);
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the iframe is loaded.
|
||||
*/
|
||||
onDocumentReady: function LV_onDocumentReady() {
|
||||
this.documentReady = true;
|
||||
this.doc = this.iframe.contentDocument;
|
||||
|
||||
// We can't do that earlier because open() and close() need to do stuff
|
||||
// inside the iframe.
|
||||
|
||||
if (this.inspector.locked)
|
||||
this.onLock();
|
||||
else
|
||||
this.onUnlock();
|
||||
|
||||
if (this.inspector._layoutViewIsOpen) {
|
||||
this.open();
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* This is where we get messages from the layout view iframe.
|
||||
*/
|
||||
onMessage: function LV_onMessage(e) {
|
||||
switch (e.data) {
|
||||
case "layoutview-toggle-view":
|
||||
this.toggle(true);
|
||||
break;
|
||||
case "layoutview-ready":
|
||||
this.onDocumentReady();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the view container.
|
||||
*
|
||||
* @param aUserAction Is the action triggered by the user (click on the
|
||||
* open/close button in the view)
|
||||
*/
|
||||
open: function LV_open(aUserAction) {
|
||||
this.isOpen = true;
|
||||
if (this.documentReady)
|
||||
this.doc.body.classList.add("open");
|
||||
if (aUserAction) {
|
||||
this.inspector._layoutViewIsOpen = true;
|
||||
Services.prefs.setBoolPref("devtools.layoutview.open", true);
|
||||
}
|
||||
this.iframe.setAttribute("open", "true");
|
||||
this.update();
|
||||
},
|
||||
|
||||
/**
|
||||
* Close the view container.
|
||||
*
|
||||
* @param aUserAction Is the action triggered by the user (click on the
|
||||
* open/close button in the view)
|
||||
*/
|
||||
close: function LV_close(aUserAction) {
|
||||
this.isOpen = false;
|
||||
if (this.documentReady)
|
||||
this.doc.body.classList.remove("open");
|
||||
if (aUserAction) {
|
||||
this.inspector._layoutViewIsOpen = false;
|
||||
Services.prefs.setBoolPref("devtools.layoutview.open", false);
|
||||
}
|
||||
this.iframe.removeAttribute("open");
|
||||
},
|
||||
|
||||
/**
|
||||
* Toggle view container state (open/close).
|
||||
*
|
||||
* @param aUserAction Is the action triggered by the user (click on the
|
||||
* open/close button in the view)
|
||||
*/
|
||||
toggle: function LV_toggle(aUserAction) {
|
||||
this.isOpen ? this.close(aUserAction):this.open(aUserAction);
|
||||
},
|
||||
|
||||
/**
|
||||
* Hide the layout boxes. No node are selected.
|
||||
*/
|
||||
dim: function LV_dim() {
|
||||
if (!this.documentReady) return;
|
||||
this.doc.body.classList.add("dim");
|
||||
},
|
||||
|
||||
/**
|
||||
* Show the layout boxes. A node is selected.
|
||||
*/
|
||||
undim: function LV_dim() {
|
||||
if (!this.documentReady) return;
|
||||
this.doc.body.classList.remove("dim");
|
||||
},
|
||||
|
||||
/**
|
||||
* Compute the dimensions of the node and update the values in
|
||||
* the layoutview/view.xhtml document.
|
||||
*/
|
||||
update: function LV_update() {
|
||||
let node = this.inspector.selection;
|
||||
if (!node || !this.documentReady) return;
|
||||
|
||||
// First, we update the first part of the layout view, with
|
||||
// the size of the element.
|
||||
|
||||
let clientRect = node.getBoundingClientRect();
|
||||
let width = Math.round(clientRect.width);
|
||||
let height = Math.round(clientRect.height);
|
||||
this.doc.querySelector("#element-size").textContent = width + "x" + height;
|
||||
|
||||
// If the view is closed, no need to do anything more.
|
||||
if (!this.isOpen) return;
|
||||
|
||||
// We compute and update the values of margins & co.
|
||||
let style = this.browser.contentWindow.getComputedStyle(node);;
|
||||
|
||||
for (let i in this.map) {
|
||||
let selector = this.map[i].selector;
|
||||
let property = this.map[i].property;
|
||||
this.map[i].value = parseInt(style.getPropertyValue(property));
|
||||
let span = this.doc.querySelector(selector);
|
||||
span.textContent = this.map[i].value;
|
||||
}
|
||||
|
||||
width -= this.map.borderLeft.value + this.map.borderRight.value +
|
||||
this.map.paddingLeft.value + this.map.paddingRight.value;
|
||||
|
||||
height -= this.map.borderTop.value + this.map.borderBottom.value +
|
||||
this.map.paddingTop.value + this.map.paddingBottom.value;
|
||||
|
||||
this.doc.querySelector(".size > span").textContent = width + "x" + height;
|
||||
},
|
||||
}
|
53
browser/devtools/layoutview/Makefile.in
Normal file
@ -0,0 +1,53 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is LayoutView Build Code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
#
|
||||
# Portions created by the Initial Developer are Copyright (C) 2012
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Paul Rouget <paul@mozilla.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += test
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs::
|
||||
$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/devtools
|
53
browser/devtools/layoutview/test/Makefile.in
Normal file
@ -0,0 +1,53 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2012
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Paul Rouget <paul@mozilla.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = browser/devtools/layoutview/test
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_BROWSER_FILES = \
|
||||
browser_layoutview.js \
|
||||
$(NULL)
|
||||
|
||||
|
||||
libs:: $(_BROWSER_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
|
134
browser/devtools/layoutview/test/browser_layoutview.js
Normal file
@ -0,0 +1,134 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
Services.prefs.setBoolPref("devtools.layoutview.enabled", true);
|
||||
Services.prefs.setBoolPref("devtools.inspector.sidebarOpen", true);
|
||||
|
||||
let doc;
|
||||
let node;
|
||||
let view;
|
||||
|
||||
// Expected values:
|
||||
let res1 = [
|
||||
{selector: "#element-size", value: "160x160"},
|
||||
{selector: ".size > span", value: "100x100"},
|
||||
{selector: ".margin.top > span", value: 30},
|
||||
{selector: ".margin.left > span", value: 30},
|
||||
{selector: ".margin.bottom > span", value: 30},
|
||||
{selector: ".margin.right > span", value: 30},
|
||||
{selector: ".padding.top > span", value: 20},
|
||||
{selector: ".padding.left > span", value: 20},
|
||||
{selector: ".padding.bottom > span", value: 20},
|
||||
{selector: ".padding.right > span", value: 20},
|
||||
{selector: ".border.top > span", value: 10},
|
||||
{selector: ".border.left > span", value: 10},
|
||||
{selector: ".border.bottom > span", value: 10},
|
||||
{selector: ".border.right > span", value: 10},
|
||||
];
|
||||
|
||||
let res2 = [
|
||||
{selector: "#element-size", value: "160x210"},
|
||||
{selector: ".size > span", value: "100x150"},
|
||||
{selector: ".margin.top > span", value: 30},
|
||||
{selector: ".margin.left > span", value: 30},
|
||||
{selector: ".margin.bottom > span", value: 30},
|
||||
{selector: ".margin.right > span", value: 50},
|
||||
{selector: ".padding.top > span", value: 20},
|
||||
{selector: ".padding.left > span", value: 20},
|
||||
{selector: ".padding.bottom > span", value: 20},
|
||||
{selector: ".padding.right > span", value: 20},
|
||||
{selector: ".border.top > span", value: 10},
|
||||
{selector: ".border.left > span", value: 10},
|
||||
{selector: ".border.bottom > span", value: 10},
|
||||
{selector: ".border.right > span", value: 10},
|
||||
];
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onload() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
|
||||
doc = content.document;
|
||||
waitForFocus(setupTest, content);
|
||||
}, true);
|
||||
|
||||
let style = "div { position: absolute; top: 42px; left: 42px; height: 100px; width: 100px; border: 10px solid black; padding: 20px; margin: 30px; }";
|
||||
let html = "<style>" + style + "</style><div></div>"
|
||||
content.location = "data:text/html," + encodeURIComponent(html);
|
||||
|
||||
function setupTest() {
|
||||
node = doc.querySelector("div");
|
||||
ok(node, "node found");
|
||||
|
||||
Services.obs.addObserver(openLayoutView,
|
||||
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
|
||||
InspectorUI.toggleInspectorUI();
|
||||
}
|
||||
|
||||
function openLayoutView() {
|
||||
Services.obs.removeObserver(openLayoutView,
|
||||
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
|
||||
|
||||
info("Inspector open");
|
||||
|
||||
let highlighter = InspectorUI.highlighter;
|
||||
highlighter.highlight(node);
|
||||
highlighter.lock();
|
||||
|
||||
window.addEventListener("message", viewReady, true);
|
||||
}
|
||||
|
||||
function viewReady(e) {
|
||||
if (e.data != "layoutview-ready") return;
|
||||
|
||||
info("Layout view ready");
|
||||
|
||||
view = InspectorUI._sidebar._layoutview;
|
||||
|
||||
ok(!!view, "LayoutView document is alive.");
|
||||
|
||||
view.open();
|
||||
|
||||
ok(view.iframe.getAttribute("open"), "true", "View is open.");
|
||||
|
||||
test1();
|
||||
}
|
||||
|
||||
function test1() {
|
||||
let viewdoc = view.iframe.contentDocument;
|
||||
|
||||
for (let i = 0; i < res1.length; i++) {
|
||||
let elt = viewdoc.querySelector(res1[i].selector);
|
||||
is(elt.textContent, res1[i].value, res1[i].selector + " has the right value.");
|
||||
}
|
||||
|
||||
InspectorUI.selection.style.height = "150px";
|
||||
InspectorUI.selection.style.marginRight = "50px";
|
||||
|
||||
setTimeout(test2, 200); // Should be enough to get a MozAfterPaint event
|
||||
}
|
||||
|
||||
function test2() {
|
||||
let viewdoc = view.iframe.contentDocument;
|
||||
|
||||
for (let i = 0; i < res2.length; i++) {
|
||||
let elt = viewdoc.querySelector(res2[i].selector);
|
||||
is(elt.textContent, res2[i].value, res2[i].selector + " has the right value after style update.");
|
||||
}
|
||||
|
||||
executeSoon(function() {
|
||||
Services.obs.addObserver(finishUp,
|
||||
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
|
||||
InspectorUI.closeInspectorUI();
|
||||
});
|
||||
}
|
||||
|
||||
function finishUp() {
|
||||
Services.prefs.clearUserPref("devtools.layoutview.enabled");
|
||||
Services.prefs.clearUserPref("devtools.inspector.sidebarOpen");
|
||||
Services.obs.removeObserver(finishUp, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
}
|
176
browser/devtools/layoutview/view.css
Normal file
@ -0,0 +1,176 @@
|
||||
body, html {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#header {
|
||||
-moz-box-sizing: border-box;
|
||||
font: 12px/14px monospace;
|
||||
width: 100%;
|
||||
padding: 3px 4px;
|
||||
display: -moz-box;
|
||||
}
|
||||
|
||||
body[dir=rtl] > #header {
|
||||
-moz-box-direction: reverse;
|
||||
}
|
||||
|
||||
#header > span {
|
||||
display: -moz-box;
|
||||
}
|
||||
|
||||
#element-size {
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
body[dir=rtl] > #header > #element-size {
|
||||
-moz-box-pack: end;
|
||||
}
|
||||
|
||||
#header:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#main {
|
||||
margin: 10px;
|
||||
-moz-box-sizing: border-box;
|
||||
width: -moz-calc(100% - 2 * 10px);
|
||||
position: absolute;
|
||||
border-width: 1px;
|
||||
font: 10px/12px monospace;
|
||||
}
|
||||
|
||||
#margins {
|
||||
padding: 28px;
|
||||
}
|
||||
|
||||
#content {
|
||||
height: 20px;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
#padding {
|
||||
border-width: 25px;
|
||||
}
|
||||
|
||||
#borders {
|
||||
border-width: 2px;
|
||||
box-shadow: 0 0 16px black;
|
||||
}
|
||||
|
||||
#main > p {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#main > p {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#main > p > span {
|
||||
vertical-align: middle;
|
||||
pointer-events: auto;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.border.top {
|
||||
left: 0; top: 23px;
|
||||
width: 98px;
|
||||
}
|
||||
|
||||
.border.bottom {
|
||||
right: 0; bottom: 22px;
|
||||
width: 98px;
|
||||
top: auto;
|
||||
}
|
||||
|
||||
.border.left {
|
||||
top: 42px; left: 0;
|
||||
width: 56px;
|
||||
}
|
||||
|
||||
.border.right{
|
||||
bottom: 42px; right: 0;
|
||||
width: 56px;
|
||||
top: auto;
|
||||
}
|
||||
|
||||
.top, .bottom {
|
||||
width: -moz-calc(100% - 2px);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.margin.top {
|
||||
top: 8px;
|
||||
}
|
||||
|
||||
.margin.bottom {
|
||||
bottom: 6px;
|
||||
}
|
||||
|
||||
.padding.top {
|
||||
top: 35px;
|
||||
}
|
||||
|
||||
.padding.bottom {
|
||||
bottom: 35px;
|
||||
}
|
||||
|
||||
.size,
|
||||
.margin.left,
|
||||
.margin.right,
|
||||
.padding.left,
|
||||
.padding.right {
|
||||
top: 0;
|
||||
line-height: 132px;
|
||||
}
|
||||
|
||||
.size {
|
||||
width: -moz-calc(100% - 2px);
|
||||
}
|
||||
|
||||
.margin.right,
|
||||
.margin.left {
|
||||
width: 28px;
|
||||
}
|
||||
|
||||
.padding.right,
|
||||
.padding.left {
|
||||
width: 25px;
|
||||
}
|
||||
|
||||
.margin.right {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.margin.left {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.padding.left {
|
||||
left: 30px;
|
||||
}
|
||||
|
||||
.padding.right {
|
||||
right: 30px;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 2px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
body.dim > #main,
|
||||
body.dim > #header > #element-size {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
149
browser/devtools/layoutview/view.xhtml
Normal file
@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
#ifdef 0
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is LayoutView.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- The Mozilla Foundation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2012
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Paul Rouget <paul@mozilla.com> (original author)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
#endif
|
||||
<!DOCTYPE html [
|
||||
<!ENTITY % layoutviewDTD SYSTEM "chrome://browser/locale/devtools/layoutview.dtd" >
|
||||
%layoutviewDTD;
|
||||
]>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<head>
|
||||
<title>Layout View</title>
|
||||
|
||||
<script type="application/javascript;version=1.8">
|
||||
<![CDATA[
|
||||
let elts;
|
||||
let tooltip;
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
|
||||
window.onload = function() {
|
||||
|
||||
// Tooltip mechanism
|
||||
elts = document.querySelectorAll("*[tooltip]");
|
||||
tooltip = document.querySelector(".tooltip");
|
||||
for (let i = 0; i < elts.length; i++) {
|
||||
let elt = elts[i];
|
||||
elt.addEventListener("mouseover", onmouseover, true);
|
||||
elt.addEventListener("mouseout", onmouseout, true);
|
||||
}
|
||||
|
||||
// Mark document as RTL or LTR:
|
||||
let chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].
|
||||
getService(Ci.nsIXULChromeRegistry);
|
||||
let dir = chromeReg.isLocaleRTL("global");
|
||||
document.body.setAttribute("dir", dir ? "rtl" : "ltr");
|
||||
|
||||
window.parent.postMessage("layoutview-ready", "*");
|
||||
}
|
||||
|
||||
window.onunload = function() {
|
||||
if (elts) {
|
||||
for (let i = 0; i < elts.length; i++) {
|
||||
let elt = elts[i];
|
||||
elt.removeEventListener("mouseover", onmouseover, true);
|
||||
elt.removeEventListener("mouseout", onmouseout, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onmouseover(e) {
|
||||
tooltip.textContent = e.target.getAttribute("tooltip");
|
||||
}
|
||||
|
||||
function onmouseout(e) {
|
||||
tooltip.textContent = "";
|
||||
}
|
||||
|
||||
function toggleView() {
|
||||
window.parent.postMessage("layoutview-toggle-view", "*");
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<link rel="stylesheet" href="chrome://browser/skin/devtools/layoutview.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="view.css" type="text/css"/>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Header: always visible, even when the view is closed. -->
|
||||
<a onclick="toggleView()" href="#" id="header">
|
||||
<span>&elementSize.label;</span>
|
||||
<span id="element-size"></span>
|
||||
<span id="togglebutton"></span>
|
||||
</a>
|
||||
|
||||
<!-- Boxes: hidden when the view is closed. -->
|
||||
<div id="main">
|
||||
|
||||
<div id="margins" tooltip="&margins.tooltip;">
|
||||
<div id="borders" tooltip="&borders.tooltip;">
|
||||
<div id="padding" tooltip="&padding.tooltip;">
|
||||
<div id="content" tooltip="&content.tooltip;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="border top"><span tooltip="border-top"></span></p>
|
||||
<p class="border right"><span tooltip="border-right"></span></p>
|
||||
<p class="border bottom"><span tooltip="border-bottom"></span></p>
|
||||
<p class="border left"><span tooltip="border-left"></span></p>
|
||||
|
||||
<p class="margin top"><span tooltip="margin-top"></span></p>
|
||||
<p class="margin right"><span tooltip="margin-right"></span></p>
|
||||
<p class="margin bottom"><span tooltip="margin-bottom"></span></p>
|
||||
<p class="margin left"><span tooltip="margin-left"></span></p>
|
||||
|
||||
<p class="padding top"><span tooltip="padding-top"></span></p>
|
||||
<p class="padding right"><span tooltip="padding-right"></span></p>
|
||||
<p class="padding bottom"><span tooltip="padding-bottom"></span></p>
|
||||
<p class="padding left"><span tooltip="padding-left"></span></p>
|
||||
|
||||
<p class="size"><span tooltip="&content.tooltip;"></span></p>
|
||||
|
||||
<span class="tooltip"></span>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -632,7 +632,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
|
||||
@BINPATH@/webapp-uninstaller@BIN_SUFFIX@
|
||||
#endif
|
||||
@BINPATH@/webapprt-stub@BIN_SUFFIX@
|
||||
@BINPATH@/webapprt/application.ini
|
||||
@BINPATH@/webapprt/webapprt.ini
|
||||
@BINPATH@/webapprt/chrome.manifest
|
||||
@BINPATH@/webapprt/chrome/webapprt@JAREXT@
|
||||
@BINPATH@/webapprt/chrome/webapprt.manifest
|
||||
|
21
browser/locales/en-US/chrome/browser/devtools/layoutview.dtd
Normal file
@ -0,0 +1,21 @@
|
||||
<!-- LOCALIZATION NOTE : FILE This file contains the Layout View strings.
|
||||
- The Layout View is the panel accessible at the bottom of the Inspector
|
||||
- sidebar. -->
|
||||
|
||||
<!-- LOCALIZATION NOTE : FILE The correct localization of this file might be to
|
||||
- keep it in English, or another language commonly spoken among web developers.
|
||||
- You want to make that choice consistent across the developer tools.
|
||||
- A good criteria is the language in which you'd find the best
|
||||
- documentation on web development on the web. -->
|
||||
|
||||
<!ENTITY elementSize.label "Element Size: ">
|
||||
|
||||
|
||||
<!-- LOCALIZATION NOTE (*.tooltip): These tooltips are not regular tooltips.
|
||||
- The text appears on the bottom right corner of the layout view when
|
||||
- the corresponding box is hovered. -->
|
||||
|
||||
<!ENTITY margins.tooltip "margins">
|
||||
<!ENTITY borders.tooltip "borders">
|
||||
<!ENTITY padding.tooltip "padding">
|
||||
<!ENTITY content.tooltip "content">
|
@ -31,6 +31,7 @@
|
||||
locale/browser/devtools/webConsole.dtd (%chrome/browser/devtools/webConsole.dtd)
|
||||
locale/browser/devtools/sourceeditor.properties (%chrome/browser/devtools/sourceeditor.properties)
|
||||
locale/browser/devtools/sourceeditor.dtd (%chrome/browser/devtools/sourceeditor.dtd)
|
||||
locale/browser/devtools/layoutview.dtd (%chrome/browser/devtools/layoutview.dtd)
|
||||
locale/browser/newTab.dtd (%chrome/browser/newTab.dtd)
|
||||
locale/browser/newTab.properties (%chrome/browser/newTab.properties)
|
||||
locale/browser/openLocation.dtd (%chrome/browser/openLocation.dtd)
|
||||
|
@ -536,10 +536,10 @@ MacNativeApp.prototype = {
|
||||
},
|
||||
|
||||
_createConfigFiles: function() {
|
||||
// ${ProfileDir}/config.json
|
||||
// ${ProfileDir}/webapp.json
|
||||
let json = {
|
||||
"registryDir": this.profileFolder.path,
|
||||
"app": {
|
||||
"profile": this.profileFolder.path,
|
||||
"origin": this.launchURI.prePath,
|
||||
"installOrigin": "apps.mozillalabs.com",
|
||||
"manifest": this.manifest
|
||||
|
@ -1030,11 +1030,29 @@ toolbar[iconsize="small"] #feed-button {
|
||||
#page-proxy-favicon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin: 2px 4px;
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
-moz-margin-start: 4px;
|
||||
-moz-margin-end: 0;
|
||||
list-style-image: url(chrome://browser/skin/identity-icons-generic.png);
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
}
|
||||
|
||||
#page-proxy-favicon:not([src]) {
|
||||
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
|
||||
.verifiedDomain > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
list-style-image: url(chrome://browser/skin/identity-icons-https.png);
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
list-style-image: url(chrome://browser/skin/identity-icons-https-ev.png);
|
||||
}
|
||||
|
||||
#identity-box:hover > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
#identity-box:hover:active > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon,
|
||||
#identity-box[open=true] > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
-moz-image-region: rect(0, 48px, 16px, 32px);
|
||||
}
|
||||
|
||||
#page-proxy-favicon[pageproxystate="invalid"] {
|
||||
@ -1043,9 +1061,6 @@ toolbar[iconsize="small"] #feed-button {
|
||||
|
||||
/* Identity indicator */
|
||||
#identity-box {
|
||||
background-image: -moz-linear-gradient(hsl(0,0%,98%), hsl(0,0%,92%));
|
||||
box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset;
|
||||
-moz-border-end: 1px solid rgba(0,0,0,.1);
|
||||
padding: 1px;
|
||||
margin: -1px;
|
||||
-moz-margin-end: 0;
|
||||
@ -1066,44 +1081,16 @@ toolbar[iconsize="small"] #feed-button {
|
||||
outline-offset: -3px;
|
||||
}
|
||||
|
||||
#identity-box:hover:active,
|
||||
#identity-box[open="true"] {
|
||||
background-image: -moz-linear-gradient(hsl(0,0%,92%), hsl(0,0%,82%));
|
||||
box-shadow: 0 1px 1px hsla(0,0%,0%,.3) inset,
|
||||
0 1px 3px hsla(0,0%,0%,.3) inset;
|
||||
}
|
||||
|
||||
#identity-icon-labels {
|
||||
-moz-margin-start: 4px;
|
||||
-moz-padding-start: 2px;
|
||||
-moz-padding-end: 5px;
|
||||
}
|
||||
|
||||
#identity-box.verifiedDomain {
|
||||
background-image: -moz-linear-gradient(hsl(215,60%,92%), hsl(215,58%,88%));
|
||||
box-shadow: 0 1px 0 hsla(215,54%,33%,.05) inset;
|
||||
-moz-border-end-color: hsla(215,54%,33%,.2);
|
||||
color: hsl(215,54%,33%);
|
||||
}
|
||||
|
||||
#identity-box.verifiedDomain:hover:active,
|
||||
#identity-box.verifiedDomain[open="true"] {
|
||||
background-image: -moz-linear-gradient(hsl(215,80%,80%), hsl(215,67%,65%));
|
||||
box-shadow: 0 1px 1px hsla(215,54%,33%,.7) inset,
|
||||
0 1px 3px 1px hsla(215,54%,33%,.5) inset;
|
||||
}
|
||||
|
||||
#identity-box.verifiedIdentity {
|
||||
background-image: -moz-linear-gradient(hsl(91,70%,90%), hsl(93,60%,81%));
|
||||
box-shadow: 0 1px 0 hsla(92,81%,16%,.05) inset;
|
||||
-moz-border-end-color: hsla(92,81%,16%,.2);
|
||||
background-color: #fff;
|
||||
color: hsl(92,81%,16%);
|
||||
}
|
||||
|
||||
#identity-box.verifiedIdentity:hover:active,
|
||||
#identity-box.verifiedIdentity[open="true"] {
|
||||
background-image: -moz-linear-gradient(hsl(92,65%,70%), hsl(92,40%,48%));
|
||||
box-shadow: 0 1px 1px hsla(92,81%,16%,.6) inset,
|
||||
0 1px 3px 1px hsla(92,81%,16%,.5) inset;
|
||||
-moz-border-end: 1px solid hsla(92,81%,16%,.2);
|
||||
}
|
||||
|
||||
/* Identity popup icons */
|
||||
|
BIN
browser/themes/gnomestripe/devtools/layout-background.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
browser/themes/gnomestripe/devtools/layout-buttons.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
87
browser/themes/gnomestripe/devtools/layoutview.css
Normal file
@ -0,0 +1,87 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is LayoutView.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2012
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Paul Rouget <paul@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
body {
|
||||
background: url(layout-background.png), -moz-radial-gradient(50% 70%, circle cover, hsl(210,53%,45%) 0%, hsl(210,54%,33%) 100%);
|
||||
color: hsl(210,100%,85%);
|
||||
border-top: 1px solid black;
|
||||
-moz-box-sizing: border-box;
|
||||
}
|
||||
|
||||
#element-size {
|
||||
color: hsl(210,100%,95%);
|
||||
}
|
||||
|
||||
#main {
|
||||
border-color: hsla(210,100%,85%,0.7);
|
||||
border-style: dotted;
|
||||
}
|
||||
|
||||
#main > .border {
|
||||
color: hsl(210,53%,45%);
|
||||
}
|
||||
|
||||
.border > span {
|
||||
background-color: hsl(210,100%,85%);
|
||||
border-radius: 2px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
#content {
|
||||
border-color: hsla(210,100%,85%,0.7);
|
||||
border-style: dotted
|
||||
}
|
||||
|
||||
#padding {
|
||||
border-color: hsla(210,100%,85%,0.2);
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
#borders {
|
||||
border-style: solid;
|
||||
border-color: hsl(210,100%,85%);
|
||||
}
|
||||
|
||||
#togglebutton {
|
||||
background-image: url(layout-buttons.png);
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
body.open > #header > #togglebutton {
|
||||
background-position: -18px 0;
|
||||
}
|
BIN
browser/themes/gnomestripe/identity-icons-generic.png
Normal file
After Width: | Height: | Size: 965 B |
BIN
browser/themes/gnomestripe/identity-icons-https-ev.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
browser/themes/gnomestripe/identity-icons-https.png
Normal file
After Width: | Height: | Size: 553 B |
@ -19,6 +19,9 @@ browser.jar:
|
||||
skin/classic/browser/Geolocation-64.png
|
||||
skin/classic/browser/Go-arrow.png
|
||||
skin/classic/browser/identity.png
|
||||
skin/classic/browser/identity-icons-generic.png
|
||||
skin/classic/browser/identity-icons-https.png
|
||||
skin/classic/browser/identity-icons-https-ev.png
|
||||
skin/classic/browser/Info.png
|
||||
skin/classic/browser/KUI-close.png
|
||||
skin/classic/browser/monitor.png
|
||||
@ -138,6 +141,9 @@ browser.jar:
|
||||
skin/classic/browser/devtools/inspect-button.png (devtools/inspect-button.png)
|
||||
skin/classic/browser/devtools/dropmarker.png (devtools/dropmarker.png)
|
||||
skin/classic/browser/devtools/treepanel-button.png (devtools/treepanel-button.png)
|
||||
skin/classic/browser/devtools/layout-background.png (devtools/layout-background.png)
|
||||
skin/classic/browser/devtools/layoutview.css (devtools/layoutview.css)
|
||||
skin/classic/browser/devtools/layout-buttons.png (devtools/layout-buttons.png)
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
skin/classic/browser/sync-16-throbber.png
|
||||
skin/classic/browser/sync-16.png
|
||||
|
@ -975,11 +975,11 @@ toolbar[mode="icons"] #zoom-in-button {
|
||||
}
|
||||
|
||||
#identity-box {
|
||||
background-image: -moz-linear-gradient(hsl(0,0%,98%), hsl(0,0%,92%));
|
||||
box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset;
|
||||
-moz-border-end: 1px solid hsla(0,0%,0%,.1);
|
||||
-moz-margin-end: 3px;
|
||||
padding: 1px 4px;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
-moz-padding-start: 4px;
|
||||
-moz-padding-end: 0;
|
||||
}
|
||||
|
||||
#identity-box:-moz-locale-dir(ltr) {
|
||||
@ -1024,37 +1024,11 @@ toolbar[mode="icons"] #zoom-in-button {
|
||||
padding-right: 10.01px;
|
||||
}
|
||||
|
||||
#identity-box:active:hover,
|
||||
#identity-box[open="true"] {
|
||||
background-image: -moz-linear-gradient(hsl(0,0%,93%), hsl(0,0%,80%));
|
||||
box-shadow: 0 1px 1px hsla(0,0%,0%,.3) inset,
|
||||
0 1px 3px hsla(0,0%,0%,.3) inset;
|
||||
}
|
||||
|
||||
#identity-box.verifiedDomain {
|
||||
background-image: -moz-linear-gradient(hsl(215,60%,92%), hsl(215,58%,88%));
|
||||
-moz-border-end-color: hsla(215,54%,33%,.2);
|
||||
color: hsl(215,54%,33%);
|
||||
}
|
||||
|
||||
#identity-box.verifiedDomain:active:hover,
|
||||
#identity-box.verifiedDomain[open="true"] {
|
||||
background-image: -moz-linear-gradient(hsl(215,85%,85%), hsl(215,70%,68%));
|
||||
box-shadow: 0 1px 1px hsla(215,54%,33%,.7) inset,
|
||||
0 1px 3px 1px hsla(215,54%,33%,.5) inset;
|
||||
}
|
||||
|
||||
#identity-box.verifiedIdentity {
|
||||
background-image: -moz-linear-gradient(hsl(91,70%,90%), hsl(93,60%,81%));
|
||||
-moz-border-end-color: hsla(92,81%,16%,.2);
|
||||
background-color: #fff;
|
||||
color: hsl(92,100%,20%);
|
||||
}
|
||||
|
||||
#identity-box.verifiedIdentity:active:hover,
|
||||
#identity-box.verifiedIdentity[open="true"] {
|
||||
background-image: -moz-linear-gradient(hsl(92,69%,77%), hsl(92,44%,51%));
|
||||
box-shadow: 0 1px 1px hsla(92,81%,16%,.6) inset,
|
||||
0 1px 3px 1px hsla(92,81%,16%,.5) inset;
|
||||
-moz-border-end: 1px solid hsla(92,81%,16%,.2);
|
||||
-moz-padding-end: 4px;
|
||||
}
|
||||
|
||||
#identity-box:-moz-focusring {
|
||||
@ -1065,7 +1039,7 @@ toolbar[mode="icons"] #zoom-in-button {
|
||||
}
|
||||
|
||||
#identity-icon-labels {
|
||||
-moz-margin-start: 6px;
|
||||
-moz-margin-start: 4px;
|
||||
}
|
||||
|
||||
.urlbar-input-box {
|
||||
@ -1112,10 +1086,21 @@ toolbar[mode="icons"] #zoom-in-button {
|
||||
height: 16px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
list-style-image: url(chrome://browser/skin/identity-icons-generic.png);
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
}
|
||||
|
||||
#page-proxy-favicon:not([src]) {
|
||||
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
|
||||
.verifiedDomain > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
list-style-image: url(chrome://browser/skin/identity-icons-https.png);
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
list-style-image: url(chrome://browser/skin/identity-icons-https-ev.png);
|
||||
}
|
||||
|
||||
#identity-box:hover:active > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon,
|
||||
#identity-box[open=true] > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
#page-proxy-favicon[pageproxystate="invalid"] {
|
||||
|
BIN
browser/themes/pinstripe/devtools/layout-background.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
browser/themes/pinstripe/devtools/layout-buttons.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
88
browser/themes/pinstripe/devtools/layoutview.css
Normal file
@ -0,0 +1,88 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is LayoutView.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2012
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Paul Rouget <paul@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
body {
|
||||
background: url(layout-background.png), -moz-radial-gradient(50% 70%, circle cover, hsl(210,53%,45%) 0%, hsl(210,54%,33%) 100%);
|
||||
color: hsl(210,100%,85%);
|
||||
border-top: 1px solid black;
|
||||
-moz-box-sizing: border-box;
|
||||
}
|
||||
|
||||
#element-size {
|
||||
color: hsl(210,100%,95%);
|
||||
}
|
||||
|
||||
#main {
|
||||
border-color: hsla(210,100%,85%,0.7);
|
||||
border-style: dotted;
|
||||
}
|
||||
|
||||
#main > .border {
|
||||
color: hsl(210,53%,45%);
|
||||
}
|
||||
|
||||
.border > span {
|
||||
background-color: hsl(210,100%,85%);
|
||||
border-radius: 2px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
#content {
|
||||
border-color: hsla(210,100%,85%,0.7);
|
||||
border-style: dotted
|
||||
}
|
||||
|
||||
#padding {
|
||||
border-color: hsla(210,100%,85%,0.2);
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
#borders {
|
||||
border-style: solid;
|
||||
border-color: hsl(210,100%,85%);
|
||||
}
|
||||
|
||||
#togglebutton {
|
||||
background-image: url(layout-buttons.png);
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
body.open > #header > #togglebutton {
|
||||
background-position: -18px 0;
|
||||
}
|
||||
|
BIN
browser/themes/pinstripe/identity-icons-generic.png
Normal file
After Width: | Height: | Size: 634 B |
BIN
browser/themes/pinstripe/identity-icons-https-ev.png
Normal file
After Width: | Height: | Size: 541 B |
BIN
browser/themes/pinstripe/identity-icons-https.png
Normal file
After Width: | Height: | Size: 306 B |
@ -25,6 +25,9 @@ browser.jar:
|
||||
skin/classic/browser/hud-style-new-folder-plus-sign.png
|
||||
skin/classic/browser/hud-style-twisties.png
|
||||
skin/classic/browser/identity.png
|
||||
skin/classic/browser/identity-icons-generic.png
|
||||
skin/classic/browser/identity-icons-https.png
|
||||
skin/classic/browser/identity-icons-https-ev.png
|
||||
skin/classic/browser/Info.png
|
||||
skin/classic/browser/KUI-background.png
|
||||
skin/classic/browser/KUI-close.png
|
||||
@ -179,6 +182,9 @@ browser.jar:
|
||||
skin/classic/browser/devtools/inspect-button.png (devtools/inspect-button.png)
|
||||
skin/classic/browser/devtools/dropmarker.png (devtools/dropmarker.png)
|
||||
skin/classic/browser/devtools/treepanel-button.png (devtools/treepanel-button.png)
|
||||
skin/classic/browser/devtools/layout-background.png (devtools/layout-background.png)
|
||||
skin/classic/browser/devtools/layoutview.css (devtools/layoutview.css)
|
||||
skin/classic/browser/devtools/layout-buttons.png (devtools/layout-buttons.png)
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
skin/classic/browser/sync-throbber.png
|
||||
skin/classic/browser/sync-16.png
|
||||
|
@ -735,13 +735,13 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
|
||||
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
|
||||
padding: 2px 6px;
|
||||
background: hsla(210,48%,90%,0) padding-box;
|
||||
border-radius: 2.5px;
|
||||
background: hsla(210,32%,93%,0) padding-box;
|
||||
border-radius: 2px;
|
||||
border: 1px solid;
|
||||
border-color: hsla(210,54%,20%,0) hsla(210,54%,20%,0) hsla(210,54%,20%,0);
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,0) inset,
|
||||
0 0 0 1px rgba(255,255,255,0) inset,
|
||||
0 1px 0 hsla(210,54%,20%,0);
|
||||
box-shadow: 0 1px hsla(0,0%,100%,0) inset,
|
||||
0 1px hsla(210,54%,20%,0),
|
||||
0 0 2px hsla(210,54%,20%,0);
|
||||
-moz-transition-property: background-color, border-color, box-shadow;
|
||||
-moz-transition-duration: 150ms;
|
||||
}
|
||||
@ -764,8 +764,17 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
|
||||
}
|
||||
|
||||
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
|
||||
-moz-border-start-color: rgba(0,0,0,0.1);
|
||||
padding: 8px 2px 7px;
|
||||
padding: 8px 3px 7px;
|
||||
}
|
||||
|
||||
@navbarLargeIcons@ .toolbarbutton-1:not(:hover):not(:active):not([open]) > .toolbarbutton-menubutton-dropmarker::before {
|
||||
content: "";
|
||||
display: -moz-box;
|
||||
width: 1px;
|
||||
height: 18px;
|
||||
-moz-margin-end: -1px;
|
||||
background: hsla(210,54%,20%,.2) padding-box;
|
||||
box-shadow: 0 0 0 1px hsla(0,0%,100%,.2);
|
||||
}
|
||||
|
||||
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-icon:-moz-locale-dir(ltr),
|
||||
@ -780,29 +789,34 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled=true]):not(:active):hover > .toolbarbutton-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1:not([open=true]):not(:active):hover > .toolbarbutton-menubutton-dropmarker:not([disabled=true]) > .dropmarker-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1:not([type=menu-button]):not([disabled=true]):not([checked=true]):not([open=true]):not(:active):hover > .toolbarbutton-icon {
|
||||
background-image: -moz-linear-gradient(rgba(255,255,255,.8), rgba(255,255,255,.45) 49%,
|
||||
rgba(255,255,255,.35) 51%, rgba(255,255,255,.1));
|
||||
background-color: hsla(210,48%,96%,.75);
|
||||
border-color: hsla(210,54%,20%,.3) hsla(210,54%,20%,.35) hsla(210,54%,20%,.4);
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,.3) inset,
|
||||
0 0 0 1px rgba(255,255,255,.3) inset,
|
||||
0 1px 0 hsla(210,54%,20%,.03),
|
||||
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any(:hover,[open]) > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):hover > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):not([checked]):not([open]):not(:active):hover > .toolbarbutton-icon,
|
||||
@conditionalForwardWithUrlbar@ > .toolbarbutton-1:-moz-any([disabled],:not([open]):not([disabled]):not(:active)) > .toolbarbutton-icon {
|
||||
background-image: -moz-linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
|
||||
border-color: hsla(210,54%,20%,.15) hsla(210,54%,20%,.2) hsla(210,54%,20%,.25);
|
||||
box-shadow: 0 1px hsla(0,0%,100%,.3) inset,
|
||||
0 1px hsla(210,54%,20%,.03),
|
||||
0 0 2px hsla(210,54%,20%,.1);
|
||||
}
|
||||
|
||||
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled=true]):hover:active > .toolbarbutton-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1:hover:active > .toolbarbutton-menubutton-dropmarker:not([disabled=true]) > .dropmarker-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1[open=true] > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1:not([type=menu-button]):not([disabled=true]):hover:active > .toolbarbutton-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1:not([type=menu-button])[checked=true] > .toolbarbutton-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1[open=true] > .toolbarbutton-icon {
|
||||
background-color: hsla(210,54%,20%,.2);
|
||||
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):not([open]):not(:active):hover > .toolbarbutton-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1:not([buttonover]):not([open]):not(:active):hover > .toolbarbutton-menubutton-dropmarker:not([disabled]) > .dropmarker-icon,
|
||||
@conditionalForwardWithUrlbar@ > #forward-button:not([open]):not(:active):not([disabled]):hover > .toolbarbutton-icon {
|
||||
border-color: hsla(210,54%,20%,.3) hsla(210,54%,20%,.35) hsla(210,54%,20%,.4);
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.1) inset,
|
||||
0 0 2px rgba(0,0,0,.3) inset,
|
||||
background-color: hsla(210,48%,96%,.75);
|
||||
box-shadow: 0 0 1px hsla(210,54%,20%,.03),
|
||||
0 0 2px hsla(210,54%,20%,.1);
|
||||
}
|
||||
|
||||
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):hover:active > .toolbarbutton-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1[open] > .toolbarbutton-menubutton-dropmarker:not([disabled]) > .dropmarker-icon,
|
||||
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-icon {
|
||||
background-image: -moz-linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
|
||||
background-color: hsla(210,54%,20%,.15);
|
||||
border-color: hsla(210,54%,20%,.3) hsla(210,54%,20%,.35) hsla(210,54%,20%,.4);
|
||||
box-shadow: 0 1px 1px hsla(210,54%,20%,.1) inset,
|
||||
0 0 1px hsla(210,54%,20%,.2) inset,
|
||||
/* allows winstripe-keyhole-forward-mask to be used for non-hover as well as hover: */
|
||||
0 1px 0 hsla(210,54%,20%,0),
|
||||
0 0 2px hsla(210,54%,20%,0);
|
||||
@ -810,7 +824,11 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
|
||||
-moz-transition: none;
|
||||
}
|
||||
|
||||
@navbarLargeIcons@ .toolbarbutton-1[checked=true]:not(:active):hover > .toolbarbutton-icon {
|
||||
@navbarLargeIcons@ .toolbarbutton-1:-moz-any(:hover,[open]) > .toolbarbutton-menubutton-dropmarker:not([disabled]) > .dropmarker-icon {
|
||||
-moz-border-start-color: hsla(210,54%,20%,.35);
|
||||
}
|
||||
|
||||
@navbarLargeIcons@ .toolbarbutton-1[checked]:not(:active):hover > .toolbarbutton-icon {
|
||||
background-color: rgba(90%,90%,90%,.4);
|
||||
-moz-transition: background-color .4s;
|
||||
}
|
||||
@ -886,19 +904,6 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
@conditionalForwardWithUrlbar@ > :-moz-any(#forward-button:not(:hover):not(:active):not([open]),
|
||||
#forward-button[disabled]) > .toolbarbutton-icon {
|
||||
background-color: hsla(210,48%,90%,.1);
|
||||
background-image: -moz-linear-gradient(rgba(255,255,255,.8), rgba(255,255,255,.45) 49%,
|
||||
rgba(255,255,255,.35) 51%, rgba(255,255,255,.1));
|
||||
border-color: hsla(210,54%,20%,.13) hsla(210,54%,20%,.16) hsla(210,54%,20%,.2);
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,.3) inset,
|
||||
0 0 0 1px rgba(255,255,255,.3) inset,
|
||||
0 1px 0 hsla(210,54%,20%,.02),
|
||||
/* allows winstripe-keyhole-forward-mask to be used for non-hover as well as hover: */
|
||||
0 0 2px hsla(210,54%,20%,0);
|
||||
}
|
||||
|
||||
@conditionalForwardWithUrlbar@:not([switchingtabs]) > #forward-button {
|
||||
-moz-transition: opacity @forwardTransitionLength@ ease-out;
|
||||
}
|
||||
@ -930,32 +935,37 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
|
||||
border-radius: 10000px;
|
||||
padding: 5px;
|
||||
border: none;
|
||||
background: hsla(210,48%,90%,.1)
|
||||
-moz-linear-gradient(rgba(255,255,255,.88), rgba(255,255,255,.45) 49%,
|
||||
rgba(255,255,255,.35) 51%, rgba(255,255,255,.67));
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,.3) inset,
|
||||
0 0 0 1px rgba(255,255,255,.3) inset,
|
||||
0 1px 0 hsla(210,54%,20%,.02),
|
||||
0 0 0 1px rgba(0,0,0,.15);
|
||||
background-image: -moz-linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
|
||||
box-shadow: 0 1px 0 hsla(0,0%,100%,.3) inset,
|
||||
0 0 0 1px hsla(0,0%,100%,.3) inset,
|
||||
0 0 0 1px hsla(210,54%,20%,.25),
|
||||
0 1px 0 hsla(210,54%,20%,.35);
|
||||
-moz-transition-property: background-color, box-shadow;
|
||||
-moz-transition-duration: 250ms;
|
||||
}
|
||||
|
||||
@conditionalForwardWithUrlbar@ > #back-button:not([disabled="true"]):not([open="true"]):not(:active):hover > .toolbarbutton-icon {
|
||||
background-color: hsla(210,48%,96%,.75);
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,.3) inset,
|
||||
0 0 0 1px rgba(255,255,255,.1) inset,
|
||||
0 1px 0 hsla(210,54%,20%,.03),
|
||||
0 0 0 1px rgba(0,0,0,.2),
|
||||
0 0 2px 1px hsla(210,54%,20%,.2);
|
||||
box-shadow: 0 1px 0 hsla(0,0%,100%,.3) inset,
|
||||
0 0 0 1px hsla(0,0%,100%,.3) inset,
|
||||
0 0 0 1px hsla(210,54%,20%,.3),
|
||||
0 1px 0 hsla(210,54%,20%,.4),
|
||||
0 0 4px hsla(210,54%,20%,.2);
|
||||
}
|
||||
|
||||
@conditionalForwardWithUrlbar@ > #back-button:not([disabled="true"]):hover:active > .toolbarbutton-icon,
|
||||
@conditionalForwardWithUrlbar@ > #back-button[open="true"] > .toolbarbutton-icon {
|
||||
background-color: hsla(210,54%,20%,.2);
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.1) inset,
|
||||
0 0 2px rgba(0,0,0,.3) inset,
|
||||
0 0 0 1px rgba(0,0,0,.2);
|
||||
background-color: hsla(210,54%,20%,.15);
|
||||
box-shadow: 0 1px 1px hsla(210,54%,20%,.1) inset,
|
||||
0 0 1px hsla(210,54%,20%,.2) inset,
|
||||
0 0 0 1px hsla(210,54%,20%,.4),
|
||||
0 1px 0 hsla(210,54%,20%,.2);
|
||||
-moz-transition: none;
|
||||
}
|
||||
|
||||
@conditionalForwardWithUrlbar@ > #back-button[disabled] > .toolbarbutton-icon {
|
||||
box-shadow: 0 0 0 1px hsla(210,54%,20%,.55),
|
||||
0 1px 0 hsla(210,54%,20%,.65);
|
||||
-moz-transition: none;
|
||||
}
|
||||
|
||||
@ -1343,9 +1353,6 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
|
||||
/* identity box */
|
||||
|
||||
#identity-box {
|
||||
background-image: -moz-linear-gradient(hsl(0,0%,98%), hsl(0,0%,92%));
|
||||
box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset;
|
||||
-moz-border-end: 1px solid hsla(0,0%,0%,.1);
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
@ -1393,51 +1400,10 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
|
||||
padding-right: 5.01px;
|
||||
}
|
||||
|
||||
#identity-box:hover {
|
||||
background-image: -moz-linear-gradient(hsl(0,0%,95%), hsl(0,0%,87%));
|
||||
}
|
||||
|
||||
#identity-box[open="true"],
|
||||
#identity-box:hover:active {
|
||||
background-image: -moz-linear-gradient(hsl(0,0%,92%), hsl(0,0%,82%));
|
||||
box-shadow: 0 1px 1px hsla(0,0%,0%,.3) inset,
|
||||
0 1px 3px hsla(0,0%,0%,.3) inset;
|
||||
}
|
||||
|
||||
#identity-box.verifiedDomain {
|
||||
background-image: -moz-linear-gradient(hsl(215,60%,92%), hsl(215,58%,88%));
|
||||
box-shadow: 0 1px 0 hsla(215,54%,33%,.05) inset;
|
||||
-moz-border-end-color: hsla(215,54%,33%,.2);
|
||||
color: hsl(215,54%,33%);
|
||||
}
|
||||
|
||||
#identity-box.verifiedDomain:hover {
|
||||
background-image: -moz-linear-gradient(hsl(215,85%,85%), hsl(215,70%,68%));
|
||||
}
|
||||
|
||||
#identity-box.verifiedDomain[open="true"],
|
||||
#identity-box.verifiedDomain:hover:active {
|
||||
background-image: -moz-linear-gradient(hsl(215,80%,80%), hsl(215,67%,65%));
|
||||
box-shadow: 0 1px 1px hsla(215,54%,33%,.7) inset,
|
||||
0 1px 3px 1px hsla(215,54%,33%,.5) inset;
|
||||
}
|
||||
|
||||
#identity-box.verifiedIdentity {
|
||||
background-image: -moz-linear-gradient(hsl(91,70%,90%), hsl(93,60%,81%));
|
||||
box-shadow: 0 1px 0 hsla(92,81%,16%,.05) inset;
|
||||
-moz-border-end-color: hsla(92,81%,16%,.2);
|
||||
background-color: #fff;
|
||||
color: hsl(92,100%,20%);
|
||||
}
|
||||
|
||||
#identity-box.verifiedIdentity:hover {
|
||||
background-image: -moz-linear-gradient(hsl(92,69%,77%), hsl(92,44%,51%));
|
||||
}
|
||||
|
||||
#identity-box.verifiedIdentity[open="true"],
|
||||
#identity-box.verifiedIdentity:hover:active {
|
||||
background-image: -moz-linear-gradient(hsl(92,65%,70%), hsl(92,40%,48%));
|
||||
box-shadow: 0 1px 1px hsla(92,81%,16%,.6) inset,
|
||||
0 1px 3px 1px hsla(92,81%,16%,.5) inset;
|
||||
-moz-border-end: 1px solid hsla(92,81%,16%,.2);
|
||||
}
|
||||
|
||||
#identity-box:-moz-focusring {
|
||||
@ -1446,7 +1412,7 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
|
||||
}
|
||||
|
||||
#identity-icon-labels {
|
||||
-moz-margin-start: 1px;
|
||||
-moz-margin-start: 5px;
|
||||
-moz-margin-end: 3px;
|
||||
}
|
||||
|
||||
@ -1482,11 +1448,29 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
|
||||
#page-proxy-favicon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin: 1px 4px;
|
||||
margin-top: 1px;
|
||||
margin-bottom: 1px;
|
||||
-moz-margin-start: 4px;
|
||||
-moz-margin-end: 0;
|
||||
list-style-image: url(chrome://browser/skin/identity-icons-generic.png);
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
}
|
||||
|
||||
#page-proxy-favicon:not([src]) {
|
||||
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
|
||||
.verifiedDomain > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
list-style-image: url(chrome://browser/skin/identity-icons-https.png);
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
list-style-image: url(chrome://browser/skin/identity-icons-https-ev.png);
|
||||
}
|
||||
|
||||
#identity-box:hover > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
#identity-box:hover:active > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon,
|
||||
#identity-box[open=true] > #identity-box-inner > #page-proxy-stack > #page-proxy-favicon {
|
||||
-moz-image-region: rect(0, 48px, 16px, 32px);
|
||||
}
|
||||
|
||||
#page-proxy-favicon[pageproxystate="invalid"] {
|
||||
@ -2190,7 +2174,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#identity-popup-content-host ,
|
||||
#identity-popup-content-host,
|
||||
#identity-popup-content-box.verifiedIdentity > #identity-popup-content-owner {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
BIN
browser/themes/winstripe/devtools/layout-background.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
browser/themes/winstripe/devtools/layout-buttons.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
88
browser/themes/winstripe/devtools/layoutview.css
Normal file
@ -0,0 +1,88 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is LayoutView.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2012
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Paul Rouget <paul@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
body {
|
||||
background: url(layout-background.png), -moz-radial-gradient(50% 70%, circle cover, hsl(210,53%,45%) 0%, hsl(210,54%,33%) 100%);
|
||||
color: hsl(210,100%,85%);
|
||||
border-top: 1px solid black;
|
||||
-moz-box-sizing: border-box;
|
||||
}
|
||||
|
||||
#element-size {
|
||||
color: hsl(210,100%,95%);
|
||||
}
|
||||
|
||||
#main {
|
||||
border-color: hsla(210,100%,85%,0.7);
|
||||
border-style: dotted;
|
||||
}
|
||||
|
||||
#main > .border {
|
||||
color: hsl(210,53%,45%);
|
||||
}
|
||||
|
||||
.border > span {
|
||||
background-color: hsl(210,100%,85%);
|
||||
border-radius: 2px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
#content {
|
||||
border-color: hsla(210,100%,85%,0.7);
|
||||
border-style: dotted
|
||||
}
|
||||
|
||||
#padding {
|
||||
border-color: hsla(210,100%,85%,0.2);
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
#borders {
|
||||
border-style: solid;
|
||||
border-color: hsl(210,100%,85%);
|
||||
}
|
||||
|
||||
#togglebutton {
|
||||
background-image: url(layout-buttons.png);
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
body.open > #header > #togglebutton {
|
||||
background-position: -18px 0;
|
||||
}
|
||||
|
BIN
browser/themes/winstripe/identity-icons-generic.png
Normal file
After Width: | Height: | Size: 965 B |
BIN
browser/themes/winstripe/identity-icons-https-ev.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
browser/themes/winstripe/identity-icons-https.png
Normal file
After Width: | Height: | Size: 553 B |
@ -25,6 +25,9 @@ browser.jar:
|
||||
skin/classic/browser/webapps-64.png
|
||||
skin/classic/browser/Info.png (Info.png)
|
||||
skin/classic/browser/identity.png (identity.png)
|
||||
skin/classic/browser/identity-icons-generic.png
|
||||
skin/classic/browser/identity-icons-https.png
|
||||
skin/classic/browser/identity-icons-https-ev.png
|
||||
skin/classic/browser/keyhole-forward-mask.svg
|
||||
skin/classic/browser/KUI-background.png
|
||||
skin/classic/browser/KUI-close.png
|
||||
@ -165,6 +168,9 @@ browser.jar:
|
||||
skin/classic/browser/devtools/inspect-button.png (devtools/inspect-button.png)
|
||||
skin/classic/browser/devtools/dropmarker.png (devtools/dropmarker.png)
|
||||
skin/classic/browser/devtools/treepanel-button.png (devtools/treepanel-button.png)
|
||||
skin/classic/browser/devtools/layout-background.png (devtools/layout-background.png)
|
||||
skin/classic/browser/devtools/layoutview.css (devtools/layoutview.css)
|
||||
skin/classic/browser/devtools/layout-buttons.png (devtools/layout-buttons.png)
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
skin/classic/browser/sync-throbber.png
|
||||
skin/classic/browser/sync-16.png
|
||||
@ -205,6 +211,9 @@ browser.jar:
|
||||
skin/classic/aero/browser/webapps-64.png
|
||||
skin/classic/aero/browser/Info.png (Info-aero.png)
|
||||
skin/classic/aero/browser/identity.png (identity-aero.png)
|
||||
skin/classic/aero/browser/identity-icons-generic.png
|
||||
skin/classic/aero/browser/identity-icons-https.png
|
||||
skin/classic/aero/browser/identity-icons-https-ev.png
|
||||
skin/classic/aero/browser/keyhole-forward-mask.svg
|
||||
skin/classic/aero/browser/KUI-background.png
|
||||
skin/classic/aero/browser/KUI-close.png
|
||||
@ -345,6 +354,9 @@ browser.jar:
|
||||
skin/classic/aero/browser/devtools/inspect-button.png (devtools/inspect-button.png)
|
||||
skin/classic/aero/browser/devtools/dropmarker.png (devtools/dropmarker.png)
|
||||
skin/classic/aero/browser/devtools/treepanel-button.png (devtools/treepanel-button.png)
|
||||
skin/classic/aero/browser/devtools/layout-background.png (devtools/layout-background.png)
|
||||
skin/classic/aero/browser/devtools/layoutview.css (devtools/layoutview.css)
|
||||
skin/classic/aero/browser/devtools/layout-buttons.png (devtools/layout-buttons.png)
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
skin/classic/aero/browser/sync-throbber.png
|
||||
skin/classic/aero/browser/sync-16.png
|
||||
|
@ -53,6 +53,8 @@ class DeviceManagerADB(DeviceManager):
|
||||
pass
|
||||
|
||||
# Can we run things as root? (currently not required)
|
||||
useRunAsTmp = self.useRunAs
|
||||
self.useRunAs = False
|
||||
try:
|
||||
self.verifyRoot()
|
||||
except DMError, e:
|
||||
@ -63,10 +65,11 @@ class DeviceManagerADB(DeviceManager):
|
||||
# to check again ourselves that we have root now.
|
||||
self.verifyRoot()
|
||||
except DMError:
|
||||
if self.useRunAs:
|
||||
if useRunAsTmp:
|
||||
print "restarting as root failed, but run-as available"
|
||||
else:
|
||||
print "restarting as root failed"
|
||||
self.useRunAs = useRunAsTmp
|
||||
|
||||
# can we use zip to speed up some file operations? (currently not
|
||||
# required)
|
||||
@ -314,6 +317,10 @@ class DeviceManagerADB(DeviceManager):
|
||||
return []
|
||||
if (data[0].find("Not a directory") != -1):
|
||||
return []
|
||||
if (data[0].find("Permission denied") != -1):
|
||||
return []
|
||||
if (data[0].find("opendir failed") != -1):
|
||||
return []
|
||||
return data
|
||||
|
||||
# external function
|
||||
@ -777,10 +784,9 @@ class DeviceManagerADB(DeviceManager):
|
||||
def verifyRoot(self):
|
||||
# a test to see if we have root privs
|
||||
files = self.listFiles("/data/data")
|
||||
if (len(files) == 1):
|
||||
if (files[0].find("Permission denied") != -1):
|
||||
print "NOT running as root"
|
||||
raise DMError("not running as root")
|
||||
if (len(files) == 0):
|
||||
print "NOT running as root"
|
||||
raise DMError("not running as root")
|
||||
|
||||
self.haveRoot = True
|
||||
|
||||
|
@ -59,7 +59,7 @@ class nsString;
|
||||
* http://dev.w3.org/html5/websockets/
|
||||
*
|
||||
*/
|
||||
[scriptable, uuid(f463b9b5-1408-4057-9224-e4f5bc33f17b)]
|
||||
[scriptable, uuid(e59c8c65-df29-485c-a00b-8fac3dc1573a)]
|
||||
interface nsIWebSocket : nsISupports
|
||||
{
|
||||
readonly attribute DOMString url;
|
||||
@ -93,7 +93,7 @@ interface nsIWebSocket : nsISupports
|
||||
* @return if the connection is still established and the data was queued or
|
||||
* sent successfully.
|
||||
*/
|
||||
void send(in nsIVariant data);
|
||||
[implicit_jscontext] void send(in nsIVariant data);
|
||||
|
||||
/**
|
||||
* Closes the Web Socket connection or connection attempt, if any.
|
||||
|
@ -111,7 +111,7 @@ interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget {
|
||||
* you're aware of all the security implications. And then think twice about
|
||||
* it.
|
||||
*/
|
||||
[scriptable, uuid(88ffc45a-22e2-44f4-9a6e-f4586fbde376)]
|
||||
[scriptable, uuid(8681ffbc-4755-45de-9fc1-b63e6930e76a)]
|
||||
interface nsIXMLHttpRequest : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -260,7 +260,7 @@ interface nsIXMLHttpRequest : nsISupports
|
||||
* Type header via the setRequestHeader method before
|
||||
* calling send.
|
||||
*/
|
||||
void send([optional] in nsIVariant body);
|
||||
[implicit_jscontext] void send([optional] in nsIVariant body);
|
||||
|
||||
/**
|
||||
* A variant of the send() method used to send binary data.
|
||||
@ -269,7 +269,7 @@ interface nsIXMLHttpRequest : nsISupports
|
||||
* converted to a single-byte string by truncation (i.e., the
|
||||
* high-order byte of each character will be discarded).
|
||||
*/
|
||||
void sendAsBinary(in DOMString body);
|
||||
[implicit_jscontext] void sendAsBinary(in DOMString body);
|
||||
|
||||
/**
|
||||
* Sets a HTTP request header for HTTP requests. You must call open
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsdbgapi.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -122,7 +122,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
||||
#include "nsILineBreaker.h"
|
||||
#include "nsIWordBreaker.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "harfbuzz/hb-common.h"
|
||||
#include "harfbuzz/hb.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
#include "nsBindingManager.h"
|
||||
@ -5872,15 +5872,14 @@ nsContentUtils::CreateArrayBuffer(JSContext *aCx, const nsACString& aData,
|
||||
}
|
||||
|
||||
PRInt32 dataLen = aData.Length();
|
||||
*aResult = js_CreateArrayBuffer(aCx, dataLen);
|
||||
*aResult = JS_NewArrayBuffer(aCx, dataLen);
|
||||
if (!*aResult) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (dataLen > 0) {
|
||||
JSObject *abuf = js::ArrayBuffer::getArrayBuffer(*aResult);
|
||||
NS_ASSERTION(abuf, "What happened?");
|
||||
memcpy(JS_GetArrayBufferData(abuf), aData.BeginReading(), dataLen);
|
||||
NS_ASSERTION(JS_IsArrayBufferObject(*aResult, aCx), "What happened?");
|
||||
memcpy(JS_GetArrayBufferData(*aResult, aCx), aData.BeginReading(), dataLen);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsDOMBlobBuilder.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIMultiplexInputStream.h"
|
||||
@ -249,11 +249,8 @@ nsDOMMultipartFile::InitInternal(JSContext* aCx,
|
||||
} else {
|
||||
blobSet.AppendBlob(blob);
|
||||
}
|
||||
} else if (js_IsArrayBuffer(&obj)) {
|
||||
JSObject* buffer = js::ArrayBuffer::getArrayBuffer(&obj);
|
||||
if (!buffer)
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
blobSet.AppendArrayBuffer(buffer);
|
||||
} else if (JS_IsArrayBufferObject(&obj, aCx)) {
|
||||
blobSet.AppendArrayBuffer(&obj, aCx);
|
||||
} else {
|
||||
// neither arraybuffer nor blob
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
@ -331,9 +328,10 @@ BlobSet::AppendBlobs(const nsTArray<nsCOMPtr<nsIDOMBlob> >& aBlob)
|
||||
}
|
||||
|
||||
nsresult
|
||||
BlobSet::AppendArrayBuffer(JSObject* aBuffer)
|
||||
BlobSet::AppendArrayBuffer(JSObject* aBuffer, JSContext *aCx)
|
||||
{
|
||||
return AppendVoidPtr(JS_GetArrayBufferData(aBuffer), JS_GetArrayBufferByteLength(aBuffer));
|
||||
return AppendVoidPtr(JS_GetArrayBufferData(aBuffer, aCx),
|
||||
JS_GetArrayBufferByteLength(aBuffer, aCx));
|
||||
}
|
||||
|
||||
DOMCI_DATA(MozBlobBuilder, nsDOMBlobBuilder)
|
||||
@ -436,10 +434,8 @@ nsDOMBlobBuilder::Append(const jsval& aData,
|
||||
}
|
||||
|
||||
// Is it an array buffer?
|
||||
if (js_IsArrayBuffer(obj)) {
|
||||
JSObject* buffer = js::ArrayBuffer::getArrayBuffer(obj);
|
||||
if (buffer)
|
||||
return mBlobSet.AppendArrayBuffer(buffer);
|
||||
if (JS_IsArrayBufferObject(obj, aCx)) {
|
||||
return mBlobSet.AppendArrayBuffer(obj, aCx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
nsresult AppendVoidPtr(const void* aData, PRUint32 aLength);
|
||||
nsresult AppendString(JSString* aString, bool nativeEOL, JSContext* aCx);
|
||||
nsresult AppendBlob(nsIDOMBlob* aBlob);
|
||||
nsresult AppendArrayBuffer(JSObject* aBuffer);
|
||||
nsresult AppendArrayBuffer(JSObject* aBuffer, JSContext *aCx);
|
||||
nsresult AppendBlobs(const nsTArray<nsCOMPtr<nsIDOMBlob> >& aBlob);
|
||||
|
||||
nsTArray<nsCOMPtr<nsIDOMBlob> >& GetBlobs() { Flush(); return mBlobs; }
|
||||
|
@ -81,7 +81,7 @@
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -359,11 +359,9 @@ nsDOMFileReader::DoOnDataAvailable(nsIRequest *aRequest,
|
||||
NS_ASSERTION(bytesRead == aCount, "failed to read data");
|
||||
}
|
||||
else if (mDataFormat == FILE_AS_ARRAYBUFFER) {
|
||||
JSObject* abuf = js::ArrayBuffer::getArrayBuffer(mResultArrayBuffer);
|
||||
NS_ASSERTION(abuf, "What happened?");
|
||||
|
||||
PRUint32 bytesRead = 0;
|
||||
aInputStream->Read((char*)JS_GetArrayBufferData(abuf) + aOffset, aCount, &bytesRead);
|
||||
aInputStream->Read((char*)JS_GetArrayBufferData(mResultArrayBuffer, NULL) + aOffset,
|
||||
aCount, &bytesRead);
|
||||
NS_ASSERTION(bytesRead == aCount, "failed to read data");
|
||||
}
|
||||
else {
|
||||
@ -470,7 +468,7 @@ nsDOMFileReader::ReadFileContent(JSContext* aCx,
|
||||
|
||||
if (mDataFormat == FILE_AS_ARRAYBUFFER) {
|
||||
RootResultArrayBuffer();
|
||||
mResultArrayBuffer = js_CreateArrayBuffer(aCx, mTotal);
|
||||
mResultArrayBuffer = JS_NewArrayBuffer(aCx, mTotal);
|
||||
if (!mResultArrayBuffer) {
|
||||
NS_WARNING("Failed to create JS array buffer");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -79,7 +79,7 @@
|
||||
#include "xpcpublic.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsContentErrors.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "prmem.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
@ -1301,7 +1301,7 @@ ContainsUnpairedSurrogates(const nsAString& aData)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebSocket::Send(nsIVariant *aData)
|
||||
nsWebSocket::Send(nsIVariant *aData, JSContext *aCx)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
@ -1313,7 +1313,7 @@ nsWebSocket::Send(nsIVariant *aData)
|
||||
nsCOMPtr<nsIInputStream> msgStream;
|
||||
bool isBinary;
|
||||
PRUint32 msgLen;
|
||||
nsresult rv = GetSendParams(aData, msgString, msgStream, isBinary, msgLen);
|
||||
nsresult rv = GetSendParams(aData, msgString, msgStream, isBinary, msgLen, aCx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Always increment outgoing buffer len, even if closed
|
||||
@ -1346,7 +1346,8 @@ nsWebSocket::Send(nsIVariant *aData)
|
||||
nsresult
|
||||
nsWebSocket::GetSendParams(nsIVariant *aData, nsCString &aStringOut,
|
||||
nsCOMPtr<nsIInputStream> &aStreamOut,
|
||||
bool &aIsBinary, PRUint32 &aOutgoingLength)
|
||||
bool &aIsBinary, PRUint32 &aOutgoingLength,
|
||||
JSContext *aCx)
|
||||
{
|
||||
// Get type of data (arraybuffer, blob, or string)
|
||||
PRUint16 dataType;
|
||||
@ -1368,9 +1369,9 @@ nsWebSocket::GetSendParams(nsIVariant *aData, nsCString &aStringOut,
|
||||
nsresult rv = aData->GetAsJSVal(&realVal);
|
||||
if (NS_SUCCEEDED(rv) && !JSVAL_IS_PRIMITIVE(realVal) &&
|
||||
(obj = JSVAL_TO_OBJECT(realVal)) &&
|
||||
(js_IsArrayBuffer(obj))) {
|
||||
PRInt32 len = JS_GetArrayBufferByteLength(obj);
|
||||
char* data = (char*)JS_GetArrayBufferData(obj);
|
||||
(JS_IsArrayBufferObject(obj, aCx))) {
|
||||
PRInt32 len = JS_GetArrayBufferByteLength(obj, aCx);
|
||||
char* data = reinterpret_cast<char*>(JS_GetArrayBufferData(obj, aCx));
|
||||
|
||||
aStringOut.Assign(data, len);
|
||||
aIsBinary = true;
|
||||
|
@ -136,7 +136,8 @@ protected:
|
||||
// Get msg info out of JS variable being sent (string, arraybuffer, blob)
|
||||
nsresult GetSendParams(nsIVariant *aData, nsCString &aStringOut,
|
||||
nsCOMPtr<nsIInputStream> &aStreamOut,
|
||||
bool &aIsBinary, PRUint32 &aOutgoingLength);
|
||||
bool &aIsBinary, PRUint32 &aOutgoingLength,
|
||||
JSContext *aCx);
|
||||
|
||||
nsresult DoOnMessageAvailable(const nsACString & aMsg, bool isBinary);
|
||||
nsresult CreateAndDispatchSimpleEvent(const nsString& aName);
|
||||
|
@ -99,11 +99,11 @@
|
||||
#include "nsChannelPolicy.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsAsyncRedirectVerifyHelper.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "nsStringBuffer.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIFileChannel.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "sampler.h"
|
||||
#include "mozilla/dom/bindings/XMLHttpRequestBinding.h"
|
||||
#include "nsIDOMFormData.h"
|
||||
@ -2511,15 +2511,15 @@ nsXMLHttpRequest::ChangeStateToDone()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::SendAsBinary(const nsAString &aBody)
|
||||
nsXMLHttpRequest::SendAsBinary(const nsAString &aBody, JSContext *aCx)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
SendAsBinary(aBody, rv);
|
||||
SendAsBinary(aCx, aBody, rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLHttpRequest::SendAsBinary(const nsAString &aBody, nsresult& aRv)
|
||||
nsXMLHttpRequest::SendAsBinary(JSContext *aCx, const nsAString &aBody, nsresult& aRv)
|
||||
{
|
||||
char *data = static_cast<char*>(NS_Alloc(aBody.Length() + 1));
|
||||
if (!data) {
|
||||
@ -2556,7 +2556,7 @@ nsXMLHttpRequest::SendAsBinary(const nsAString &aBody, nsresult& aRv)
|
||||
return;
|
||||
}
|
||||
|
||||
aRv = Send(variant);
|
||||
aRv = Send(variant, aCx);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
@ -2627,15 +2627,15 @@ GetRequestBody(nsIXHRSendable* aSendable, nsIInputStream** aResult,
|
||||
}
|
||||
|
||||
static nsresult
|
||||
GetRequestBody(JSObject* aArrayBuffer, nsIInputStream** aResult,
|
||||
GetRequestBody(JSObject* aArrayBuffer, JSContext *aCx, nsIInputStream** aResult,
|
||||
nsACString& aContentType, nsACString& aCharset)
|
||||
{
|
||||
NS_ASSERTION(js_IsArrayBuffer(aArrayBuffer), "Not an ArrayBuffer!");
|
||||
NS_ASSERTION(JS_IsArrayBufferObject(aArrayBuffer, aCx), "Not an ArrayBuffer!");
|
||||
aContentType.SetIsVoid(true);
|
||||
aCharset.Truncate();
|
||||
|
||||
PRInt32 length = JS_GetArrayBufferByteLength(aArrayBuffer);
|
||||
char* data = reinterpret_cast<char*>(JS_GetArrayBufferData(aArrayBuffer));
|
||||
PRInt32 length = JS_GetArrayBufferByteLength(aArrayBuffer, aCx);
|
||||
char* data = reinterpret_cast<char*>(JS_GetArrayBufferData(aArrayBuffer, aCx));
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), data, length,
|
||||
@ -2648,7 +2648,7 @@ GetRequestBody(JSObject* aArrayBuffer, nsIInputStream** aResult,
|
||||
}
|
||||
|
||||
static nsresult
|
||||
GetRequestBody(nsIVariant* aBody, nsIInputStream** aResult,
|
||||
GetRequestBody(nsIVariant* aBody, JSContext *aCx, nsIInputStream** aResult,
|
||||
nsACString& aContentType, nsACString& aCharset)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
@ -2699,8 +2699,8 @@ GetRequestBody(nsIVariant* aBody, nsIInputStream** aResult,
|
||||
nsresult rv = aBody->GetAsJSVal(&realVal);
|
||||
if (NS_SUCCEEDED(rv) && !JSVAL_IS_PRIMITIVE(realVal) &&
|
||||
(obj = JSVAL_TO_OBJECT(realVal)) &&
|
||||
(js_IsArrayBuffer(obj))) {
|
||||
return GetRequestBody(obj, aResult, aContentType, aCharset);
|
||||
(JS_IsArrayBufferObject(obj, aCx))) {
|
||||
return GetRequestBody(obj, aCx, aResult, aContentType, aCharset);
|
||||
}
|
||||
}
|
||||
else if (dataType == nsIDataType::VTYPE_VOID ||
|
||||
@ -2725,13 +2725,13 @@ GetRequestBody(nsIVariant* aBody, nsIInputStream** aResult,
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
nsXMLHttpRequest::GetRequestBody(nsIVariant* aVariant,
|
||||
nsXMLHttpRequest::GetRequestBody(nsIVariant* aVariant, JSContext *aCx,
|
||||
const Nullable<RequestBody>& aBody,
|
||||
nsIInputStream** aResult,
|
||||
nsACString& aContentType, nsACString& aCharset)
|
||||
{
|
||||
if (aVariant) {
|
||||
return ::GetRequestBody(aVariant, aResult, aContentType, aCharset);
|
||||
return ::GetRequestBody(aVariant, aCx, aResult, aContentType, aCharset);
|
||||
}
|
||||
|
||||
const RequestBody& body = aBody.Value();
|
||||
@ -2739,7 +2739,7 @@ nsXMLHttpRequest::GetRequestBody(nsIVariant* aVariant,
|
||||
switch (body.GetType()) {
|
||||
case nsXMLHttpRequest::RequestBody::ArrayBuffer:
|
||||
{
|
||||
return ::GetRequestBody(value.mArrayBuffer, aResult, aContentType, aCharset);
|
||||
return ::GetRequestBody(value.mArrayBuffer, aCx, aResult, aContentType, aCharset);
|
||||
}
|
||||
case nsXMLHttpRequest::RequestBody::Blob:
|
||||
{
|
||||
@ -2782,13 +2782,13 @@ nsXMLHttpRequest::GetRequestBody(nsIVariant* aVariant,
|
||||
|
||||
/* void send (in nsIVariant aBody); */
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::Send(nsIVariant *aBody)
|
||||
nsXMLHttpRequest::Send(nsIVariant *aBody, JSContext *aCx)
|
||||
{
|
||||
return Send(aBody, Nullable<RequestBody>());
|
||||
return Send(aCx, aBody, Nullable<RequestBody>());
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
||||
nsXMLHttpRequest::Send(JSContext *aCx, nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
||||
{
|
||||
NS_ENSURE_TRUE(mPrincipal, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
@ -2912,7 +2912,7 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
||||
nsCAutoString defaultContentType;
|
||||
nsCOMPtr<nsIInputStream> postDataStream;
|
||||
|
||||
rv = GetRequestBody(aVariant, aBody, getter_AddRefs(postDataStream),
|
||||
rv = GetRequestBody(aVariant, aCx, aBody, getter_AddRefs(postDataStream),
|
||||
defaultContentType, charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -370,61 +370,62 @@ private:
|
||||
};
|
||||
|
||||
static nsresult GetRequestBody(nsIVariant* aVariant,
|
||||
JSContext* aCx,
|
||||
const Nullable<RequestBody>& aBody,
|
||||
nsIInputStream** aResult,
|
||||
nsACString& aContentType,
|
||||
nsACString& aCharset);
|
||||
|
||||
nsresult Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody);
|
||||
nsresult Send(const Nullable<RequestBody>& aBody)
|
||||
nsresult Send(JSContext *aCx, nsIVariant* aVariant, const Nullable<RequestBody>& aBody);
|
||||
nsresult Send(JSContext *aCx, const Nullable<RequestBody>& aBody)
|
||||
{
|
||||
return Send(nsnull, aBody);
|
||||
return Send(aCx, nsnull, aBody);
|
||||
}
|
||||
nsresult Send(const RequestBody& aBody)
|
||||
nsresult Send(JSContext *aCx, const RequestBody& aBody)
|
||||
{
|
||||
return Send(Nullable<RequestBody>(aBody));
|
||||
return Send(aCx, Nullable<RequestBody>(aBody));
|
||||
}
|
||||
|
||||
public:
|
||||
void Send(nsresult& aRv)
|
||||
void Send(JSContext *aCx, nsresult& aRv)
|
||||
{
|
||||
aRv = Send(Nullable<RequestBody>());
|
||||
aRv = Send(aCx, Nullable<RequestBody>());
|
||||
}
|
||||
void Send(JSObject* aArrayBuffer, nsresult& aRv)
|
||||
void Send(JSContext *aCx, JSObject* aArrayBuffer, nsresult& aRv)
|
||||
{
|
||||
NS_ASSERTION(aArrayBuffer, "Null should go to string version");
|
||||
aRv = Send(RequestBody(aArrayBuffer));
|
||||
aRv = Send(aCx, RequestBody(aArrayBuffer));
|
||||
}
|
||||
void Send(nsIDOMBlob* aBlob, nsresult& aRv)
|
||||
void Send(JSContext *aCx, nsIDOMBlob* aBlob, nsresult& aRv)
|
||||
{
|
||||
NS_ASSERTION(aBlob, "Null should go to string version");
|
||||
aRv = Send(RequestBody(aBlob));
|
||||
aRv = Send(aCx, RequestBody(aBlob));
|
||||
}
|
||||
void Send(nsIDocument* aDoc, nsresult& aRv)
|
||||
void Send(JSContext *aCx, nsIDocument* aDoc, nsresult& aRv)
|
||||
{
|
||||
NS_ASSERTION(aDoc, "Null should go to string version");
|
||||
aRv = Send(RequestBody(aDoc));
|
||||
aRv = Send(aCx, RequestBody(aDoc));
|
||||
}
|
||||
void Send(const nsAString& aString, nsresult& aRv)
|
||||
void Send(JSContext *aCx, const nsAString& aString, nsresult& aRv)
|
||||
{
|
||||
if (DOMStringIsNull(aString)) {
|
||||
Send(aRv);
|
||||
Send(aCx, aRv);
|
||||
}
|
||||
else {
|
||||
aRv = Send(RequestBody(aString));
|
||||
aRv = Send(aCx, RequestBody(aString));
|
||||
}
|
||||
}
|
||||
void Send(nsIDOMFormData* aFormData, nsresult& aRv)
|
||||
void Send(JSContext *aCx, nsIDOMFormData* aFormData, nsresult& aRv)
|
||||
{
|
||||
NS_ASSERTION(aFormData, "Null should go to string version");
|
||||
aRv = Send(RequestBody(aFormData));
|
||||
aRv = Send(aCx, RequestBody(aFormData));
|
||||
}
|
||||
void Send(nsIInputStream* aStream, nsresult& aRv)
|
||||
void Send(JSContext *aCx, nsIInputStream* aStream, nsresult& aRv)
|
||||
{
|
||||
NS_ASSERTION(aStream, "Null should go to string version");
|
||||
aRv = Send(RequestBody(aStream));
|
||||
aRv = Send(aCx, RequestBody(aStream));
|
||||
}
|
||||
void SendAsBinary(const nsAString& aBody, nsresult& aRv);
|
||||
void SendAsBinary(JSContext *aCx, const nsAString& aBody, nsresult& aRv);
|
||||
|
||||
void Abort();
|
||||
|
||||
@ -475,7 +476,7 @@ public:
|
||||
}
|
||||
|
||||
// We need a GetInterface callable from JS for chrome JS
|
||||
JS::Value GetInterface(JSContext*aCx, nsIJSIID* aIID, nsresult& aRv);
|
||||
JS::Value GetInterface(JSContext* aCx, nsIJSIID* aIID, nsresult& aRv);
|
||||
|
||||
// This creates a trusted readystatechange event, which is not cancelable and
|
||||
// doesn't bubble.
|
||||
|
@ -79,7 +79,7 @@ nsresult TestGetURL(const nsCString& aURL)
|
||||
rv = xhr->Open(getString, aURL, false, empty, empty);
|
||||
TEST_ENSURE_SUCCESS(rv, "OpenRequest failed!");
|
||||
|
||||
rv = xhr->Send(nsnull);
|
||||
rv = xhr->Send(nsnull, nsnull);
|
||||
TEST_ENSURE_SUCCESS(rv, "Send failed!");
|
||||
|
||||
nsAutoString response;
|
||||
|
@ -95,7 +95,7 @@ nsresult TestNativeXMLHttpRequest()
|
||||
rv = xhr->Open(getString, testURL, false, empty, empty);
|
||||
TEST_ENSURE_SUCCESS(rv, "Open failed!");
|
||||
|
||||
rv = xhr->Send(nsnull);
|
||||
rv = xhr->Send(nsnull, nsnull);
|
||||
TEST_ENSURE_SUCCESS(rv, "Send failed!");
|
||||
|
||||
nsAutoString response;
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "CustomQS_Canvas.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
typedef NS_STDCALL_FUNCPROTO(nsresult, CanvasStyleSetterType, nsIDOMCanvasRenderingContext2D,
|
||||
SetStrokeStyle_multi, (const nsAString &, nsISupports *));
|
||||
@ -173,8 +174,7 @@ CreateImageData(JSContext* cx, JSObject* obj, uint32_t w, uint32_t h, jsval* vp)
|
||||
}
|
||||
|
||||
// Create the fast typed array; it's initialized to 0 by default.
|
||||
JSObject* darray =
|
||||
js_CreateTypedArray(cx, js::TypedArray::TYPE_UINT8_CLAMPED, len.value());
|
||||
JSObject* darray = JS_NewUint8ClampedArray(cx, len.value());
|
||||
JS::AutoObjectRooter rd(cx, darray);
|
||||
if (!darray) {
|
||||
return false;
|
||||
@ -305,26 +305,30 @@ nsIDOMCanvasRenderingContext2D_PutImageData(JSContext *cx, unsigned argc, jsval
|
||||
|
||||
JS::AutoValueRooter tsrc_tvr(cx);
|
||||
|
||||
JSObject *tsrc = NULL;
|
||||
if (js::GetObjectClass(darray.get()) == &js::TypedArray::fastClasses[js::TypedArray::TYPE_UINT8] ||
|
||||
js::GetObjectClass(darray.get()) == &js::TypedArray::fastClasses[js::TypedArray::TYPE_UINT8_CLAMPED])
|
||||
JSObject * tsrc = NULL;
|
||||
if (JS_IsInt8Array(darray.get(), cx) ||
|
||||
JS_IsUint8Array(darray.get(), cx) ||
|
||||
JS_IsUint8ClampedArray(darray.get(), cx))
|
||||
{
|
||||
tsrc = darray.get();
|
||||
} else if (JS_IsArrayObject(cx, darray.get()) || js_IsTypedArray(darray.get())) {
|
||||
} else if (JS_IsTypedArrayObject(darray.get(), cx) || JS_IsArrayObject(cx, darray.get())) {
|
||||
// ugh, this isn't a uint8 typed array, someone made their own object; convert it to a typed array
|
||||
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_UINT8, darray.get());
|
||||
JSObject *nobj = JS_NewUint8ClampedArrayFromArray(cx, darray.get());
|
||||
if (!nobj)
|
||||
return JS_FALSE;
|
||||
|
||||
*tsrc_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||
tsrc = js::TypedArray::getTypedArray(nobj);
|
||||
tsrc = nobj;
|
||||
} else {
|
||||
// yeah, no.
|
||||
return xpc_qsThrow(cx, NS_ERROR_DOM_TYPE_MISMATCH_ERR);
|
||||
}
|
||||
|
||||
// make the call
|
||||
rv = self->PutImageData_explicit(x, y, w, h, static_cast<PRUint8*>(JS_GetTypedArrayData(tsrc)), JS_GetTypedArrayByteLength(tsrc), hasDirtyRect, dirtyX, dirtyY, dirtyWidth, dirtyHeight);
|
||||
MOZ_ASSERT(JS_IsTypedArrayObject(tsrc, cx));
|
||||
PRUint8* data = reinterpret_cast<PRUint8*>(JS_GetArrayBufferViewData(tsrc, cx));
|
||||
uint32_t byteLength = JS_GetTypedArrayByteLength(tsrc, cx);
|
||||
rv = self->PutImageData_explicit(x, y, w, h, data, byteLength, hasDirtyRect, dirtyX, dirtyY, dirtyWidth, dirtyHeight);
|
||||
if (NS_FAILED(rv))
|
||||
return xpc_qsThrowMethodFailed(cx, rv, vp);
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "CustomQS_Canvas.h"
|
||||
|
||||
#define GET_INT32_ARG(var, index) \
|
||||
@ -84,10 +84,10 @@ public:
|
||||
{}
|
||||
|
||||
nsresult DoCallForImageData(WebGLsizei width, WebGLsizei height,
|
||||
JSObject* pixels)
|
||||
JSObject* pixels, JSContext *cx)
|
||||
{
|
||||
return self->TexImage2D_imageData(target, level, internalformat, width,
|
||||
height, 0, format, type, pixels);
|
||||
height, 0, format, type, pixels, cx);
|
||||
}
|
||||
nsresult DoCallForElement(mozilla::dom::Element* elt)
|
||||
{
|
||||
@ -126,11 +126,11 @@ public:
|
||||
{}
|
||||
|
||||
nsresult DoCallForImageData(WebGLsizei width, WebGLsizei height,
|
||||
JSObject* pixels)
|
||||
JSObject* pixels, JSContext *cx)
|
||||
{
|
||||
return self->TexSubImage2D_imageData(target, level, xoffset, yoffset,
|
||||
width, height, format, type,
|
||||
pixels);
|
||||
pixels, cx);
|
||||
}
|
||||
nsresult DoCallForElement(mozilla::dom::Element* elt)
|
||||
{
|
||||
@ -160,11 +160,11 @@ TexImage2DImageDataOrElement(JSContext* cx, T& self, JS::Value* object)
|
||||
if (!GetImageData(cx, *object, &int_width, &int_height, &obj_data)) {
|
||||
return false;
|
||||
}
|
||||
if (!js_IsTypedArray(obj_data.get())) {
|
||||
if (!JS_IsTypedArrayObject(obj_data.get(), cx)) {
|
||||
return xpc_qsThrow(cx, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
nsresult rv = self.DoCallForImageData(int_width, int_height, obj_data.get());
|
||||
nsresult rv = self.DoCallForImageData(int_width, int_height, obj_data.get(), cx);
|
||||
return NS_SUCCEEDED(rv) || xpc_qsThrow(cx, rv);
|
||||
}
|
||||
|
||||
@ -225,11 +225,11 @@ nsIDOMWebGLRenderingContext_TexImage2D(JSContext *cx, unsigned argc, jsval *vp)
|
||||
if (argv8 == nsnull) {
|
||||
rv = self->TexImage2D_array(argv0, argv1, argv2, argv3,
|
||||
argv4, argv5, argv6, argv7,
|
||||
nsnull);
|
||||
} else if (js_IsTypedArray(argv8)) {
|
||||
nsnull, cx);
|
||||
} else if (JS_IsTypedArrayObject(argv8, cx)) {
|
||||
rv = self->TexImage2D_array(argv0, argv1, argv2, argv3,
|
||||
argv4, argv5, argv6, argv7,
|
||||
js::TypedArray::getTypedArray(argv8));
|
||||
argv8, cx);
|
||||
} else {
|
||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 8);
|
||||
return JS_FALSE;
|
||||
@ -297,10 +297,10 @@ nsIDOMWebGLRenderingContext_TexSubImage2D(JSContext *cx, unsigned argc, jsval *v
|
||||
|
||||
JSObject *argv8 = JSVAL_TO_OBJECT(argv[8]);
|
||||
// try to grab a js::TypedArray
|
||||
if (js_IsTypedArray(argv8)) {
|
||||
if (JS_IsTypedArrayObject(argv8, cx)) {
|
||||
rv = self->TexSubImage2D_array(argv0, argv1, argv2, argv3,
|
||||
argv4, argv5, argv6, argv7,
|
||||
js::TypedArray::getTypedArray(argv8));
|
||||
argv8, cx);
|
||||
} else {
|
||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 8);
|
||||
return JS_FALSE;
|
||||
|
@ -71,10 +71,25 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gl;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(WebGLMemoryPressureObserver, nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLMemoryPressureObserver::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const PRUnichar* aSomeData)
|
||||
{
|
||||
if (strcmp(aTopic, "memory-pressure") == 0)
|
||||
mContext->ForceLoseContext();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** aResult);
|
||||
|
||||
@ -167,25 +182,34 @@ WebGLContext::WebGLContext()
|
||||
WebGLMemoryMultiReporterWrapper::AddWebGLContext(this);
|
||||
|
||||
mAllowRestore = true;
|
||||
mRobustnessTimerRunning = false;
|
||||
mDrawSinceRobustnessTimerSet = false;
|
||||
mContextLossTimerRunning = false;
|
||||
mDrawSinceContextLossTimerSet = false;
|
||||
mContextRestorer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
mContextStatus = ContextStable;
|
||||
mContextLostErrorSet = false;
|
||||
mContextLostDueToTest = false;
|
||||
}
|
||||
|
||||
WebGLContext::~WebGLContext()
|
||||
{
|
||||
DestroyResourcesAndContext();
|
||||
WebGLMemoryMultiReporterWrapper::RemoveWebGLContext(this);
|
||||
TerminateRobustnessTimer();
|
||||
TerminateContextLossTimer();
|
||||
mContextRestorer = nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::DestroyResourcesAndContext()
|
||||
{
|
||||
if (mMemoryPressureObserver) {
|
||||
nsCOMPtr<nsIObserverService> observerService
|
||||
= mozilla::services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->RemoveObserver(mMemoryPressureObserver,
|
||||
"memory-pressure");
|
||||
}
|
||||
mMemoryPressureObserver = nsnull;
|
||||
}
|
||||
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
@ -1030,7 +1054,14 @@ WebGLContext::DummyFramebufferOperation(const char *info)
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::Notify(nsITimer* timer)
|
||||
{
|
||||
TerminateRobustnessTimer();
|
||||
TerminateContextLossTimer();
|
||||
|
||||
if (!HTMLCanvasElement()) {
|
||||
// the canvas is gone. That happens when the page was closed before we got
|
||||
// this timer event. In this case, there's nothing to do here, just don't crash.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If the context has been lost and we're waiting for it to be restored, do
|
||||
// that now.
|
||||
if (mContextStatus == ContextLostAwaitingEvent) {
|
||||
@ -1053,14 +1084,14 @@ WebGLContext::Notify(nsITimer* timer)
|
||||
ForceRestoreContext();
|
||||
// Restart the timer so that it will be restored on the next
|
||||
// callback.
|
||||
SetupRobustnessTimer();
|
||||
SetupContextLossTimer();
|
||||
} else {
|
||||
mContextStatus = ContextLost;
|
||||
}
|
||||
} else if (mContextStatus == ContextLostAwaitingRestore) {
|
||||
// Try to restore the context. If it fails, try again later.
|
||||
if (NS_FAILED(SetDimensions(mWidth, mHeight))) {
|
||||
SetupRobustnessTimer();
|
||||
SetupContextLossTimer();
|
||||
return NS_OK;
|
||||
}
|
||||
mContextStatus = ContextStable;
|
||||
@ -1072,7 +1103,6 @@ WebGLContext::Notify(nsITimer* timer)
|
||||
// Set all flags back to the state they were in before the context was
|
||||
// lost.
|
||||
mContextLostErrorSet = false;
|
||||
mContextLostDueToTest = false;
|
||||
mAllowRestore = true;
|
||||
}
|
||||
|
||||
@ -1090,14 +1120,6 @@ WebGLContext::MaybeRestoreContext()
|
||||
bool isEGL = gl->GetContextType() == GLContext::ContextTypeEGL,
|
||||
isANGLE = gl->IsANGLE();
|
||||
|
||||
// If was lost due to a forced context loss, don't try to handle it.
|
||||
// Also, we also don't try to handle if if we don't have robustness.
|
||||
// Note that the code in this function is used only for situations where
|
||||
// we have an actual context loss, and not a simulated one.
|
||||
if (mContextLostDueToTest ||
|
||||
(!mHasRobustness && !isEGL))
|
||||
return;
|
||||
|
||||
GLContext::ContextResetARB resetStatus = GLContext::CONTEXT_NO_ERROR;
|
||||
if (mHasRobustness) {
|
||||
gl->MakeCurrent();
|
||||
@ -1123,8 +1145,8 @@ WebGLContext::MaybeRestoreContext()
|
||||
// If there has been activity since the timer was set, it's possible
|
||||
// that we did or are going to miss something, so clear this flag and
|
||||
// run it again some time later.
|
||||
if (mDrawSinceRobustnessTimerSet)
|
||||
SetupRobustnessTimer();
|
||||
if (mDrawSinceContextLossTimerSet)
|
||||
SetupContextLossTimer();
|
||||
break;
|
||||
case GLContext::CONTEXT_GUILTY_CONTEXT_RESET_ARB:
|
||||
NS_WARNING("WebGL content on the page caused the graphics card to reset; not restoring the context");
|
||||
@ -1148,9 +1170,12 @@ WebGLContext::MaybeRestoreContext()
|
||||
void
|
||||
WebGLContext::ForceLoseContext()
|
||||
{
|
||||
if (mContextStatus == ContextLostAwaitingEvent)
|
||||
return;
|
||||
|
||||
mContextStatus = ContextLostAwaitingEvent;
|
||||
// Queue up a task to restore the event.
|
||||
SetupRobustnessTimer();
|
||||
SetupContextLossTimer();
|
||||
DestroyResourcesAndContext();
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
#include "GLContextProvider.h"
|
||||
#include "Layers.h"
|
||||
@ -103,8 +104,9 @@ class WebGLFramebuffer;
|
||||
class WebGLRenderbuffer;
|
||||
class WebGLUniformLocation;
|
||||
class WebGLExtension;
|
||||
class WebGLContext;
|
||||
struct WebGLVertexAttribData;
|
||||
|
||||
class WebGLMemoryPressureObserver;
|
||||
class WebGLRectangleObject;
|
||||
class WebGLContextBoundObject;
|
||||
|
||||
@ -526,6 +528,7 @@ class WebGLContext :
|
||||
friend class WebGLMemoryMultiReporterWrapper;
|
||||
friend class WebGLExtensionLoseContext;
|
||||
friend class WebGLContextUserData;
|
||||
friend class WebGLMemoryPressureObserver;
|
||||
|
||||
public:
|
||||
WebGLContext();
|
||||
@ -639,39 +642,27 @@ public:
|
||||
return mMinCapability;
|
||||
}
|
||||
|
||||
// See the comment over WebGLContext::Notify() for more information on this.
|
||||
bool ShouldEnableRobustnessTimer() {
|
||||
return mHasRobustness ||
|
||||
IsExtensionEnabled(WebGL_MOZ_WEBGL_lose_context) ||
|
||||
(gl != nsnull && gl->GetContextType() == gl::GLContext::ContextTypeEGL);
|
||||
}
|
||||
|
||||
// Sets up the GL_ARB_robustness timer if it isn't already, so that if the
|
||||
// driver gets restarted, the context may get reset with it.
|
||||
void SetupRobustnessTimer() {
|
||||
if (!ShouldEnableRobustnessTimer())
|
||||
return;
|
||||
|
||||
void SetupContextLossTimer() {
|
||||
// If the timer was already running, don't restart it here. Instead,
|
||||
// wait until the previous call is done, then fire it one more time.
|
||||
// This is an optimization to prevent unnecessary cross-communication
|
||||
// between threads.
|
||||
if (mRobustnessTimerRunning) {
|
||||
mDrawSinceRobustnessTimerSet = true;
|
||||
if (mContextLossTimerRunning) {
|
||||
mDrawSinceContextLossTimerSet = true;
|
||||
return;
|
||||
}
|
||||
|
||||
mContextRestorer->InitWithCallback(static_cast<nsITimerCallback*>(this),
|
||||
PR_MillisecondsToInterval(1000),
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
mRobustnessTimerRunning = true;
|
||||
mDrawSinceRobustnessTimerSet = false;
|
||||
mContextLossTimerRunning = true;
|
||||
mDrawSinceContextLossTimerSet = false;
|
||||
}
|
||||
|
||||
void TerminateRobustnessTimer() {
|
||||
if (mRobustnessTimerRunning) {
|
||||
void TerminateContextLossTimer() {
|
||||
if (mContextLossTimerRunning) {
|
||||
mContextRestorer->Cancel();
|
||||
mRobustnessTimerRunning = false;
|
||||
mContextLossTimerRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -700,11 +691,11 @@ protected:
|
||||
}
|
||||
|
||||
nsresult BufferData_size(WebGLenum target, WebGLsizei size, WebGLenum usage);
|
||||
nsresult BufferData_buf(WebGLenum target, JSObject* data, WebGLenum usage);
|
||||
nsresult BufferData_array(WebGLenum target, JSObject* data, WebGLenum usage);
|
||||
nsresult BufferData_buf(WebGLenum target, JSObject* data, WebGLenum usage, JSContext *cx);
|
||||
nsresult BufferData_array(WebGLenum target, JSObject* data, WebGLenum usage, JSContext *cx);
|
||||
|
||||
nsresult BufferSubData_buf(WebGLenum target, PRInt32 offset, JSObject* data);
|
||||
nsresult BufferSubData_array(WebGLenum target, PRInt32 offset, JSObject* data);
|
||||
nsresult BufferSubData_buf(WebGLenum target, PRInt32 offset, JSObject* data, JSContext *cx);
|
||||
nsresult BufferSubData_array(WebGLenum target, PRInt32 offset, JSObject* data, JSContext *cx);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCanvasElement> mCanvasElement;
|
||||
|
||||
@ -955,11 +946,10 @@ protected:
|
||||
|
||||
nsCOMPtr<nsITimer> mContextRestorer;
|
||||
bool mAllowRestore;
|
||||
bool mRobustnessTimerRunning;
|
||||
bool mDrawSinceRobustnessTimerSet;
|
||||
bool mContextLossTimerRunning;
|
||||
bool mDrawSinceContextLossTimerSet;
|
||||
ContextStatus mContextStatus;
|
||||
bool mContextLostErrorSet;
|
||||
bool mContextLostDueToTest;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// see bug 713305. This RAII helper guarantees that we're on the discrete GPU, during its lifetime
|
||||
@ -970,6 +960,7 @@ protected:
|
||||
ForceDiscreteGPUHelperCGL mForceDiscreteGPUHelper;
|
||||
#endif
|
||||
|
||||
nsRefPtr<WebGLMemoryPressureObserver> mMemoryPressureObserver;
|
||||
|
||||
public:
|
||||
// console logging helpers
|
||||
@ -2888,6 +2879,21 @@ class WebGLMemoryMultiReporterWrapper
|
||||
}
|
||||
};
|
||||
|
||||
class WebGLMemoryPressureObserver MOZ_FINAL
|
||||
: public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
WebGLMemoryPressureObserver(WebGLContext *context)
|
||||
: mContext(context)
|
||||
{}
|
||||
|
||||
private:
|
||||
WebGLContext *mContext;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
#include "CanvasUtils.h"
|
||||
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#include "WebGLTexelConversions.h"
|
||||
#include "WebGLValidateStrings.h"
|
||||
@ -204,6 +204,9 @@ WebGLContext::BindAttribLocation(nsIWebGLProgram *pobj, WebGLuint location, cons
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::BindBuffer(WebGLenum target, nsIWebGLBuffer *bobj)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
WebGLuint bufname;
|
||||
WebGLBuffer* buf;
|
||||
bool isNull; // allow null objects
|
||||
@ -246,6 +249,9 @@ WebGLContext::BindBuffer(WebGLenum target, nsIWebGLBuffer *bobj)
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::BindFramebuffer(WebGLenum target, nsIWebGLFramebuffer *fbobj)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
WebGLuint framebuffername;
|
||||
bool isNull; // allow null objects
|
||||
bool isDeleted; // allow deleted objects
|
||||
@ -278,6 +284,9 @@ WebGLContext::BindFramebuffer(WebGLenum target, nsIWebGLFramebuffer *fbobj)
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::BindRenderbuffer(WebGLenum target, nsIWebGLRenderbuffer *rbobj)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
WebGLuint renderbuffername;
|
||||
bool isNull; // allow null objects
|
||||
bool isDeleted; // allow deleted objects
|
||||
@ -308,6 +317,9 @@ WebGLContext::BindRenderbuffer(WebGLenum target, nsIWebGLRenderbuffer *rbobj)
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::BindTexture(WebGLenum target, nsIWebGLTexture *tobj)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
WebGLuint texturename;
|
||||
WebGLTexture *tex;
|
||||
bool isNull; // allow null objects
|
||||
@ -443,12 +455,12 @@ WebGLContext::BufferData(PRInt32 target, const JS::Value& data, PRInt32 usage,
|
||||
|
||||
if (data.isObject()) {
|
||||
JSObject& dataObj = data.toObject();
|
||||
if (js_IsArrayBuffer(&dataObj)) {
|
||||
return BufferData_buf(target, &dataObj, usage);
|
||||
if (JS_IsArrayBufferObject(&dataObj, cx)) {
|
||||
return BufferData_buf(target, &dataObj, usage, cx);
|
||||
}
|
||||
|
||||
if (js_IsTypedArray(&dataObj)) {
|
||||
return BufferData_array(target, &dataObj, usage);
|
||||
if (JS_IsTypedArrayObject(&dataObj, cx)) {
|
||||
return BufferData_array(target, &dataObj, usage, cx);
|
||||
}
|
||||
|
||||
return ErrorInvalidValue("bufferData: object passed that is not an "
|
||||
@ -504,11 +516,14 @@ WebGLContext::BufferData_size(WebGLenum target, WebGLsizei size, WebGLenum usage
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebGLContext::BufferData_buf(WebGLenum target, JSObject *wb, WebGLenum usage)
|
||||
WebGLContext::BufferData_buf(WebGLenum target, JSObject *wb, WebGLenum usage, JSContext *cx)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
if (!JS_IsArrayBufferObject(wb, cx))
|
||||
return ErrorInvalidOperation("BufferData: incorrect type");
|
||||
|
||||
WebGLBuffer *boundBuffer = NULL;
|
||||
|
||||
if (target == LOCAL_GL_ARRAY_BUFFER) {
|
||||
@ -528,24 +543,24 @@ WebGLContext::BufferData_buf(WebGLenum target, JSObject *wb, WebGLenum usage)
|
||||
MakeContextCurrent();
|
||||
|
||||
GLenum error = CheckedBufferData(target,
|
||||
JS_GetArrayBufferByteLength(wb),
|
||||
JS_GetArrayBufferData(wb),
|
||||
JS_GetArrayBufferByteLength(wb, cx),
|
||||
JS_GetArrayBufferData(wb, cx),
|
||||
usage);
|
||||
if (error) {
|
||||
LogMessageIfVerbose("bufferData generated error %s", ErrorName(error));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
boundBuffer->SetByteLength(JS_GetArrayBufferByteLength(wb));
|
||||
boundBuffer->SetByteLength(JS_GetArrayBufferByteLength(wb, cx));
|
||||
boundBuffer->InvalidateCachedMaxElements();
|
||||
if (!boundBuffer->CopyDataIfElementArray(JS_GetArrayBufferData(wb)))
|
||||
if (!boundBuffer->CopyDataIfElementArray(JS_GetArrayBufferData(wb, cx)))
|
||||
return ErrorOutOfMemory("bufferData: out of memory");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebGLContext::BufferData_array(WebGLenum target, JSObject *wa, WebGLenum usage)
|
||||
WebGLContext::BufferData_array(WebGLenum target, JSObject *wa, WebGLenum usage, JSContext *cx)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
@ -568,26 +583,31 @@ WebGLContext::BufferData_array(WebGLenum target, JSObject *wa, WebGLenum usage)
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
GLenum error = CheckedBufferData(target,
|
||||
JS_GetTypedArrayByteLength(wa),
|
||||
JS_GetTypedArrayData(wa),
|
||||
usage);
|
||||
if (!JS_IsTypedArrayObject(wa, cx))
|
||||
return ErrorInvalidOperation("BufferData: incorrect type");
|
||||
|
||||
uint32_t byteLength = JS_GetTypedArrayByteLength(wa, cx);
|
||||
void *data = JS_GetArrayBufferViewData(wa, cx);
|
||||
GLenum error = CheckedBufferData(target, byteLength, data, usage);
|
||||
if (error) {
|
||||
LogMessageIfVerbose("bufferData generated error %s", ErrorName(error));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
boundBuffer->SetByteLength(JS_GetTypedArrayByteLength(wa));
|
||||
boundBuffer->SetByteLength(byteLength);
|
||||
boundBuffer->InvalidateCachedMaxElements();
|
||||
if (!boundBuffer->CopyDataIfElementArray(JS_GetTypedArrayData(wa)))
|
||||
if (!boundBuffer->CopyDataIfElementArray(data))
|
||||
return ErrorOutOfMemory("bufferData: out of memory");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::BufferSubData(PRInt32 target, PRInt32 offset, const JS::Value& data)
|
||||
WebGLContext::BufferSubData(PRInt32 target, PRInt32 offset, const JS::Value& data, JSContext *cx)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
if (data.isNull()) {
|
||||
// see http://www.khronos.org/bugzilla/show_bug.cgi?id=386
|
||||
return NS_OK;
|
||||
@ -598,23 +618,26 @@ WebGLContext::BufferSubData(PRInt32 target, PRInt32 offset, const JS::Value& dat
|
||||
}
|
||||
|
||||
JSObject& dataObj = data.toObject();
|
||||
if (js_IsArrayBuffer(&dataObj)) {
|
||||
return BufferSubData_buf(target, offset, &dataObj);
|
||||
if (JS_IsArrayBufferObject(&dataObj, cx)) {
|
||||
return BufferSubData_buf(target, offset, &dataObj, cx);
|
||||
}
|
||||
|
||||
if (js_IsTypedArray(&dataObj)) {
|
||||
return BufferSubData_array(target, offset, &dataObj);
|
||||
if (JS_IsTypedArrayObject(&dataObj, cx)) {
|
||||
return BufferSubData_array(target, offset, &dataObj, cx);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebGLContext::BufferSubData_buf(GLenum target, WebGLsizei byteOffset, JSObject *wb)
|
||||
WebGLContext::BufferSubData_buf(GLenum target, WebGLsizei byteOffset, JSObject *wb, JSContext *cx)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
if (!JS_IsArrayBufferObject(wb, cx))
|
||||
return ErrorInvalidOperation("BufferSubData: incorrect type");
|
||||
|
||||
WebGLBuffer *boundBuffer = NULL;
|
||||
|
||||
if (target == LOCAL_GL_ARRAY_BUFFER) {
|
||||
@ -631,30 +654,33 @@ WebGLContext::BufferSubData_buf(GLenum target, WebGLsizei byteOffset, JSObject *
|
||||
if (!boundBuffer)
|
||||
return ErrorInvalidOperation("BufferData: no buffer bound!");
|
||||
|
||||
CheckedUint32 checked_neededByteLength = CheckedUint32(byteOffset) + JS_GetArrayBufferByteLength(wb);
|
||||
CheckedUint32 checked_neededByteLength = CheckedUint32(byteOffset) + JS_GetArrayBufferByteLength(wb, cx);
|
||||
if (!checked_neededByteLength.valid())
|
||||
return ErrorInvalidOperation("bufferSubData: integer overflow computing the needed byte length");
|
||||
|
||||
if (checked_neededByteLength.value() > boundBuffer->ByteLength())
|
||||
return ErrorInvalidOperation("BufferSubData: not enough data - operation requires %d bytes, but buffer only has %d bytes",
|
||||
byteOffset, JS_GetArrayBufferByteLength(wb), boundBuffer->ByteLength());
|
||||
byteOffset, JS_GetArrayBufferByteLength(wb, cx), boundBuffer->ByteLength());
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
boundBuffer->CopySubDataIfElementArray(byteOffset, JS_GetArrayBufferByteLength(wb), JS_GetArrayBufferData(wb));
|
||||
boundBuffer->CopySubDataIfElementArray(byteOffset, JS_GetArrayBufferByteLength(wb, cx), JS_GetArrayBufferData(wb, cx));
|
||||
boundBuffer->InvalidateCachedMaxElements();
|
||||
|
||||
gl->fBufferSubData(target, byteOffset, JS_GetArrayBufferByteLength(wb), JS_GetArrayBufferData(wb));
|
||||
gl->fBufferSubData(target, byteOffset, JS_GetArrayBufferByteLength(wb, cx), JS_GetArrayBufferData(wb, cx));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebGLContext::BufferSubData_array(WebGLenum target, WebGLsizei byteOffset, JSObject *wa)
|
||||
WebGLContext::BufferSubData_array(WebGLenum target, WebGLsizei byteOffset, JSObject *wa, JSContext *cx)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
if (!JS_IsTypedArrayObject(wa, cx))
|
||||
return ErrorInvalidOperation("BufferSubData: incorrect type");
|
||||
|
||||
WebGLBuffer *boundBuffer = NULL;
|
||||
|
||||
if (target == LOCAL_GL_ARRAY_BUFFER) {
|
||||
@ -671,20 +697,20 @@ WebGLContext::BufferSubData_array(WebGLenum target, WebGLsizei byteOffset, JSObj
|
||||
if (!boundBuffer)
|
||||
return ErrorInvalidOperation("BufferData: no buffer bound!");
|
||||
|
||||
CheckedUint32 checked_neededByteLength = CheckedUint32(byteOffset) + JS_GetTypedArrayByteLength(wa);
|
||||
CheckedUint32 checked_neededByteLength = CheckedUint32(byteOffset) + JS_GetTypedArrayByteLength(wa, cx);
|
||||
if (!checked_neededByteLength.valid())
|
||||
return ErrorInvalidOperation("bufferSubData: integer overflow computing the needed byte length");
|
||||
|
||||
if (checked_neededByteLength.value() > boundBuffer->ByteLength())
|
||||
return ErrorInvalidOperation("BufferSubData: not enough data -- operation requires %d bytes, but buffer only has %d bytes",
|
||||
byteOffset, JS_GetTypedArrayByteLength(wa), boundBuffer->ByteLength());
|
||||
byteOffset, JS_GetTypedArrayByteLength(wa, cx), boundBuffer->ByteLength());
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
boundBuffer->CopySubDataIfElementArray(byteOffset, JS_GetTypedArrayByteLength(wa), JS_GetTypedArrayData(wa));
|
||||
boundBuffer->CopySubDataIfElementArray(byteOffset, JS_GetTypedArrayByteLength(wa, cx), JS_GetArrayBufferViewData(wa, cx));
|
||||
boundBuffer->InvalidateCachedMaxElements();
|
||||
|
||||
gl->fBufferSubData(target, byteOffset, JS_GetTypedArrayByteLength(wa), JS_GetTypedArrayData(wa));
|
||||
gl->fBufferSubData(target, byteOffset, JS_GetTypedArrayByteLength(wa, cx), JS_GetArrayBufferViewData(wa, cx));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1628,7 +1654,7 @@ WebGLContext::DrawArrays(GLenum mode, WebGLint first, WebGLsizei count)
|
||||
if (!DoFakeVertexAttrib0(checked_firstPlusCount.value()))
|
||||
return NS_OK;
|
||||
|
||||
SetupRobustnessTimer();
|
||||
SetupContextLossTimer();
|
||||
gl->fDrawArrays(mode, first, count);
|
||||
|
||||
UndoFakeVertexAttrib0();
|
||||
@ -1739,7 +1765,7 @@ WebGLContext::DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type, Web
|
||||
if (!DoFakeVertexAttrib0(checked_maxIndexPlusOne.value()))
|
||||
return NS_OK;
|
||||
|
||||
SetupRobustnessTimer();
|
||||
SetupContextLossTimer();
|
||||
gl->fDrawElements(mode, count, type, reinterpret_cast<GLvoid*>(byteOffset));
|
||||
|
||||
UndoFakeVertexAttrib0();
|
||||
@ -2075,11 +2101,11 @@ WebGLContext::GetAttribLocation(nsIWebGLProgram *pobj,
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::GetParameter(PRUint32 pname, nsIVariant **retval)
|
||||
{
|
||||
*retval = nsnull;
|
||||
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
*retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIWritableVariant> wrval = do_CreateInstance("@mozilla.org/variant;1");
|
||||
NS_ENSURE_TRUE(wrval, NS_ERROR_FAILURE);
|
||||
|
||||
@ -2843,11 +2869,11 @@ WebGLContext::TexParameteri(WebGLenum target, WebGLenum pname, WebGLint param)
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::GetTexParameter(WebGLenum target, WebGLenum pname, nsIVariant **retval)
|
||||
{
|
||||
*retval = nsnull;
|
||||
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
*retval = nsnull;
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
if (!ValidateTextureTargetEnum(target, "getTexParameter: target"))
|
||||
@ -2893,11 +2919,11 @@ WebGLContext::GetTexParameter(WebGLenum target, WebGLenum pname, nsIVariant **re
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::GetUniform(nsIWebGLProgram *pobj, nsIWebGLUniformLocation *ploc, nsIVariant **retval)
|
||||
{
|
||||
*retval = nsnull;
|
||||
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
*retval = nsnull;
|
||||
|
||||
WebGLuint progname;
|
||||
WebGLProgram *prog;
|
||||
if (!GetConcreteObjectAndGLName("getUniform: program", pobj, &prog, &progname))
|
||||
@ -3051,11 +3077,11 @@ WebGLContext::GetUniformLocation(nsIWebGLProgram *pobj, const nsAString& name, n
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::GetVertexAttrib(WebGLuint index, WebGLenum pname, nsIVariant **retval)
|
||||
{
|
||||
*retval = nsnull;
|
||||
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
*retval = nsnull;
|
||||
|
||||
if (!ValidateAttribIndex(index, "getVertexAttrib"))
|
||||
return NS_OK;
|
||||
|
||||
@ -3366,9 +3392,13 @@ GL_SAME_METHOD_2(PolygonOffset, PolygonOffset, WebGLfloat, WebGLfloat)
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::ReadPixels(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, WebGLenum type, const JS::Value& pixelsVal)
|
||||
WebGLenum format, WebGLenum type, const JS::Value& pixelsVal, JSContext *cx)
|
||||
{
|
||||
if (!pixelsVal.isObject() || !js_IsTypedArray(&pixelsVal.toObject())) {
|
||||
if (!pixelsVal.isObject()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!JS_IsTypedArrayObject(&pixelsVal.toObject(), cx)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -3390,9 +3420,9 @@ WebGLContext::ReadPixels(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei he
|
||||
WebGLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0;
|
||||
WebGLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0;
|
||||
|
||||
void* data = JS_GetTypedArrayData(&pixels);
|
||||
PRUint32 dataByteLen = JS_GetTypedArrayByteLength(&pixels);
|
||||
int dataType = JS_GetTypedArrayType(&pixels);
|
||||
void* data = JS_GetArrayBufferViewData(&pixels, cx);
|
||||
PRUint32 dataByteLen = JS_GetTypedArrayByteLength(&pixels, cx);
|
||||
int dataType = JS_GetTypedArrayType(&pixels, cx);
|
||||
|
||||
PRUint32 channels = 0;
|
||||
|
||||
@ -3418,13 +3448,13 @@ WebGLContext::ReadPixels(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei he
|
||||
switch (type) {
|
||||
case LOCAL_GL_UNSIGNED_BYTE:
|
||||
bytesPerPixel = 1 * channels;
|
||||
requiredDataType = js::TypedArray::TYPE_UINT8;
|
||||
requiredDataType = js::ArrayBufferView::TYPE_UINT8;
|
||||
break;
|
||||
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
|
||||
bytesPerPixel = 2;
|
||||
requiredDataType = js::TypedArray::TYPE_UINT16;
|
||||
requiredDataType = js::ArrayBufferView::TYPE_UINT16;
|
||||
break;
|
||||
default:
|
||||
return ErrorInvalidEnum("readPixels: Bad type");
|
||||
@ -4090,7 +4120,8 @@ WebGLContext::DOMElementToImageSurface(Element* imageOrCanvas,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
template<size_t type>
|
||||
template<JSBool TypedArrayTest(JSObject* obj, JSContext* cx),
|
||||
JSObject* TypedArrayCopy(JSContext* cx, JSObject* src)>
|
||||
static JSObject*
|
||||
GetTypedArray(JSContext* aCx, const JS::Value& aValue)
|
||||
{
|
||||
@ -4100,12 +4131,12 @@ GetTypedArray(JSContext* aCx, const JS::Value& aValue)
|
||||
|
||||
JSObject& value = aValue.toObject();
|
||||
|
||||
if (js::GetObjectClass(&value) == &js::TypedArray::fastClasses[type]) {
|
||||
if (TypedArrayTest(&value, aCx)) {
|
||||
return &value;
|
||||
}
|
||||
|
||||
if (JS_IsArrayObject(aCx, &value)) {
|
||||
return js_CreateTypedArrayWithArray(aCx, type, &value);
|
||||
return TypedArrayCopy(aCx, &value);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -4114,7 +4145,7 @@ GetTypedArray(JSContext* aCx, const JS::Value& aValue)
|
||||
static JSObject*
|
||||
GetFloat32Array(JSContext* aCx, const JS::Value& aValue)
|
||||
{
|
||||
return GetTypedArray<js::TypedArray::TYPE_FLOAT32>(aCx, aValue);
|
||||
return GetTypedArray<JS_IsFloat32Array, JS_NewFloat32ArrayFromArray>(aCx, aValue);
|
||||
}
|
||||
|
||||
#define OBTAIN_UNIFORM_LOCATION(info) \
|
||||
@ -4138,7 +4169,7 @@ NS_IMETHODIMP
|
||||
WebGLContext::name(nsIWebGLUniformLocation *aLocation, const JS::Value& aValue, \
|
||||
JSContext* aCx) \
|
||||
{ \
|
||||
JSObject* wa = GetTypedArray<js::TypedArray::arrayType>(aCx, aValue); \
|
||||
JSObject* wa = GetTypedArray<JS_Is ## arrayType ## Array, JS_New ## arrayType ## ArrayFromArray>(aCx, aValue); \
|
||||
if (!wa) { \
|
||||
return NS_ERROR_FAILURE; \
|
||||
} \
|
||||
@ -4149,9 +4180,6 @@ WebGLContext::name(nsIWebGLUniformLocation *aLocation, const JS::Value& aValue,
|
||||
\
|
||||
nsIWebGLUniformLocation* ploc = aLocation; \
|
||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||
if (JS_GetTypedArrayType(wa) != js::TypedArray::arrayType) { \
|
||||
return ErrorInvalidOperation(#name ": array must be " #arrayType); \
|
||||
} \
|
||||
int elementSize = location_object->ElementSize(); \
|
||||
if (cnt != elementSize) { \
|
||||
return ErrorInvalidOperation( \
|
||||
@ -4160,7 +4188,7 @@ WebGLContext::name(nsIWebGLUniformLocation *aLocation, const JS::Value& aValue,
|
||||
cnt, \
|
||||
elementSize); \
|
||||
} \
|
||||
PRUint32 arrayLength = JS_GetTypedArrayLength(wa); \
|
||||
PRUint32 arrayLength = JS_GetTypedArrayLength(wa, aCx); \
|
||||
const WebGLUniformInfo& info = location_object->Info(); \
|
||||
PRUint32 expectedArrayLength = cnt * info.arraySize; \
|
||||
if (arrayLength < expectedArrayLength || \
|
||||
@ -4185,7 +4213,7 @@ WebGLContext::name(nsIWebGLUniformLocation *aLocation, const JS::Value& aValue,
|
||||
\
|
||||
MakeContextCurrent(); \
|
||||
gl->f##name(location, info.arraySize, \
|
||||
static_cast<ptrType*>(JS_GetTypedArrayData(wa))); \
|
||||
static_cast<ptrType*>(JS_GetArrayBufferViewData(wa, aCx))); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
@ -4205,7 +4233,7 @@ WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose,
|
||||
\
|
||||
nsIWebGLUniformLocation* ploc = aLocation; \
|
||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||
if (JS_GetTypedArrayType(wa) != js::TypedArray::TYPE_FLOAT32) { \
|
||||
if (!wa || !JS_IsFloat32Array(wa, aCx)) { \
|
||||
return ErrorInvalidValue(#name ": array must be of Float32 type"); \
|
||||
} \
|
||||
int elementSize = location_object->ElementSize(); \
|
||||
@ -4216,7 +4244,7 @@ WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose,
|
||||
dim*dim, \
|
||||
elementSize); \
|
||||
} \
|
||||
PRUint32 arrayLength = JS_GetTypedArrayLength(wa); \
|
||||
PRUint32 arrayLength = JS_GetTypedArrayLength(wa, aCx); \
|
||||
const WebGLUniformInfo& info = location_object->Info(); \
|
||||
PRUint32 expectedArrayLength = dim * dim * info.arraySize; \
|
||||
if (arrayLength < expectedArrayLength || \
|
||||
@ -4245,7 +4273,7 @@ WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose,
|
||||
\
|
||||
MakeContextCurrent(); \
|
||||
gl->f##name(location, info.arraySize, false, \
|
||||
static_cast<WebGLfloat*>(JS_GetTypedArrayData(wa))); \
|
||||
static_cast<WebGLfloat*>(JS_GetArrayBufferViewData(wa, aCx))); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
@ -4291,15 +4319,15 @@ SIMPLE_METHOD_UNIFORM_2(Uniform2f, Uniform2f, WebGLfloat, WebGLfloat)
|
||||
SIMPLE_METHOD_UNIFORM_3(Uniform3f, Uniform3f, WebGLfloat, WebGLfloat, WebGLfloat)
|
||||
SIMPLE_METHOD_UNIFORM_4(Uniform4f, Uniform4f, WebGLfloat, WebGLfloat, WebGLfloat, WebGLfloat)
|
||||
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform1iv, 1, TYPE_INT32, WebGLint)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform2iv, 2, TYPE_INT32, WebGLint)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform3iv, 3, TYPE_INT32, WebGLint)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform4iv, 4, TYPE_INT32, WebGLint)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform1iv, 1, Int32, WebGLint)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform2iv, 2, Int32, WebGLint)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform3iv, 3, Int32, WebGLint)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform4iv, 4, Int32, WebGLint)
|
||||
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform1fv, 1, TYPE_FLOAT32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform2fv, 2, TYPE_FLOAT32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform3fv, 3, TYPE_FLOAT32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform4fv, 4, TYPE_FLOAT32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform1fv, 1, Float32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform2fv, 2, Float32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform3fv, 3, Float32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform4fv, 4, Float32, WebGLfloat)
|
||||
|
||||
SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix2fv, 2)
|
||||
SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix3fv, 3)
|
||||
@ -4394,7 +4422,7 @@ WebGLContext::VertexAttrib4f(PRUint32 index, WebGLfloat x0, WebGLfloat x1,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define SIMPLE_ARRAY_METHOD_NO_COUNT(name, cnt, arrayType, ptrType) \
|
||||
#define SIMPLE_ARRAY_METHOD_NO_COUNT(name, cnt, ptrType) \
|
||||
NS_IMETHODIMP \
|
||||
WebGLContext::name(WebGLuint idx, const JS::Value& aValue, JSContext* aCx) \
|
||||
{ \
|
||||
@ -4406,16 +4434,13 @@ WebGLContext::name(WebGLuint idx, const JS::Value& aValue, JSContext* aCx)
|
||||
if (!IsContextStable()) { \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (JS_GetTypedArrayType(wa) != js::TypedArray::arrayType) { \
|
||||
return ErrorInvalidOperation(#name ": array must be " #arrayType); \
|
||||
} \
|
||||
if (JS_GetTypedArrayLength(wa) < cnt) { \
|
||||
if (JS_GetTypedArrayLength(wa, aCx) < cnt) { \
|
||||
return ErrorInvalidOperation(#name ": array must be >= %d elements", \
|
||||
cnt); \
|
||||
} \
|
||||
\
|
||||
MakeContextCurrent(); \
|
||||
ptrType *ptr = static_cast<ptrType*>(JS_GetTypedArrayData(wa)); \
|
||||
ptrType *ptr = static_cast<ptrType*>(JS_GetFloat32ArrayData(wa, aCx)); \
|
||||
if (idx) { \
|
||||
gl->f##name(idx, ptr); \
|
||||
} else { \
|
||||
@ -4429,10 +4454,10 @@ WebGLContext::name(WebGLuint idx, const JS::Value& aValue, JSContext* aCx)
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib1fv, 1, TYPE_FLOAT32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib2fv, 2, TYPE_FLOAT32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib3fv, 3, TYPE_FLOAT32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib4fv, 4, TYPE_FLOAT32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib1fv, 1, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib2fv, 2, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib3fv, 3, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib4fv, 4, WebGLfloat)
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::UseProgram(nsIWebGLProgram *pobj)
|
||||
@ -4718,9 +4743,9 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::CompressedTexImage2D(WebGLenum target, WebGLint level, WebGLenum internalformat,
|
||||
WebGLsizei width, WebGLsizei height, WebGLint border,
|
||||
const JS::Value& pixels)
|
||||
const JS::Value& pixels, JSContext *cx)
|
||||
{
|
||||
if (!pixels.isObject() || !js_IsTypedArray(&pixels.toObject())) {
|
||||
if (!pixels.isObject() || !JS_IsTypedArrayObject(&pixels.toObject(), cx)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -4738,9 +4763,9 @@ WebGLContext::CompressedTexImage2D(WebGLenum target, WebGLint level, WebGLenum i
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::CompressedTexSubImage2D(WebGLenum target, WebGLint level, WebGLint xoffset,
|
||||
WebGLint yoffset, WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, const JS::Value& pixels)
|
||||
WebGLenum format, const JS::Value& pixels, JSContext *cx)
|
||||
{
|
||||
if (!pixels.isObject() || !js_IsTypedArray(&pixels.toObject())) {
|
||||
if (!pixels.isObject() || !JS_IsTypedArrayObject(&pixels.toObject(), cx)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -5210,30 +5235,35 @@ NS_IMETHODIMP
|
||||
WebGLContext::TexImage2D_array(WebGLenum target, WebGLint level, WebGLenum internalformat,
|
||||
WebGLsizei width, WebGLsizei height, WebGLint border,
|
||||
WebGLenum format, WebGLenum type,
|
||||
JSObject *pixels)
|
||||
JSObject *pixels, JSContext *cx)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
if (pixels && !JS_IsTypedArrayObject(pixels, cx))
|
||||
return ErrorInvalidValue("TexSubImage2D: pixels are wrong type!");
|
||||
|
||||
return TexImage2D_base(target, level, internalformat, width, height, 0, border, format, type,
|
||||
pixels ? JS_GetTypedArrayData(pixels) : 0,
|
||||
pixels ? JS_GetTypedArrayByteLength(pixels) : 0,
|
||||
pixels ? (int)JS_GetTypedArrayType(pixels) : -1,
|
||||
pixels ? JS_GetArrayBufferViewData(pixels, cx) : 0,
|
||||
pixels ? JS_GetArrayBufferViewByteLength(pixels, cx) : 0,
|
||||
pixels ? (int)JS_GetTypedArrayType(pixels, cx) : -1,
|
||||
WebGLTexelFormat::Auto, false);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::TexImage2D_imageData(WebGLenum target, WebGLint level, WebGLenum internalformat,
|
||||
WebGLsizei width, WebGLsizei height, WebGLint border,
|
||||
WebGLenum format, WebGLenum type,
|
||||
JSObject *pixels)
|
||||
WebGLsizei width, WebGLsizei height, WebGLint border,
|
||||
WebGLenum format, WebGLenum type,
|
||||
JSObject *pixels, JSContext *cx)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
NS_ABORT_IF_FALSE(JS_IsTypedArrayObject(pixels, cx), "bad pixels object");
|
||||
|
||||
return TexImage2D_base(target, level, internalformat, width, height, 4*width, border, format, type,
|
||||
pixels ? JS_GetTypedArrayData(pixels) : 0,
|
||||
pixels ? JS_GetTypedArrayByteLength(pixels) : 0,
|
||||
pixels ? JS_GetArrayBufferViewData(pixels, cx) : 0,
|
||||
pixels ? JS_GetArrayBufferViewByteLength(pixels, cx) : 0,
|
||||
-1,
|
||||
WebGLTexelFormat::RGBA8, false);
|
||||
}
|
||||
@ -5391,7 +5421,7 @@ WebGLContext::TexSubImage2D_array(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset,
|
||||
WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, WebGLenum type,
|
||||
JSObject *pixels)
|
||||
JSObject *pixels, JSContext *cx)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
@ -5399,10 +5429,12 @@ WebGLContext::TexSubImage2D_array(WebGLenum target, WebGLint level,
|
||||
if (!pixels)
|
||||
return ErrorInvalidValue("TexSubImage2D: pixels must not be null!");
|
||||
|
||||
NS_ABORT_IF_FALSE(JS_IsTypedArrayObject(pixels, cx), "bad pixels object");
|
||||
|
||||
return TexSubImage2D_base(target, level, xoffset, yoffset,
|
||||
width, height, 0, format, type,
|
||||
JS_GetTypedArrayData(pixels), JS_GetTypedArrayByteLength(pixels),
|
||||
JS_GetTypedArrayType(pixels),
|
||||
JS_GetArrayBufferViewData(pixels, cx), JS_GetArrayBufferViewByteLength(pixels, cx),
|
||||
JS_GetTypedArrayType(pixels, cx),
|
||||
WebGLTexelFormat::Auto, false);
|
||||
}
|
||||
|
||||
@ -5411,7 +5443,7 @@ WebGLContext::TexSubImage2D_imageData(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset,
|
||||
WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, WebGLenum type,
|
||||
JSObject *pixels)
|
||||
JSObject *pixels, JSContext *cx)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
@ -5419,9 +5451,11 @@ WebGLContext::TexSubImage2D_imageData(WebGLenum target, WebGLint level,
|
||||
if (!pixels)
|
||||
return ErrorInvalidValue("TexSubImage2D: pixels must not be null!");
|
||||
|
||||
NS_ABORT_IF_FALSE(JS_IsTypedArrayObject(pixels, cx), "bad pixels object");
|
||||
|
||||
return TexSubImage2D_base(target, level, xoffset, yoffset,
|
||||
width, height, 4*width, format, type,
|
||||
JS_GetTypedArrayData(pixels), JS_GetTypedArrayByteLength(pixels),
|
||||
JS_GetArrayBufferViewData(pixels, cx), JS_GetArrayBufferViewByteLength(pixels, cx),
|
||||
-1,
|
||||
WebGLTexelFormat::RGBA8, false);
|
||||
}
|
||||
@ -5459,7 +5493,6 @@ WebGLContext::LoseContext()
|
||||
if (!IsContextStable())
|
||||
return false;
|
||||
|
||||
mContextLostDueToTest = true;
|
||||
ForceLoseContext();
|
||||
|
||||
return true;
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#include "CheckedInt.h"
|
||||
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#if defined(USE_ANGLE)
|
||||
#include "angle/ShaderLang.h"
|
||||
@ -51,6 +51,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
/*
|
||||
@ -404,10 +406,10 @@ bool WebGLContext::ValidateTexFormatAndType(WebGLenum format, WebGLenum type, in
|
||||
(IsExtensionEnabled(WebGL_OES_texture_float) && type == LOCAL_GL_FLOAT))
|
||||
{
|
||||
if (jsArrayType != -1) {
|
||||
if ((type == LOCAL_GL_UNSIGNED_BYTE && jsArrayType != js::TypedArray::TYPE_UINT8) ||
|
||||
(type == LOCAL_GL_FLOAT && jsArrayType != js::TypedArray::TYPE_FLOAT32))
|
||||
if ((type == LOCAL_GL_UNSIGNED_BYTE && jsArrayType != js::ArrayBufferView::TYPE_UINT8) ||
|
||||
(type == LOCAL_GL_FLOAT && jsArrayType != js::ArrayBufferView::TYPE_FLOAT32))
|
||||
{
|
||||
ErrorInvalidOperation("%s: invalid typed array type for given format", info);
|
||||
ErrorInvalidOperation("%s: invalid typed array type for given texture data type", info);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -438,8 +440,8 @@ bool WebGLContext::ValidateTexFormatAndType(WebGLenum format, WebGLenum type, in
|
||||
switch (type) {
|
||||
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
|
||||
if (jsArrayType != -1 && jsArrayType != js::TypedArray::TYPE_UINT16) {
|
||||
ErrorInvalidOperation("%s: invalid typed array type for given format", info);
|
||||
if (jsArrayType != -1 && jsArrayType != js::ArrayBufferView::TYPE_UINT16) {
|
||||
ErrorInvalidOperation("%s: invalid typed array type for given texture data type", info);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -451,8 +453,8 @@ bool WebGLContext::ValidateTexFormatAndType(WebGLenum format, WebGLenum type, in
|
||||
return false;
|
||||
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
|
||||
if (jsArrayType != -1 && jsArrayType != js::TypedArray::TYPE_UINT16) {
|
||||
ErrorInvalidOperation("%s: invalid typed array type for given format", info);
|
||||
if (jsArrayType != -1 && jsArrayType != js::ArrayBufferView::TYPE_UINT16) {
|
||||
ErrorInvalidOperation("%s: invalid typed array type for given texture data type", info);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -679,5 +681,15 @@ WebGLContext::InitAndValidateGL()
|
||||
return false;
|
||||
}
|
||||
|
||||
mMemoryPressureObserver
|
||||
= new WebGLMemoryPressureObserver(this);
|
||||
nsCOMPtr<nsIObserverService> observerService
|
||||
= mozilla::services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->AddObserver(mMemoryPressureObserver,
|
||||
"memory-pressure",
|
||||
false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
@ -3935,13 +3935,12 @@ nsCanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
}
|
||||
|
||||
JSObject* darray =
|
||||
js_CreateTypedArray(aCx, js::TypedArray::TYPE_UINT8_CLAMPED, len.value());
|
||||
JSObject* darray = JS_NewUint8ClampedArray(aCx, len.value());
|
||||
if (!darray) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
uint8_t* data = static_cast<uint8_t*>(JS_GetTypedArrayData(darray));
|
||||
uint8_t* data = JS_GetUint8ClampedArrayData(darray, aCx);
|
||||
|
||||
/* Copy the surface contents to the buffer */
|
||||
nsRefPtr<gfxImageSurface> tmpsurf =
|
||||
|
@ -109,7 +109,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
@ -4103,8 +4103,7 @@ nsCanvasRenderingContext2DAzure::GetImageDataArray(JSContext* aCx,
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
}
|
||||
|
||||
JSObject* darray =
|
||||
js_CreateTypedArray(aCx, js::TypedArray::TYPE_UINT8_CLAMPED, len.value());
|
||||
JSObject* darray = JS_NewUint8ClampedArray(aCx, len.value());
|
||||
if (!darray) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -4114,7 +4113,7 @@ nsCanvasRenderingContext2DAzure::GetImageDataArray(JSContext* aCx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint8_t* data = static_cast<uint8_t*>(JS_GetTypedArrayData(darray));
|
||||
uint8_t* data = JS_GetUint8ClampedArrayData(darray, aCx);
|
||||
|
||||
IntRect srcRect(0, 0, mWidth, mHeight);
|
||||
IntRect destRect(aX, aY, aWidth, aHeight);
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "nsDOMNotifyAudioAvailableEvent.h"
|
||||
#include "nsDOMClassInfoID.h" // DOMCI_DATA, NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO
|
||||
#include "nsContentUtils.h" // NS_DROP_JS_OBJECTS
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
nsDOMNotifyAudioAvailableEvent::nsDOMNotifyAudioAvailableEvent(nsPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
@ -113,15 +113,12 @@ nsDOMNotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx, jsval* aResult)
|
||||
// Cache this array so we don't recreate on next call.
|
||||
NS_HOLD_JS_OBJECTS(this, nsDOMNotifyAudioAvailableEvent);
|
||||
|
||||
mCachedArray = js_CreateTypedArray(aCx, js::TypedArray::TYPE_FLOAT32, mFrameBufferLength);
|
||||
mCachedArray = JS_NewFloat32Array(aCx, mFrameBufferLength);
|
||||
if (!mCachedArray) {
|
||||
NS_DROP_JS_OBJECTS(this, nsDOMNotifyAudioAvailableEvent);
|
||||
NS_ERROR("Failed to get audio signal!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSObject *tdest = js::TypedArray::getTypedArray(mCachedArray);
|
||||
memcpy(JS_GetTypedArrayData(tdest), mFrameBuffer.get(), mFrameBufferLength * sizeof(float));
|
||||
memcpy(JS_GetFloat32ArrayData(mCachedArray, aCx), mFrameBuffer.get(), mFrameBufferLength * sizeof(float));
|
||||
|
||||
*aResult = OBJECT_TO_JSVAL(mCachedArray);
|
||||
return NS_OK;
|
||||
|
@ -57,7 +57,6 @@
|
||||
#include "nsIXPConnect.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
||||
#include "nsITimer.h"
|
||||
@ -184,36 +183,35 @@ nsHTMLAudioElement::MozSetup(PRUint32 aChannels, PRUint32 aRate)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAudioElement::MozWriteAudio(const jsval &aData, JSContext *aCx, PRUint32 *aRetVal)
|
||||
nsHTMLAudioElement::MozWriteAudio(const JS::Value& aData, JSContext* aCx, PRUint32* aRetVal)
|
||||
{
|
||||
if (!mAudioStream) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(aData)) {
|
||||
if (!aData.isObject()) {
|
||||
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
|
||||
}
|
||||
|
||||
JSObject *darray = JSVAL_TO_OBJECT(aData);
|
||||
JS::AutoValueRooter tsrc_tvr(aCx);
|
||||
JSObject *tsrc = NULL;
|
||||
JSObject* darray = &aData.toObject();
|
||||
JS::AutoObjectRooter tvr(aCx);
|
||||
JSObject* tsrc = NULL;
|
||||
|
||||
// Allow either Float32Array or plain JS Array
|
||||
if (js::GetObjectClass(darray) == &js::TypedArray::fastClasses[js::TypedArray::TYPE_FLOAT32])
|
||||
{
|
||||
tsrc = js::TypedArray::getTypedArray(darray);
|
||||
if (JS_IsFloat32Array(darray, aCx)) {
|
||||
tsrc = darray;
|
||||
} else if (JS_IsArrayObject(aCx, darray)) {
|
||||
JSObject *nobj = js_CreateTypedArrayWithArray(aCx, js::TypedArray::TYPE_FLOAT32, darray);
|
||||
JSObject* nobj = JS_NewFloat32ArrayFromArray(aCx, darray);
|
||||
if (!nobj) {
|
||||
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
|
||||
}
|
||||
*tsrc_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||
tsrc = js::TypedArray::getTypedArray(nobj);
|
||||
tsrc = nobj;
|
||||
} else {
|
||||
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
|
||||
}
|
||||
tvr.setObject(tsrc);
|
||||
|
||||
PRUint32 dataLength = JS_GetTypedArrayLength(tsrc);
|
||||
PRUint32 dataLength = JS_GetTypedArrayLength(tsrc, aCx);
|
||||
|
||||
// Make sure that we are going to write the correct amount of data based
|
||||
// on number of channels.
|
||||
@ -224,7 +222,7 @@ nsHTMLAudioElement::MozWriteAudio(const jsval &aData, JSContext *aCx, PRUint32 *
|
||||
// Don't write more than can be written without blocking.
|
||||
PRUint32 writeLen = NS_MIN(mAudioStream->Available(), dataLength / mChannels);
|
||||
|
||||
nsresult rv = mAudioStream->Write(JS_GetTypedArrayData(tsrc), writeLen);
|
||||
nsresult rv = mAudioStream->Write(JS_GetFloat32ArrayData(tsrc, aCx), writeLen);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ nsXULTemplateQueryProcessorXML::GetDatasource(nsIArray* aDataSources,
|
||||
rv = target->AddEventListener(NS_LITERAL_STRING("error"), this, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = req->Send(nsnull);
|
||||
rv = req->Send(nsnull, context->GetNativeContext());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mTemplateBuilder = aBuilder;
|
||||
|
@ -47,16 +47,14 @@ let DOMApplicationRegistry = {
|
||||
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
|
||||
let appsDir = FileUtils.getDir(DIRECTORY_NAME, ["webapps"], true, true);
|
||||
this.appsFile = FileUtils.getFile(DIRECTORY_NAME, ["webapps", "webapps.json"], true);
|
||||
|
||||
if (!this.appsFile.exists())
|
||||
return;
|
||||
|
||||
this._loadJSONAsync(this.appsFile, (function(aData) { this.webapps = aData; }).bind(this));
|
||||
if (this.appsFile.exists()) {
|
||||
this._loadJSONAsync(this.appsFile, (function(aData) { this.webapps = aData; }).bind(this));
|
||||
}
|
||||
|
||||
try {
|
||||
let hosts = Services.prefs.getCharPref("dom.mozApps.whitelist")
|
||||
let hosts = Services.prefs.getCharPref("dom.mozApps.whitelist");
|
||||
hosts.split(",").forEach(function(aHost) {
|
||||
Services.perms.add(Services.io.newURI(aHost, null, null), "webapps-manage",
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
|
@ -3622,7 +3622,7 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_SVG_TEXT_CONTENT_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(SVGUnknownElement, nsIDOMSVGElement)
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGUnknownElement, nsIDOMSVGElement)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
@ -6100,7 +6100,10 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(val));
|
||||
if (JSVAL_IS_PRIMITIVE(val)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JSObject *dot_prototype = JSVAL_TO_OBJECT(val);
|
||||
|
||||
JSObject *proto = JS_GetPrototype(dom_obj);
|
||||
|
@ -55,7 +55,7 @@ DOMInterfaces = {
|
||||
},
|
||||
'implicitJSContext': {
|
||||
'all': [
|
||||
'response', 'getInterface'
|
||||
'response', 'getInterface', 'send', 'sendAsBinary'
|
||||
],
|
||||
'setterOnly': [
|
||||
'onreadystatechange'
|
||||
|
@ -339,7 +339,7 @@ class CGHeaders(CGWrapper):
|
||||
for t in types:
|
||||
if t.unroll().isInterface():
|
||||
if t.unroll().isArrayBuffer():
|
||||
bindingHeaders.add("jstypedarray.h")
|
||||
bindingHeaders.add("jsfriendapi.h")
|
||||
else:
|
||||
typeDesc = d.getDescriptor(t.unroll().inner.identifier.name)
|
||||
if typeDesc is not None:
|
||||
@ -1213,7 +1213,7 @@ def getArgumentConversionTemplate(type, descriptor):
|
||||
if type.isArrayBuffer():
|
||||
template = (
|
||||
" JSObject* ${name};\n"
|
||||
" if (${argVal}.isObject() && JS_IsArrayBufferObject(&${argVal}.toObject())) {\n"
|
||||
" if (${argVal}.isObject() && JS_IsArrayBufferObject(&${argVal}.toObject(), cx)) {\n"
|
||||
" ${name} = &${argVal}.toObject();\n"
|
||||
" }")
|
||||
if type.nullable():
|
||||
@ -1928,7 +1928,7 @@ class CGMethodCall(CGThing):
|
||||
# other things.
|
||||
# XXXbz Do we need to worry about security
|
||||
# wrappers around the array buffer?
|
||||
pickFirstSignature("%s.isObject() && JS_IsArrayBufferObject(&%s.toObject())" %
|
||||
pickFirstSignature("%s.isObject() && JS_IsArrayBufferObject(&%s.toObject(), cx)" %
|
||||
(distinguishingArg, distinguishingArg),
|
||||
lambda s: (s[1][distinguishingIndex].type.isArrayBuffer() or
|
||||
s[1][distinguishingIndex].type.isObject()))
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "mozilla/dom/bindings/DOMJSClass.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#include "XPCQuickStubs.h"
|
||||
#include "XPCWrapper.h"
|
||||
@ -169,7 +169,7 @@ IsPlatformObject(JSContext* cx, JSObject* obj)
|
||||
clasp = js::GetObjectJSClass(obj);
|
||||
}
|
||||
return IS_WRAPPER_CLASS(js::Valueify(clasp)) || IsDOMClass(clasp) ||
|
||||
JS_IsArrayBufferObject(obj);
|
||||
JS_IsArrayBufferObject(obj, cx);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
@ -177,7 +177,7 @@ interface nsIWebGLExtensionTextureFilterAnisotropic : nsIWebGLExtension
|
||||
const WebGLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(dcba5412-42b4-4897-b2f4-56a5cae7ef2d)]
|
||||
[scriptable, builtinclass, uuid(ba7635d7-98af-41ac-8bf9-9f08cf441958)]
|
||||
interface nsIDOMWebGLRenderingContext : nsISupports
|
||||
{
|
||||
//
|
||||
@ -624,7 +624,7 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||
// Modified: void glBufferData(WebGLenum target, long size, const void* data, WebGLenum usage);
|
||||
[implicit_jscontext] void bufferData(in long target, in jsval data, in long usage);
|
||||
|
||||
void bufferSubData(in long target, in long offset, in jsval data);
|
||||
[implicit_jscontext] void bufferSubData(in long target, in long offset, in jsval data);
|
||||
|
||||
WebGLenum checkFramebufferStatus(in WebGLenum target);
|
||||
void clear(in WebGLbitfield mask);
|
||||
@ -634,11 +634,11 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||
void colorMask(in WebGLboolean red, in WebGLboolean green, in WebGLboolean blue, in WebGLboolean alpha);
|
||||
void compileShader([optional] in nsIWebGLShader shader);
|
||||
|
||||
void compressedTexImage2D(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
||||
[implicit_jscontext] void compressedTexImage2D(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
||||
in WebGLsizei width, in WebGLsizei height, in WebGLint border,
|
||||
in jsval pixels);
|
||||
|
||||
void compressedTexSubImage2D(in WebGLenum target, in WebGLint level, in WebGLint xoffset,
|
||||
[implicit_jscontext] void compressedTexSubImage2D(in WebGLenum target, in WebGLint level, in WebGLint xoffset,
|
||||
in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height,
|
||||
in WebGLenum format, in jsval pixels);
|
||||
|
||||
@ -749,7 +749,7 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||
void pixelStorei(in WebGLenum pname, in WebGLint param);
|
||||
void polygonOffset(in WebGLfloat factor, in WebGLfloat units);
|
||||
|
||||
void readPixels(in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height,
|
||||
[implicit_jscontext] void readPixels(in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height,
|
||||
in WebGLenum format, in WebGLenum type, in jsval pixels);
|
||||
|
||||
//void glReleaseShaderCompiler();
|
||||
@ -769,10 +769,10 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||
void stencilOpSeparate(in WebGLenum face, in WebGLenum fail, in WebGLenum zfail, in WebGLenum zpass);
|
||||
|
||||
void texImage2D([optional] in long dummy);
|
||||
[noscript] void texImage2D_array(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
||||
[noscript,implicit_jscontext] void texImage2D_array(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
||||
in WebGLsizei width, in WebGLsizei height,
|
||||
in WebGLint border, in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
||||
[noscript] void texImage2D_imageData(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
||||
[noscript,implicit_jscontext] void texImage2D_imageData(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
||||
in WebGLsizei width, in WebGLsizei height,
|
||||
in WebGLint border, in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
||||
|
||||
@ -781,10 +781,10 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||
in WebGLenum format, in WebGLenum type, in Element element);
|
||||
|
||||
void texSubImage2D([optional] in long dummy);
|
||||
[noscript] void texSubImage2D_array(in WebGLenum target, in WebGLint level,
|
||||
[noscript,implicit_jscontext] void texSubImage2D_array(in WebGLenum target, in WebGLint level,
|
||||
in WebGLint xoffset, in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height,
|
||||
in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
||||
[noscript] void texSubImage2D_imageData(in WebGLenum target, in WebGLint level,
|
||||
[noscript,implicit_jscontext] void texSubImage2D_imageData(in WebGLenum target, in WebGLint level,
|
||||
in WebGLint xoffset, in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height,
|
||||
in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
||||
// HTMLImageElement, HTMLCanvasElement, HTMLVideoElement
|
||||
|
@ -43,11 +43,13 @@
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
#include "nsPluginInstanceOwner.h"
|
||||
#include "nsWindow.h"
|
||||
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
|
||||
#define ASSIGN(obj, name) (obj)->name = anp_window_##name
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::widget;
|
||||
|
||||
void
|
||||
anp_window_setVisibleRects(NPP instance, const ANPRectI rects[], int32_t count)
|
||||
@ -64,7 +66,22 @@ anp_window_clearVisibleRects(NPP instance)
|
||||
void
|
||||
anp_window_showKeyboard(NPP instance, bool value)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
InputContext context;
|
||||
context.mIMEState.mEnabled = IMEState::PLUGIN;
|
||||
context.mIMEState.mOpen = value ? IMEState::OPEN : IMEState::CLOSED;
|
||||
context.mActionHint.Assign(EmptyString());
|
||||
|
||||
InputContextAction action;
|
||||
action.mCause = InputContextAction::CAUSE_UNKNOWN;
|
||||
action.mFocusChange = InputContextAction::FOCUS_NOT_CHANGED;
|
||||
|
||||
nsWindow* window = nsWindow::TopWindow();
|
||||
if (!window) {
|
||||
LOG("Couldn't get top window?");
|
||||
return;
|
||||
}
|
||||
|
||||
window->SetInputContext(context, action);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -72,6 +72,7 @@ CPPSRCS += ANPAudio.cpp \
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/widget/android \
|
||||
-I$(topsrcdir)/widget/xpwidgets \
|
||||
-I$(topsrcdir)/dom/plugins/base \
|
||||
-I$(topsrcdir)/dom/plugins/base/android/include \
|
||||
-I$(topsrcdir)/gfx/gl \
|
||||
|
@ -120,7 +120,6 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gfxXlibNativeRenderer.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
@ -3041,8 +3040,7 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
||||
Visual* visual = gdk_x11_visual_get_xvisual(gdkVisual);
|
||||
Screen* screen =
|
||||
gdk_x11_screen_get_xscreen(gdk_visual_get_screen(gdkVisual));
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#else
|
||||
Display* dpy = mozilla::DefaultXDisplay();
|
||||
Screen* screen = DefaultScreenOfDisplay(dpy);
|
||||
Visual* visual = DefaultVisualOfScreen(screen);
|
||||
|
@ -76,15 +76,10 @@ class nsDisplayListBuilder;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
class gfxXlibSurface;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#include "gfxXlibNativeRenderer.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#ifdef MOZ_X11
|
||||
#include "gfxQtNativeRenderer.h"
|
||||
#else
|
||||
#include "gfxXlibNativeRenderer.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -410,10 +405,10 @@ private:
|
||||
|
||||
#ifdef MOZ_X11
|
||||
class Renderer
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
: public gfxXlibNativeRenderer
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#if defined(MOZ_WIDGET_QT)
|
||||
: public gfxQtNativeRenderer
|
||||
#else
|
||||
: public gfxXlibNativeRenderer
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include "nsIWorkerHolder.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "mozilla/dom/workers/Workers.h"
|
||||
#include "mozilla/ipc/Ril.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -100,21 +100,21 @@ PostToRIL(JSContext *cx, unsigned argc, jsval *vp)
|
||||
data = abs.ptr();
|
||||
} else if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
JSObject *obj = JSVAL_TO_OBJECT(v);
|
||||
if (!js_IsTypedArray(obj)) {
|
||||
if (!JS_IsTypedArrayObject(obj, cx)) {
|
||||
JS_ReportError(cx, "Object passed in wasn't a typed array");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t type = JS_GetTypedArrayType(obj);
|
||||
if (type != js::TypedArray::TYPE_INT8 &&
|
||||
type != js::TypedArray::TYPE_UINT8 &&
|
||||
type != js::TypedArray::TYPE_UINT8_CLAMPED) {
|
||||
uint32_t type = JS_GetTypedArrayType(obj, cx);
|
||||
if (type != js::ArrayBufferView::TYPE_INT8 &&
|
||||
type != js::ArrayBufferView::TYPE_UINT8 &&
|
||||
type != js::ArrayBufferView::TYPE_UINT8_CLAMPED) {
|
||||
JS_ReportError(cx, "Typed array data is not octets");
|
||||
return false;
|
||||
}
|
||||
|
||||
size = JS_GetTypedArrayByteLength(obj);
|
||||
data = JS_GetTypedArrayData(obj);
|
||||
size = JS_GetTypedArrayByteLength(obj, cx);
|
||||
data = JS_GetArrayBufferViewData(obj, cx);
|
||||
} else {
|
||||
JS_ReportError(cx,
|
||||
"Incorrect argument. Expecting a string or a typed array");
|
||||
@ -181,13 +181,12 @@ RILReceiver::DispatchRILEvent::RunTask(JSContext *aCx)
|
||||
{
|
||||
JSObject *obj = JS_GetGlobalObject(aCx);
|
||||
|
||||
JSObject *array =
|
||||
js_CreateTypedArray(aCx, js::TypedArray::TYPE_UINT8, mMessage->mSize);
|
||||
JSObject *array = JS_NewUint8Array(aCx, mMessage->mSize);
|
||||
if (!array) {
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(JS_GetTypedArrayData(array), mMessage->mData, mMessage->mSize);
|
||||
memcpy(JS_GetArrayBufferViewData(array, aCx), mMessage->mData, mMessage->mSize);
|
||||
jsval argv[] = { OBJECT_TO_JSVAL(array) };
|
||||
return JS_CallFunctionName(aCx, obj, "onRILMessage", NS_ARRAY_LENGTH(argv),
|
||||
argv, argv);
|
||||
|
@ -156,6 +156,7 @@ _TEST_FILES = \
|
||||
test_onerror_message.html \
|
||||
test_bug735237.html \
|
||||
test_bug739038.html \
|
||||
test_bug740811.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
27
dom/tests/mochitest/bugs/test_bug740811.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=740811
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 740811</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=740811">Mozilla Bug 740811</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 740811 **/
|
||||
is(Object.getPrototypeOf(SVGElement.prototype), Element.prototype,
|
||||
"Bogus proto for SVGElement");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -44,7 +44,6 @@
|
||||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
||||
#include "Exceptions.h"
|
||||
@ -58,7 +57,6 @@
|
||||
USING_WORKERS_NAMESPACE
|
||||
|
||||
using mozilla::dom::workers::exceptions::ThrowFileExceptionForCode;
|
||||
using js::ArrayBuffer;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -194,13 +192,13 @@ private:
|
||||
return false;
|
||||
}
|
||||
|
||||
JSObject* jsArrayBuffer = js_CreateArrayBuffer(aCx, blobSize);
|
||||
JSObject* jsArrayBuffer = JS_NewArrayBuffer(aCx, blobSize);
|
||||
if (!jsArrayBuffer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t bufferLength = JS_GetArrayBufferByteLength(jsArrayBuffer);
|
||||
uint8_t* arrayBuffer = JS_GetArrayBufferData(jsArrayBuffer);
|
||||
uint32_t bufferLength = JS_GetArrayBufferByteLength(jsArrayBuffer, aCx);
|
||||
uint8_t* arrayBuffer = JS_GetArrayBufferData(jsArrayBuffer, aCx);
|
||||
|
||||
rv = fileReader->ReadAsArrayBuffer(blob, bufferLength, arrayBuffer);
|
||||
if (!EnsureSucceededOrThrow(aCx, rv)) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "nsIXMLHttpRequest.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
||||
#include "jstypedarray.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
@ -1158,12 +1158,12 @@ public:
|
||||
MainThreadRun()
|
||||
{
|
||||
nsCOMPtr<nsIVariant> variant;
|
||||
RuntimeService::AutoSafeJSContext cx;
|
||||
|
||||
if (mBody.data()) {
|
||||
nsIXPConnect* xpc = nsContentUtils::XPConnect();
|
||||
NS_ASSERTION(xpc, "This should never be null!");
|
||||
|
||||
RuntimeService::AutoSafeJSContext cx;
|
||||
|
||||
int error = 0;
|
||||
|
||||
JSStructuredCloneCallbacks* callbacks =
|
||||
@ -1216,7 +1216,7 @@ public:
|
||||
|
||||
mProxy->mInnerChannelId++;
|
||||
|
||||
nsresult rv = mProxy->mXHR->Send(variant);
|
||||
nsresult rv = mProxy->mXHR->Send(variant, cx);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mProxy->mOutstandingSendCount++;
|
||||
@ -1987,7 +1987,7 @@ XMLHttpRequest::Send(JSObject* aBody, nsresult& aRv)
|
||||
JSContext* cx = GetJSContext();
|
||||
|
||||
jsval valToClone;
|
||||
if (js_IsArrayBuffer(aBody) || file::GetDOMBlobFromJSObject(aBody)) {
|
||||
if (JS_IsArrayBufferObject(aBody, cx) || file::GetDOMBlobFromJSObject(aBody)) {
|
||||
valToClone = OBJECT_TO_JSVAL(aBody);
|
||||
}
|
||||
else {
|
||||
|
@ -7683,7 +7683,17 @@ nsHTMLEditRules::CheckInterlinePosition(nsISelection *aSelection)
|
||||
PRInt32 selOffset;
|
||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
||||
// First, let's check to see if we are after a <br>. We take care of this
|
||||
// special-case first so that we don't accidentally fall through into one
|
||||
// of the other conditionals.
|
||||
mHTMLEditor->GetPriorHTMLNode(selNode, selOffset, address_of(node), true);
|
||||
if (node && nsTextEditUtils::IsBreak(node))
|
||||
{
|
||||
selPriv->SetInterlinePosition(true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// are we after a block? If so try set caret to following content
|
||||
mHTMLEditor->GetPriorHTMLSibling(selNode, selOffset, address_of(node));
|
||||
if (node && IsBlockNode(node))
|
||||
@ -7695,15 +7705,7 @@ nsHTMLEditRules::CheckInterlinePosition(nsISelection *aSelection)
|
||||
// are we before a block? If so try set caret to prior content
|
||||
mHTMLEditor->GetNextHTMLSibling(selNode, selOffset, address_of(node));
|
||||
if (node && IsBlockNode(node))
|
||||
{
|
||||
selPriv->SetInterlinePosition(false);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// are we after a <br>? If so we want to stick to whatever is after <br>.
|
||||
mHTMLEditor->GetPriorHTMLNode(selNode, selOffset, address_of(node), true);
|
||||
if (node && nsTextEditUtils::IsBreak(node))
|
||||
selPriv->SetInterlinePosition(true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,9 @@
|
||||
|
||||
#include "graphite2/Types.h"
|
||||
|
||||
#define GR2_VERSION_MAJOR 2
|
||||
#define GR2_VERSION_MINOR 0
|
||||
#define GR2_VERSION_BUGFIX 1
|
||||
#define GR2_VERSION_MAJOR 1
|
||||
#define GR2_VERSION_MINOR 1
|
||||
#define GR2_VERSION_BUGFIX 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
@ -94,7 +94,7 @@ enum gr_attrCode {
|
||||
/// bidi directionality of this glyph (not implemented)
|
||||
gr_slatDir,
|
||||
/// Whether insertion is allowed before this glyph
|
||||
gr_slatInsert,
|
||||
gr_slatInsert,
|
||||
/// Final positioned position of this glyph relative to its parent in x-direction in pixels
|
||||
gr_slatPosX,
|
||||
/// Final positioned position of this glyph relative to its parent in y-direction in pixels
|
||||
@ -119,8 +119,10 @@ enum gr_attrCode {
|
||||
gr_slatJWeight,
|
||||
/// Amount this slot mush shrink or stretch in design units
|
||||
gr_slatJWidth,
|
||||
/// SubSegment split point
|
||||
gr_slatSegSplit = gr_slatJStretch + 29,
|
||||
/// User defined attribute, see subattr for user attr number
|
||||
gr_slatUserDefn = gr_slatJStretch + 30,
|
||||
gr_slatUserDefn,
|
||||
|
||||
/// not implemented
|
||||
gr_slatMax,
|
||||
|
@ -300,8 +300,8 @@ const bidi_action actionWeak[][10] =
|
||||
inline uint8 GetDeferredType(bidi_action a) { return (a >> 4) & 0xF; }
|
||||
inline uint8 GetResolvedType(bidi_action a) { return a & 0xF; }
|
||||
inline DirCode EmbeddingDirection(int l) { return l & 1 ? R : L; }
|
||||
inline bool IsDeferredState(bidi_state a) { return (1 << a) & (rtmask | ltmask | acmask | rcmask | rsmask | lcmask | lsmask); }
|
||||
inline bool IsModifiedClass(DirCode a) { return (1 << a) & (ALmask | NSMmask | ESmask | CSmask | ETmask | ENmask); }
|
||||
inline bool IsDeferredState(bidi_state a) { return 0 != ((1 << a) & (rtmask | ltmask | acmask | rcmask | rsmask | lcmask | lsmask)); }
|
||||
inline bool IsModifiedClass(DirCode a) { return 0 != ((1 << a) & (ALmask | NSMmask | ESmask | CSmask | ETmask | ENmask)); }
|
||||
|
||||
void SetDeferredRunClass(Slot *s, Slot *sRun, int nval)
|
||||
{
|
||||
|