This commit is contained in:
Ms2ger 2014-02-09 10:31:55 +01:00
Родитель 2396fc741f 0a41736938
Коммит 2e89bf81de
28 изменённых файлов: 2551 добавлений и 290 удалений

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

@ -1126,6 +1126,12 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
return FireAtkShowHideEvent(aEvent, atkObj, true);
case nsIAccessibleEvent::EVENT_HIDE:
// XXX - Handle native dialog accessibles.
if (!accessible->IsRoot() && accessible->HasARIARole() &&
accessible->ARIARole() == roles::DIALOG) {
guint id = g_signal_lookup("deactivate", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
}
return FireAtkShowHideEvent(aEvent, atkObj, false);
/*
@ -1141,7 +1147,7 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
case nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE:
{
accessible->AsRoot()->mActivated = true;
guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
guint id = g_signal_lookup("activate", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
// Always fire a current focus event after activation.
@ -1151,30 +1157,36 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
{
accessible->AsRoot()->mActivated = false;
guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
guint id = g_signal_lookup("deactivate", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
} break;
case nsIAccessibleEvent::EVENT_WINDOW_MAXIMIZE:
{
guint id = g_signal_lookup ("maximize", MAI_TYPE_ATK_OBJECT);
guint id = g_signal_lookup("maximize", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
} break;
case nsIAccessibleEvent::EVENT_WINDOW_MINIMIZE:
{
guint id = g_signal_lookup ("minimize", MAI_TYPE_ATK_OBJECT);
guint id = g_signal_lookup("minimize", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
} break;
case nsIAccessibleEvent::EVENT_WINDOW_RESTORE:
{
guint id = g_signal_lookup ("restore", MAI_TYPE_ATK_OBJECT);
guint id = g_signal_lookup("restore", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
} break;
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
g_signal_emit_by_name (atkObj, "load_complete");
// XXX - Handle native dialog accessibles.
if (!accessible->IsRoot() && accessible->HasARIARole() &&
accessible->ARIARole() == roles::DIALOG) {
guint id = g_signal_lookup("activate", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
}
break;
case nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD:

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

@ -152,9 +152,7 @@ var FeedHandler = {
}
},
addFeed: function(link, targetDoc) {
// find which tab this is for, and set the attribute on the browser
var browserForLink = gBrowser.getBrowserForDocument(targetDoc);
addFeed: function(link, browserForLink) {
if (!browserForLink) {
// ignore feeds loaded in subframes (see bug 305472)
return;

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

@ -802,7 +802,7 @@ var gBrowserInit = {
gBrowser.addTabsProgressListener(window.TabsProgressListener);
// setup our common DOMLinkAdded listener
gBrowser.addEventListener("DOMLinkAdded", DOMLinkHandler, false);
DOMLinkHandler.init();
// setup simple gestures support
gGestureSupport.init(true);
@ -2764,135 +2764,56 @@ var newWindowButtonObserver = {
}
const DOMLinkHandler = {
handleEvent: function (event) {
switch (event.type) {
case "DOMLinkAdded":
this.onLinkAdded(event);
init: function() {
let mm = window.messageManager;
mm.addMessageListener("Link:AddFeed", this);
mm.addMessageListener("Link:AddIcon", this);
mm.addMessageListener("Link:AddSearch", this);
},
receiveMessage: function (aMsg) {
switch (aMsg.name) {
case "Link:AddFeed":
let link = {type: aMsg.data.type, href: aMsg.data.href, title: aMsg.data.title};
FeedHandler.addFeed(link, aMsg.target);
break;
case "Link:AddIcon":
return this.addIcon(aMsg.target, aMsg.data.url);
break;
case "Link:AddSearch":
this.addSearch(aMsg.target, aMsg.data.engine, aMsg.data.url);
break;
}
},
getLinkIconURI: function(aLink) {
let targetDoc = aLink.ownerDocument;
var uri = makeURI(aLink.href, targetDoc.characterSet);
// Verify that the load of this icon is legal.
// Some error or special pages can load their favicon.
// To be on the safe side, only allow chrome:// favicons.
var isAllowedPage = [
/^about:neterror\?/,
/^about:blocked\?/,
/^about:certerror\?/,
/^about:home$/,
].some(function (re) re.test(targetDoc.documentURI));
addIcon: function(aBrowser, aURL) {
if (gBrowser.isFailedIcon(aURL))
return false;
if (!isAllowedPage || !uri.schemeIs("chrome")) {
var ssm = Services.scriptSecurityManager;
try {
ssm.checkLoadURIWithPrincipal(targetDoc.nodePrincipal, uri,
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
} catch(e) {
return null;
}
}
let tab = gBrowser._getTabForBrowser(aBrowser);
if (!tab)
return false;
try {
var contentPolicy = Cc["@mozilla.org/layout/content-policy;1"].
getService(Ci.nsIContentPolicy);
} catch(e) {
return null; // Refuse to load if we can't do a security check.
}
// Security says okay, now ask content policy
if (contentPolicy.shouldLoad(Ci.nsIContentPolicy.TYPE_IMAGE,
uri, targetDoc.documentURIObject,
aLink, aLink.type, null)
!= Ci.nsIContentPolicy.ACCEPT)
return null;
try {
uri.userPass = "";
} catch(e) {
// some URIs are immutable
}
return uri;
gBrowser.setIcon(tab, aURL);
return true;
},
onLinkAdded: function (event) {
var link = event.originalTarget;
var rel = link.rel && link.rel.toLowerCase();
if (!link || !link.ownerDocument || !rel || !link.href)
return;
var feedAdded = false;
var iconAdded = false;
var searchAdded = false;
var rels = {};
for (let relString of rel.split(/\s+/))
rels[relString] = true;
addSearch: function(aBrowser, aEngine, aURL) {
let tab = gBrowser._getTabForBrowser(aBrowser);
if (!tab)
return false;
for (let relVal in rels) {
switch (relVal) {
case "feed":
case "alternate":
if (!feedAdded) {
if (!rels.feed && rels.alternate && rels.stylesheet)
break;
if (isValidFeed(link, link.ownerDocument.nodePrincipal, "feed" in rels)) {
FeedHandler.addFeed(link, link.ownerDocument);
feedAdded = true;
}
}
break;
case "icon":
if (!iconAdded) {
if (!gPrefService.getBoolPref("browser.chrome.site_icons"))
break;
var uri = this.getLinkIconURI(link);
if (!uri)
break;
if (gBrowser.isFailedIcon(uri))
break;
var browserIndex = gBrowser.getBrowserIndexForDocument(link.ownerDocument);
// no browser? no favicon.
if (browserIndex == -1)
break;
let tab = gBrowser.tabs[browserIndex];
gBrowser.setIcon(tab, uri.spec);
iconAdded = true;
}
break;
case "search":
if (!searchAdded) {
var type = link.type && link.type.toLowerCase();
type = type.replace(/^\s+|\s*(?:;.*)?$/g, "");
if (type == "application/opensearchdescription+xml" && link.title &&
/^(?:https?|ftp):/i.test(link.href)) {
var engine = { title: link.title, href: link.href };
BrowserSearch.addEngine(engine, link.ownerDocument);
searchAdded = true;
}
}
break;
}
}
}
BrowserSearch.addEngine(aBrowser, aEngine, makeURI(aURL));
},
}
const BrowserSearch = {
addEngine: function(engine, targetDoc) {
addEngine: function(browser, engine, uri) {
if (!this.searchBar)
return;
var browser = gBrowser.getBrowserForDocument(targetDoc);
// ignore search engines from subframes (see bug 479408)
if (!browser)
return;
// Check to see whether we've already added an engine with this title
if (browser.engines) {
if (browser.engines.some(function (e) e.title == engine.title))
@ -2903,8 +2824,8 @@ const BrowserSearch = {
// Use documentURIObject in the check for shouldLoadFavIcon so that we
// do the right thing with about:-style error pages. Bug 453442
var iconURL = null;
if (gBrowser.shouldLoadFavIcon(targetDoc.documentURIObject))
iconURL = targetDoc.documentURIObject.prePath + "/favicon.ico";
if (gBrowser.shouldLoadFavIcon(uri))
iconURL = uri.prePath + "/favicon.ico";
var hidden = false;
// If this engine (identified by title) is already in the list, add it

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

@ -9,10 +9,12 @@ let Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this,
"LoginManagerContent", "resource://gre/modules/LoginManagerContent.jsm");
XPCOMUtils.defineLazyModuleGetter(this,
"InsecurePasswordUtils", "resource://gre/modules/InsecurePasswordUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ContentLinkHandler",
"resource:///modules/ContentLinkHandler.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerContent",
"resource://gre/modules/LoginManagerContent.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "InsecurePasswordUtils",
"resource://gre/modules/InsecurePasswordUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UITour",
@ -283,6 +285,8 @@ let ClickEventHandler = {
};
ClickEventHandler.init();
ContentLinkHandler.init(this);
addEventListener("DOMWebNotificationClicked", function(event) {
sendAsyncMessage("DOMWebNotificationClicked", {});
}, false);

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

@ -3,6 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
XPCOMUtils.defineLazyModuleGetter(this, "Feeds",
"resource:///modules/Feeds.jsm");
function initFeedTab()
{
const feedTypes = {
@ -29,7 +32,7 @@ function initFeedTab()
}
if (rels.feed || (link.type && rels.alternate && !rels.stylesheet)) {
var type = isValidFeed(link, gDocument.nodePrincipal, "feed" in rels);
var type = Feeds.isValidFeed(link, gDocument.nodePrincipal, "feed" in rels);
if (type) {
type = feedTypes[type] || feedTypes["application/rss+xml"];
addRow(link.title, type, link.href);

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

@ -237,7 +237,8 @@
if (link.rel.indexOf("icon") < 0)
return;
let uri = DOMLinkHandler.getLinkIconURI(link);
let ContentLinkHandler = Cu.import("resource:///modules/ContentLinkHandler.jsm", {}).ContentLinkHandler;
let uri = ContentLinkHandler.getLinkIconURI(link);
if (!uri)
return;

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

@ -307,7 +307,8 @@
if (link.rel.indexOf("icon") < 0)
return;
let uri = DOMLinkHandler.getLinkIconURI(link);
let ContentLinkHandler = Cu.import("resource:///modules/ContentLinkHandler.jsm", {}).ContentLinkHandler;
let uri = ContentLinkHandler.getLinkIconURI(link);
if (!uri)
return;

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

@ -1,3 +1,6 @@
XPCOMUtils.defineLazyModuleGetter(this, "Feeds",
"resource:///modules/Feeds.jsm");
function test() {
var exampleUri = makeURI("http://example.com/");
var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
@ -5,7 +8,7 @@ function test() {
function testIsFeed(aTitle, aHref, aType, aKnown) {
var link = { title: aTitle, href: aHref, type: aType };
return isValidFeed(link, principal, aKnown);
return Feeds.isValidFeed(link, principal, aKnown);
}
var href = "http://example.com/feed/";

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

@ -649,41 +649,6 @@ function openNewWindowWith(aURL, aDocument, aPostData, aAllowThirdPartyFixup, aR
referrerURI: aDocument ? aDocument.documentURIObject : aReferrer });
}
/**
* isValidFeed: checks whether the given data represents a valid feed.
*
* @param aLink
* An object representing a feed with title, href and type.
* @param aPrincipal
* The principal of the document, used for security check.
* @param aIsFeed
* Whether this is already a known feed or not, if true only a security
* check will be performed.
*/
function isValidFeed(aLink, aPrincipal, aIsFeed)
{
if (!aLink || !aPrincipal)
return false;
var type = aLink.type.toLowerCase().replace(/^\s+|\s*(?:;.*)?$/g, "");
if (!aIsFeed) {
aIsFeed = (type == "application/rss+xml" ||
type == "application/atom+xml");
}
if (aIsFeed) {
try {
urlSecurityCheck(aLink.href, aPrincipal,
Components.interfaces.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
return type || "application/rss+xml";
}
catch(ex) {
}
}
return null;
}
// aCalledFromModal is optional
function openHelpLink(aHelpTopic, aCalledFromModal, aWhere) {
var url = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]

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

@ -0,0 +1,136 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
let Cc = Components.classes;
let Ci = Components.interfaces;
let Cu = Components.utils;
this.EXPORTED_SYMBOLS = [ "ContentLinkHandler" ];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Feeds",
"resource:///modules/Feeds.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
this.ContentLinkHandler = {
init: function(chromeGlobal) {
chromeGlobal.addEventListener("DOMLinkAdded", (event) => {
this.onLinkAdded(event, chromeGlobal);
}, false);
},
onLinkAdded: function(event, chromeGlobal) {
var link = event.originalTarget;
var rel = link.rel && link.rel.toLowerCase();
if (!link || !link.ownerDocument || !rel || !link.href)
return;
var feedAdded = false;
var iconAdded = false;
var searchAdded = false;
var rels = {};
for (let relString of rel.split(/\s+/))
rels[relString] = true;
for (let relVal in rels) {
switch (relVal) {
case "feed":
case "alternate":
if (!feedAdded) {
if (!rels.feed && rels.alternate && rels.stylesheet)
break;
if (Feeds.isValidFeed(link, link.ownerDocument.nodePrincipal, "feed" in rels)) {
chromeGlobal.sendAsyncMessage("Link:AddFeed",
{type: link.type,
href: link.href,
title: link.title});
feedAdded = true;
}
}
break;
case "icon":
if (!iconAdded) {
if (!Services.prefs.getBoolPref("browser.chrome.site_icons"))
break;
var uri = this.getLinkIconURI(link);
if (!uri)
break;
[iconAdded] = chromeGlobal.sendSyncMessage("Link:AddIcon", {url: uri.spec});
}
break;
case "search":
if (!searchAdded) {
var type = link.type && link.type.toLowerCase();
type = type.replace(/^\s+|\s*(?:;.*)?$/g, "");
let re = /^(?:https?|ftp):/i;
if (type == "application/opensearchdescription+xml" && link.title &&
re.test(link.href))
{
let engine = { title: link.title, href: link.href };
chromeGlobal.sendAsyncMessage("Link:AddSearch",
{engine: engine,
url: link.ownerDocument.documentURI});
searchAdded = true;
}
}
break;
}
}
},
getLinkIconURI: function(aLink) {
let targetDoc = aLink.ownerDocument;
var uri = BrowserUtils.makeURI(aLink.href, targetDoc.characterSet);
// Verify that the load of this icon is legal.
// Some error or special pages can load their favicon.
// To be on the safe side, only allow chrome:// favicons.
var isAllowedPage = [
/^about:neterror\?/,
/^about:blocked\?/,
/^about:certerror\?/,
/^about:home$/,
].some(function (re) re.test(targetDoc.documentURI));
if (!isAllowedPage || !uri.schemeIs("chrome")) {
var ssm = Services.scriptSecurityManager;
try {
ssm.checkLoadURIWithPrincipal(targetDoc.nodePrincipal, uri,
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
} catch(e) {
return null;
}
}
try {
var contentPolicy = Cc["@mozilla.org/layout/content-policy;1"].
getService(Ci.nsIContentPolicy);
} catch(e) {
return null; // Refuse to load if we can't do a security check.
}
// Security says okay, now ask content policy
if (contentPolicy.shouldLoad(Ci.nsIContentPolicy.TYPE_IMAGE,
uri, targetDoc.documentURIObject,
aLink, aLink.type, null)
!= Ci.nsIContentPolicy.ACCEPT)
return null;
try {
uri.userPass = "";
} catch(e) {
// some URIs are immutable
}
return uri;
},
};

52
browser/modules/Feeds.jsm Normal file
Просмотреть файл

@ -0,0 +1,52 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
this.EXPORTED_SYMBOLS = [ "Feeds" ];
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
const Ci = Components.interfaces;
this.Feeds = {
/**
* isValidFeed: checks whether the given data represents a valid feed.
*
* @param aLink
* An object representing a feed with title, href and type.
* @param aPrincipal
* The principal of the document, used for security check.
* @param aIsFeed
* Whether this is already a known feed or not, if true only a security
* check will be performed.
*/
isValidFeed: function(aLink, aPrincipal, aIsFeed) {
if (!aLink || !aPrincipal)
return false;
var type = aLink.type.toLowerCase().replace(/^\s+|\s*(?:;.*)?$/g, "");
if (!aIsFeed) {
aIsFeed = (type == "application/rss+xml" ||
type == "application/atom+xml");
}
if (aIsFeed) {
try {
BrowserUtils.urlSecurityCheck(aLink.href, aPrincipal,
Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
return type || "application/rss+xml";
}
catch(ex) {
}
}
return null;
},
};

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

@ -10,6 +10,8 @@ EXTRA_JS_MODULES += [
'BrowserNewTabPreloader.jsm',
'BrowserUITelemetry.jsm',
'ContentClick.jsm',
'ContentLinkHandler.jsm',
'Feeds.jsm',
'NetworkPrioritizer.jsm',
'offlineAppCache.jsm',
'SharedFrame.jsm',

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

@ -1780,8 +1780,21 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI)
temp.swap(parentAsItem);
temp->GetSameTypeParent(getter_AddRefs(parentAsItem));
}
// Bug 136580: Check for recursive frame loading
// Bug 136580: Check for recursive frame loading excluding about:srcdoc URIs.
// srcdoc URIs require their contents to be specified inline, so it isn't
// possible for undesirable recursion to occur without the aid of a
// non-srcdoc URI, which this method will block normally.
// Besides, URI is not enough to guarantee uniqueness of srcdoc documents.
nsAutoCString buffer;
rv = aURI->GetScheme(buffer);
if (NS_SUCCEEDED(rv) && buffer.EqualsLiteral("about")) {
rv = aURI->GetPath(buffer);
if (NS_SUCCEEDED(rv) && buffer.EqualsLiteral("srcdoc")) {
// Duplicates allowed up to depth limits
return NS_OK;
}
}
int32_t matchCount = 0;
mDocShell->GetSameTypeParent(getter_AddRefs(parentAsItem));
while (parentAsItem) {

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

@ -378,6 +378,7 @@ support-files =
[test_bug879319.html]
[test_bug885024.html]
[test_bug893537.html]
[test_bug969346.html]
[test_change_crossorigin.html]
[test_checked.html]
[test_dir_attributes_reflection.html]

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

@ -0,0 +1,33 @@
<!doctype html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=969346
-->
<head>
<title>Nesting of srcdoc iframes is permitted</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=969349">Mozilla Bug 969346</a>
<iframe id="pframe" srcdoc="<iframe id='iframe' srcdoc='I am nested'></iframe"></iframe>
<pre id="test">
<script>
SimpleTest.waitForExplicitFinish();
addLoadEvent(function () {
var pframe = $("pframe");
var pframeDoc = pframe.contentDocument;
var iframe = pframeDoc.getElementById("iframe");
var innerDoc = iframe.contentDocument;
is(innerDoc.body.innerHTML, "I am nested", "Nesting not working?");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>

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

@ -278,7 +278,7 @@ public:
byteOffset += mBytesPerSample;
}
}
mNextSample = maxSamples;
mNextSample += maxSamples;
return frames;
}

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

@ -135,7 +135,7 @@ struct PluginHost {
void (*SetMetaDataReadMode)(Decoder *aDecoder);
void (*SetPlaybackReadMode)(Decoder *aDecoder);
bool (*GetIntPref)(const char *aPref, int32_t *aResult);
bool (*GetSystemInfoString)(const char *aKey, char *aResult, uint32_t aResultLen);
bool (*GetSystemInfoString)(const char *aKey, char *aResult, size_t aResultLen);
};
struct Decoder {

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

@ -20,9 +20,7 @@
#include "MPAPI.h"
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
#include "nsIPropertyBag2.h"
#endif
#if defined(ANDROID) || defined(MOZ_WIDGET_GONK)
#include "android/log.h"
@ -94,7 +92,7 @@ static PluginHost sPluginHost = {
nullptr,
nullptr,
GetIntPref,
GetSystemInfoString,
GetSystemInfoString
};
// Return true if Omx decoding is supported on the device. This checks the

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

@ -955,6 +955,8 @@ private:
MOZ_ASSERT(!mSlice);
MOZ_ASSERT(!mDone);
NS_ENSURE_TRUE_VOID(mActor->Manager());
NormalBlobConstructorParams normalParams;
normalParams.contentType() = mContentType;
normalParams.length() = mLength;
@ -1352,6 +1354,8 @@ Blob<ActorFlavor>::ActorDestroy(ActorDestroyReason aWhy)
if (mBlob && mOwnsBlob) {
mBlob->Release();
}
mManager = nullptr;
}
template <ActorFlavorEnum ActorFlavor>

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

@ -1706,7 +1706,7 @@ GLContext::DeletedShader(GLContext *aOrigin, GLuint aName)
}
void
GLContext::DeletedBuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames)
GLContext::DeletedBuffers(GLContext *aOrigin, GLsizei aCount, const GLuint *aNames)
{
RemoveNamesFromArray(aOrigin, aCount, aNames, mTrackedBuffers);
}
@ -1718,19 +1718,19 @@ GLContext::DeletedQueries(GLContext *aOrigin, GLsizei aCount, const GLuint *aNam
}
void
GLContext::DeletedTextures(GLContext *aOrigin, GLsizei aCount, GLuint *aNames)
GLContext::DeletedTextures(GLContext *aOrigin, GLsizei aCount, const GLuint *aNames)
{
RemoveNamesFromArray(aOrigin, aCount, aNames, mTrackedTextures);
}
void
GLContext::DeletedFramebuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames)
GLContext::DeletedFramebuffers(GLContext *aOrigin, GLsizei aCount, const GLuint *aNames)
{
RemoveNamesFromArray(aOrigin, aCount, aNames, mTrackedFramebuffers);
}
void
GLContext::DeletedRenderbuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames)
GLContext::DeletedRenderbuffers(GLContext *aOrigin, GLsizei aCount, const GLuint *aNames)
{
RemoveNamesFromArray(aOrigin, aCount, aNames, mTrackedRenderbuffers);
}

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

@ -1041,7 +1041,7 @@ public:
AFTER_GL_CALL;
}
GLint fGetAttribLocation (GLuint program, const GLchar* name) {
GLint fGetAttribLocation(GLuint program, const GLchar* name) {
BEFORE_GL_CALL;
GLint retval = mSymbols.fGetAttribLocation(program, name);
AFTER_GL_CALL;
@ -1950,25 +1950,25 @@ private:
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteBuffers(GLsizei n, GLuint *names) {
void GLAPIENTRY raw_fDeleteBuffers(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteBuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteFramebuffers(GLsizei n, GLuint *names) {
void GLAPIENTRY raw_fDeleteFramebuffers(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteFramebuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteRenderbuffers(GLsizei n, GLuint *names) {
void GLAPIENTRY raw_fDeleteRenderbuffers(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteRenderbuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteTextures(GLsizei n, GLuint *names) {
void GLAPIENTRY raw_fDeleteTextures(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteTextures(n, names);
AFTER_GL_CALL;
@ -1986,12 +1986,12 @@ public:
TRACKING_CONTEXT(DeletedShader(this, shader));
}
void fDeleteBuffers(GLsizei n, GLuint *names) {
void fDeleteBuffers(GLsizei n, const GLuint* names) {
raw_fDeleteBuffers(n, names);
TRACKING_CONTEXT(DeletedBuffers(this, n, names));
}
void fDeleteFramebuffers(GLsizei n, GLuint *names) {
void fDeleteFramebuffers(GLsizei n, const GLuint* names) {
if (mScreen) {
// Notify mScreen which framebuffers we're deleting.
// Otherwise, we will get framebuffer binding mispredictions.
@ -2008,12 +2008,12 @@ public:
TRACKING_CONTEXT(DeletedFramebuffers(this, n, names));
}
void fDeleteRenderbuffers(GLsizei n, GLuint *names) {
void fDeleteRenderbuffers(GLsizei n, const GLuint* names) {
raw_fDeleteRenderbuffers(n, names);
TRACKING_CONTEXT(DeletedRenderbuffers(this, n, names));
}
void fDeleteTextures(GLsizei n, GLuint *names) {
void fDeleteTextures(GLsizei n, const GLuint* names) {
raw_fDeleteTextures(n, names);
TRACKING_CONTEXT(DeletedTextures(this, n, names));
}
@ -2863,11 +2863,11 @@ public:
void CreatedRenderbuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void DeletedProgram(GLContext *aOrigin, GLuint aName);
void DeletedShader(GLContext *aOrigin, GLuint aName);
void DeletedBuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void DeletedBuffers(GLContext *aOrigin, GLsizei aCount, const GLuint *aNames);
void DeletedQueries(GLContext *aOrigin, GLsizei aCount, const GLuint *aNames);
void DeletedTextures(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void DeletedFramebuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void DeletedRenderbuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void DeletedTextures(GLContext *aOrigin, GLsizei aCount, const GLuint *aNames);
void DeletedFramebuffers(GLContext *aOrigin, GLsizei aCount, const GLuint *aNames);
void DeletedRenderbuffers(GLContext *aOrigin, GLsizei aCount, const GLuint *aNames);
void SharedContextDestroyed(GLContext *aChild);
void ReportOutstandingNames();

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1528,10 +1528,19 @@ MacroAssemblerARM::ma_vimm_f32(float value, FloatRegister dest, Condition cc)
return;
}
VFPImm enc(DoubleHighWord(double(value)));
if (enc.isValid()) {
as_vimm(vd, enc, cc);
return;
// Note that the vimm immediate float32 instruction encoding differs from the
// vimm immediate double encoding, but this difference matches the difference
// in the floating point formats, so it is possible to convert the float32 to
// a double and then use the double encoding paths. It is still necessary to
// firstly check that the double low word is zero because some float32
// numbers set these bits and this can not be ignored.
double doubleValue = value;
if (DoubleLowWord(value) == 0) {
VFPImm enc(DoubleHighWord(doubleValue));
if (enc.isValid()) {
as_vimm(vd, enc, cc);
return;
}
}
}
// Fall back to putting the value in a pool.

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

@ -112,8 +112,6 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -218,7 +216,7 @@ public abstract class GeckoApp
private int mSignalStrenth;
private PhoneStateListener mPhoneStateListener = null;
private boolean mShouldReportGeoData = false;
private boolean mShouldReportGeoData;
abstract public int getLayout();
abstract public boolean hasTabsSideBar();
@ -2436,30 +2434,8 @@ public abstract class GeckoApp
return tm.getPhoneType();
}
// copied from http://code.google.com/p/sensor-data-collection-library/source/browse/src/main/java/TextFileSensorLog.java#223,
// which is apache licensed
private static final Set<Character> AD_HOC_HEX_VALUES =
new HashSet<Character>(Arrays.asList('2','6', 'a', 'e', 'A', 'E'));
private static final String OPTOUT_SSID_SUFFIX = "_nomap";
private static boolean shouldLog(final ScanResult sr) {
// We filter out any ad-hoc devices. Ad-hoc devices are identified by having a
// 2,6,a or e in the second nybble.
// See http://en.wikipedia.org/wiki/MAC_address -- ad hoc networks
// have the last two bits of the second nybble set to 10.
// Only apply this test if we have exactly 17 character long BSSID which should
// be the case.
final char secondNybble = sr.BSSID.length() == 17 ? sr.BSSID.charAt(1) : ' ';
if(AD_HOC_HEX_VALUES.contains(secondNybble)) {
return false;
} else if (sr.SSID != null && sr.SSID.endsWith(OPTOUT_SSID_SUFFIX)) {
return false;
} else {
return true;
}
return sr.SSID == null || !sr.SSID.endsWith("_nomap");
}
private void collectAndReportLocInfo(Location location) {
@ -2476,42 +2452,40 @@ public abstract class GeckoApp
locInfo.put("lon", location.getLongitude());
locInfo.put("lat", location.getLatitude());
locInfo.put("accuracy", (int)location.getAccuracy());
locInfo.put("altitude", (int)location.getAltitude());
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
// If we have an accuracy, round it up to the next meter.
if (location.hasAccuracy()) {
locInfo.put("accuracy", (int) Math.ceil(location.getAccuracy()));
}
// If we have an altitude, round it to the nearest meter.
if (location.hasAltitude()) {
locInfo.put("altitude", Math.round(location.getAltitude()));
}
// Reduce timestamp precision so as to expose less PII.
DateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
locInfo.put("time", df.format(new Date(location.getTime())));
locInfo.put("cell", cellInfo);
MessageDigest digest = MessageDigest.getInstance("SHA-1");
JSONArray wifiInfo = new JSONArray();
List<ScanResult> aps = wm.getScanResults();
if (aps != null) {
for (ScanResult ap : aps) {
if (!shouldLog(ap))
continue;
StringBuilder sb = new StringBuilder();
try {
byte[] result = digest.digest((ap.BSSID + ap.SSID).getBytes("UTF-8"));
for (byte b : result) sb.append(String.format("%02X", b));
JSONObject obj = new JSONObject();
obj.put("key", sb.toString());
obj.put("frequency", ap.frequency);
obj.put("signal", ap.level);
wifiInfo.put(obj);
} catch (UnsupportedEncodingException uee) {
Log.w(LOGTAG, "can't encode the key", uee);
}
JSONObject obj = new JSONObject();
obj.put("key", ap.BSSID);
obj.put("frequency", ap.frequency);
obj.put("signal", ap.level);
wifiInfo.put(obj);
}
}
locInfo.put("wifi", wifiInfo);
} catch (JSONException jsonex) {
Log.w(LOGTAG, "json exception", jsonex);
return;
} catch (NoSuchAlgorithmException nsae) {
Log.w(LOGTAG, "can't create a SHA1", nsae);
}
ThreadUtils.postToBackgroundThread(new Runnable() {
@ -2521,6 +2495,13 @@ public abstract class GeckoApp
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
urlConnection.setDoOutput(true);
// Workaround for a bug in Android HttpURLConnection. When the library
// reuses a stale connection, the connection may fail with an EOFException.
if (Build.VERSION.SDK_INT >= 14 && Build.VERSION.SDK_INT <= 18) {
urlConnection.setRequestProperty("Connection", "Close");
}
JSONArray batch = new JSONArray();
batch.put(locInfo);
JSONObject wrapper = new JSONObject();

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

@ -12,8 +12,5 @@ EXTRA_JS_MODULES = [
EXTRA_COMPONENTS += [
'crashmonitor.manifest',
]
EXTRA_PP_COMPONENTS += [
'nsCrashMonitor.js',
]
]

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

@ -5,6 +5,8 @@
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DownloadLastDir",
@ -35,42 +37,9 @@ var ContentAreaUtils = {
}
}
/**
* urlSecurityCheck: JavaScript wrapper for checkLoadURIWithPrincipal
* and checkLoadURIStrWithPrincipal.
* If |aPrincipal| is not allowed to link to |aURL|, this function throws with
* an error message.
*
* @param aURL
* The URL a page has linked to. This could be passed either as a string
* or as a nsIURI object.
* @param aPrincipal
* The principal of the document from which aURL came.
* @param aFlags
* Flags to be passed to checkLoadURIStr. If undefined,
* nsIScriptSecurityManager.STANDARD will be passed.
*/
function urlSecurityCheck(aURL, aPrincipal, aFlags)
{
var secMan = Services.scriptSecurityManager;
if (aFlags === undefined) {
aFlags = secMan.STANDARD;
}
try {
if (aURL instanceof Components.interfaces.nsIURI)
secMan.checkLoadURIWithPrincipal(aPrincipal, aURL, aFlags);
else
secMan.checkLoadURIStrWithPrincipal(aPrincipal, aURL, aFlags);
} catch (e) {
let principalStr = "";
try {
principalStr = " from " + aPrincipal.URI.spec;
}
catch(e2) { }
throw "Load of " + aURL + principalStr + " denied.";
}
return BrowserUtils.urlSecurityCheck(aURL, aPrincipal, aFlags);
}
/**
@ -84,7 +53,6 @@ function isContentFrame(aFocusedWindow)
return (aFocusedWindow.top == window.content);
}
// Clientele: (Make sure you don't break any of these)
// - File -> Save Page/Frame As...
// - Context -> Save Page/Frame As...
@ -837,21 +805,14 @@ function makeWebBrowserPersist()
return Components.classes[persistContractID].createInstance(persistIID);
}
/**
* Constructs a new URI, using nsIIOService.
* @param aURL The URI spec.
* @param aOriginCharset The charset of the URI.
* @param aBaseURI Base URI to resolve aURL, or null.
* @return an nsIURI object based on aURL.
*/
function makeURI(aURL, aOriginCharset, aBaseURI)
{
return Services.io.newURI(aURL, aOriginCharset, aBaseURI);
return BrowserUtils.makeURI(aURL, aOriginCharset, aBaseURI);
}
function makeFileURI(aFile)
{
return Services.io.newFileURI(aFile);
return BrowserUtils.makeFileURI(aFile);
}
function makeFilePicker()

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

@ -0,0 +1,67 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
this.EXPORTED_SYMBOLS = [ "BrowserUtils" ];
const {interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
this.BrowserUtils = {
/**
* urlSecurityCheck: JavaScript wrapper for checkLoadURIWithPrincipal
* and checkLoadURIStrWithPrincipal.
* If |aPrincipal| is not allowed to link to |aURL|, this function throws with
* an error message.
*
* @param aURL
* The URL a page has linked to. This could be passed either as a string
* or as a nsIURI object.
* @param aPrincipal
* The principal of the document from which aURL came.
* @param aFlags
* Flags to be passed to checkLoadURIStr. If undefined,
* nsIScriptSecurityManager.STANDARD will be passed.
*/
urlSecurityCheck: function(aURL, aPrincipal, aFlags) {
var secMan = Services.scriptSecurityManager;
if (aFlags === undefined) {
aFlags = secMan.STANDARD;
}
try {
if (aURL instanceof Ci.nsIURI)
secMan.checkLoadURIWithPrincipal(aPrincipal, aURL, aFlags);
else
secMan.checkLoadURIStrWithPrincipal(aPrincipal, aURL, aFlags);
} catch (e) {
let principalStr = "";
try {
principalStr = " from " + aPrincipal.URI.spec;
}
catch(e2) { }
throw "Load of " + aURL + principalStr + " denied.";
}
},
/**
* Constructs a new URI, using nsIIOService.
* @param aURL The URI spec.
* @param aOriginCharset The charset of the URI.
* @param aBaseURI Base URI to resolve aURL, or null.
* @return an nsIURI object based on aURL.
*/
makeURI: function(aURL, aOriginCharset, aBaseURI) {
return Services.io.newURI(aURL, aOriginCharset, aBaseURI);
},
makeFileURI: function(aFile) {
return Services.io.newFileURI(aFile);
},
};

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

@ -11,6 +11,7 @@ MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini']
EXTRA_JS_MODULES += [
'AsyncShutdown.jsm',
'BrowserUtils.jsm',
'CharsetMenu.jsm',
'debug.js',
'DeferredTask.jsm',