This commit is contained in:
Ryan VanderMeulen 2013-09-26 21:36:35 -04:00
Родитель 4ee712cb39 f1c82ffdb6
Коммит 1286b0b31d
45 изменённых файлов: 367 добавлений и 148 удалений

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

@ -9,10 +9,8 @@
<![CDATA[
function doTest()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var accRetrieval = Components.classes["@mozilla.org/accessibleRetrieval;1"].
getService(Components.interfaces.nsIAccessibleRetrieval);
var accRetrieval = SpecialPowers.Cc["@mozilla.org/accessibleRetrieval;1"].
getService(SpecialPowers.Ci.nsIAccessibleRetrieval);
var treecol = document.getElementById("col");
var x = treecol.boxObject.screenX;

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

@ -1 +1,2 @@
load 471493.xul
# Disabled because it causes assertions/crashes in later crashtests, see bug 918246
skip load 471493.xul

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

@ -874,18 +874,27 @@ SocialToolbar = {
let toggleNotificationsCommand = document.getElementById("Social:ToggleNotifications");
toggleNotificationsCommand.setAttribute("hidden", !socialEnabled);
let parent = document.getElementById("social-notification-panel");
while (parent.hasChildNodes()) {
let frame = parent.firstChild;
SharedFrame.forgetGroup(frame.id);
parent.removeChild(frame);
}
// we need to remove buttons and frames if !socialEnabled or the provider
// has changed (frame origin does not match current provider). We only
// remove frames that are "attached" to buttons in this toolbar button since
// other buttons may also be using grouped frames.
let tbi = document.getElementById("social-provider-button");
if (tbi) {
// buttons after social-provider-button are ambient icons
while (tbi.nextSibling) {
tbi.parentNode.removeChild(tbi.nextSibling);
let next = tbi.nextSibling;
let currentOrigin = Social.provider ? Social.provider.origin : null;
while (next) {
let button = next;
next = next.nextSibling;
// get the frame for this button
let frameId = button.getAttribute("notificationFrameId");
let frame = document.getElementById(frameId);
if (!socialEnabled || frame.getAttribute("origin") != currentOrigin) {
SharedFrame.forgetGroup(frame.id);
frame.parentNode.removeChild(frame);
button.parentNode.removeChild(button);
}
}
}
},

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

@ -259,7 +259,7 @@ panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .a
#wrapper-urlbar-container > #urlbar-container > #urlbar {
-moz-user-input: disabled;
cursor: -moz-grab;
cursor: grab;
}
#PopupAutoComplete {

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

@ -11,7 +11,7 @@
#placesTreechildren::-moz-tree-cell(grippyRow),
#placesTreechildren::-moz-tree-cell-text(grippyRow),
#placesTreechildren::-moz-tree-image(grippyRow) {
cursor: -moz-grab;
cursor: grab;
}

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

@ -1499,7 +1499,7 @@
</binding>
<binding id="click-to-play-plugins-notification" extends="chrome://global/content/bindings/notification.xml#popup-notification">
<content align="start" class="click-to-play-plugins-notification-content">
<content align="start" style="width: &pluginNotification.width;;">
<xul:vbox flex="1" align="stretch" class="popup-notification-main-box"
xbl:inherits="popupid">
<xul:hbox class="click-to-play-plugins-notification-description-box" flex="1" align="start">

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

@ -68,6 +68,23 @@ const IDB = {
return deferred.promise;
},
update: function(project) {
let deferred = promise.defer();
var transaction = IDB._db.transaction(["projects"], "readwrite");
var objectStore = transaction.objectStore("projects");
var request = objectStore.put(project);
request.onerror = function(event) {
deferred.reject("Unable to update project to the AppProjects indexedDB: " +
this.error.name + " - " + this.error.message );
};
request.onsuccess = function() {
deferred.resolve();
};
return deferred.promise;
},
remove: function(location) {
let deferred = promise.defer();
@ -110,6 +127,8 @@ const AppProjects = {
// The packaged app local path is a valid id, but only on the client.
// This origin will be used to generate the true id of an app:
// its manifest URL.
// If the app ends up specifying an explicit origin in its manifest,
// we will override this random UUID on app install.
packagedAppOrigin: generateUUID().toString().slice(1, -1)
};
return IDB.add(project).then(function () {
@ -131,6 +150,14 @@ const AppProjects = {
});
},
update: function (project) {
return IDB.update({
type: project.type,
location: project.location,
packagedAppOrigin: project.packagedAppOrigin
}).then(() => project);
},
remove: function(location) {
return IDB.remove(location).then(function () {
let projects = store.object.projects;

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

@ -208,9 +208,15 @@ let UI = {
},
install: function(project) {
let install;
if (project.type == "packaged") {
install = installPackaged(this.connection.client, this.listTabsResponse.webappsActor, project.location, project.packagedAppOrigin);
return installPackaged(this.connection.client, this.listTabsResponse.webappsActor, project.location, project.packagedAppOrigin)
.then(({ appId }) => {
// If the packaged app specified a custom origin override,
// we need to update the local project origin
project.packagedAppOrigin = appId;
// And ensure the indexed db on disk is also updated
AppProjects.update(project);
});
} else {
let manifestURLObject = Services.io.newURI(project.location, null, null);
let origin = Services.io.newURI(manifestURLObject.prePath, null, null);
@ -219,9 +225,8 @@ let UI = {
origin: origin.spec,
manifestURL: project.location
};
install = installHosted(this.connection.client, this.listTabsResponse.webappsActor, appId, metadata, project.manifest);
return installHosted(this.connection.client, this.listTabsResponse.webappsActor, appId, metadata, project.manifest);
}
return install;
},
start: function(project) {

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

@ -4522,6 +4522,7 @@ var Utils = {
case "CSP":
case "Invalid HSTS Headers":
case "Insecure Password Field":
case "SSL":
return CATEGORY_SECURITY;
default:

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

@ -672,6 +672,13 @@ just addresses the organization to follow, e.g. "This site is run by " -->
<!ENTITY pluginActivateAlways.label "Allow and Remember">
<!ENTITY pluginBlockNow.label "Block Plugin">
<!-- LOCALIZATION NOTE: (pluginNotification.width): This is used to determine the
width of the plugin popup notification that can appear if a plugin has been
blocked on a page. Should be wide enough to fit the pluginActivateNow.label
and pluginActivateAlways.label strings above on a single line. This must be
a CSS length value. -->
<!ENTITY pluginNotification.width "28em">
<!ENTITY tabCrashed.header "Tab crashed">
<!ENTITY tabCrashed.message "Well, this is embarrassing. We tried to display this Web page, but it's not responding.">
<!ENTITY tabCrashed.checkSendReport "Tell &vendorShortName; about this crash so they can fix it.">

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

@ -2,10 +2,6 @@
padding: 0px;
}
.click-to-play-plugins-notification-content {
width: 28em;
}
.click-to-play-plugins-notification-center-box {
border: 1px solid ThreeDShadow;
margin: 10px;

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

@ -737,6 +737,14 @@ public:
return sXPConnect;
}
/**
* Report simple error message to the browser console
* @param aErrorText the error message
* @param classification Name of the module reporting error
*/
static void LogSimpleConsoleError(const nsAString& aErrorText,
const char * classification);
/**
* Report a non-localized error message to the error console.
* @param aErrorText the error message

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

@ -3014,6 +3014,24 @@ nsresult nsContentUtils::FormatLocalizedString(PropertiesFile aFile,
getter_Copies(aResult));
}
/* static */ void
nsContentUtils::LogSimpleConsoleError(const nsAString& aErrorText,
const char * classification)
{
nsCOMPtr<nsIScriptError> scriptError =
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
if (scriptError) {
nsCOMPtr<nsIConsoleService> console =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (console && NS_SUCCEEDED(scriptError->Init(aErrorText, EmptyString(),
EmptyString(), 0, 0,
nsIScriptError::errorFlag,
classification))) {
console->LogMessage(scriptError);
}
}
}
/* static */ nsresult
nsContentUtils::ReportToConsole(uint32_t aErrorFlags,
const nsACString& aCategory,

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

@ -1,22 +1,25 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:mathml="http://www.w3.org/1998/Math/MathML">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:mathml="http://www.w3.org/1998/Math/MathML" class="reftest-wait">
<mathml:mfenced/>
<script><![CDATA[
var docviewer;
function do_onload() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var navigator1 = parent.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebNavigation);
var docShell = navigator1.QueryInterface(Components.interfaces.nsIDocShell);
docviewer = docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
var navigator1 = SpecialPowers.wrap(parent).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).getInterface(SpecialPowers.Ci.nsIWebNavigation);
var docShell = navigator1.QueryInterface(SpecialPowers.Ci.nsIDocShell);
docviewer = docShell.contentViewer.QueryInterface(SpecialPowers.Ci.nsIMarkupDocumentViewer);
setTimeout(function() {window.location.reload()}, 500);
setTimeout(function() {
clearTimeout(timer);
docviewer.textZoom = 1;
document.documentElement.removeAttribute("class");
}, 500);
setTimeout(doe,50, 0.2);
}
do_onload();
var timer;
function doe(i) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
docviewer.textZoom += i;
if (docviewer.textZoom >=4)
@ -25,7 +28,7 @@ if (docviewer.textZoom >=4)
if (docviewer.textZoom <=0)
i = 0.2;
window.status = docviewer.textZoom;
setTimeout(doe, 50, i);
timer = setTimeout(doe, 50, i);
}
]]></script>
</html>

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

@ -201,6 +201,7 @@
<activity android:name="org.mozilla.gecko.Restarter"
android:process="@ANDROID_PACKAGE_NAME@Restarter"
android:noHistory="true"
android:theme="@style/Gecko">
<intent-filter>
<action android:name="org.mozilla.gecko.restart"/>

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

@ -2268,10 +2268,14 @@ abstract public class BrowserApp extends GeckoApp
// HomePager.OnNewTabsListener
@Override
public void onNewTabs(String[] urls) {
final EnumSet<OnUrlOpenListener.Flags> flags = EnumSet.of(OnUrlOpenListener.Flags.ALLOW_SWITCH_TO_TAB);
for (String url : urls) {
if (!maybeSwitchToTab(url, flags)) {
openUrl(url, true);
}
}
}
// HomePager.OnUrlOpenListener
@Override

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

@ -2132,8 +2132,6 @@ abstract public class GeckoApp
Intent intent = new Intent(action);
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, RESTARTER_CLASS);
/* TODO: addEnvToIntent(intent); */
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
if (args != null)
intent.putExtra("args", args);
intent.putExtra("didRestart", true);

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

@ -666,7 +666,6 @@ RES_DRAWABLE_MDPI = \
res/drawable-mdpi/icon_most_recent.png \
res/drawable-mdpi/icon_most_recent_empty.png \
res/drawable-mdpi/icon_most_visited.png \
res/drawable-mdpi/icon_most_visited_empty.png \
res/drawable-mdpi/icon_openinapp.png \
res/drawable-mdpi/icon_pageaction.png \
res/drawable-mdpi/icon_reading_list_empty.png \
@ -782,7 +781,6 @@ RES_DRAWABLE_HDPI = \
res/drawable-hdpi/icon_most_recent.png \
res/drawable-hdpi/icon_most_recent_empty.png \
res/drawable-hdpi/icon_most_visited.png \
res/drawable-hdpi/icon_most_visited_empty.png \
res/drawable-hdpi/icon_openinapp.png \
res/drawable-hdpi/icon_pageaction.png \
res/drawable-hdpi/icon_reading_list_empty.png \
@ -884,7 +882,6 @@ RES_DRAWABLE_XHDPI = \
res/drawable-xhdpi/icon_most_recent.png \
res/drawable-xhdpi/icon_most_recent_empty.png \
res/drawable-xhdpi/icon_most_visited.png \
res/drawable-xhdpi/icon_most_visited_empty.png \
res/drawable-xhdpi/icon_openinapp.png \
res/drawable-xhdpi/icon_pageaction.png \
res/drawable-xhdpi/icon_reading_list_empty.png \

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

@ -15,6 +15,8 @@ public class Restarter extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(LOGTAG, "Trying to restart " + AppConstants.MOZ_APP_NAME);
try {
int countdown = 40;
@ -46,15 +48,10 @@ public class Restarter extends Activity {
Bundle b = getIntent().getExtras();
if (b != null)
intent.putExtras(b);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Log.i(LOGTAG, intent.toString());
startActivity(intent);
} catch (Exception e) {
Log.i(LOGTAG, e.toString());
}
// Give the new process time to start before we die
GeckoAppShell.waitForAnotherGeckoProc();
System.exit(0);
}
}

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

@ -47,11 +47,8 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.EnumSet;
@ -87,9 +84,6 @@ public class TopSitesPage extends HomeFragment {
// Grid of top sites
private TopSitesGridView mGrid;
// Reference to the View to display when there are no results.
private View mEmptyView;
// Banner to show snippets.
private HomeBanner mBanner;
@ -224,7 +218,6 @@ public class TopSitesPage extends HomeFragment {
super.onDestroyView();
mList = null;
mGrid = null;
mEmptyView = null;
mListAdapter = null;
mGridAdapter = null;
}
@ -466,20 +459,6 @@ public class TopSitesPage extends HomeFragment {
if (c != null && c.getCount() > 0) {
return;
}
if (mEmptyView == null) {
// Set empty page view. We delay this so that the empty view won't flash.
ViewStub emptyViewStub = (ViewStub) getView().findViewById(R.id.home_empty_view_stub);
mEmptyView = emptyViewStub.inflate();
final ImageView emptyIcon = (ImageView) mEmptyView.findViewById(R.id.home_empty_image);
emptyIcon.setImageResource(R.drawable.icon_most_visited_empty);
final TextView emptyText = (TextView) mEmptyView.findViewById(R.id.home_empty_text);
emptyText.setText(R.string.home_most_visited_empty);
mList.setEmptyView(mEmptyView);
}
}
private static class TopSitesLoader extends SimpleCursorLoader {

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

@ -280,7 +280,6 @@ size. -->
<!ENTITY home_last_tabs_empty "Your recent tabs show up here.">
<!ENTITY home_most_recent_title "Most recent">
<!ENTITY home_most_recent_empty "Websites you visited most recently show up here.">
<!ENTITY home_most_visited_title "Most visited">
<!ENTITY home_reading_list_empty "Articles you save for later show up here.">
<!-- Localization note (home_reading_list_hint): The "TIP" string is synonymous to "hint", "clue", etc. This string is displayed
as an advisory message on how to add content to the reading list when the reading list empty.
@ -291,7 +290,6 @@ size. -->
as alternate text for accessibility. It is not visible in the UI. -->
<!ENTITY home_reading_list_hint_accessible "TIP: Save articles to your reading list by long pressing the reader mode button when it appears in the title bar.">
<!ENTITY home_most_visited_empty "Websites you visit most frequently show up here.">
<!ENTITY pin_site_dialog_hint "Enter a search keyword">
<!ENTITY filepicker_title "Choose File">

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 808 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.7 KiB

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

@ -6,7 +6,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/url_bar_bg">
android:background="@color/background_light">
<LinearLayout android:id="@+id/prompt"
android:focusable="true"
@ -20,16 +20,15 @@
<TextView android:id="@+id/suggestions_prompt_title"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:textColor="@color/url_bar_title"
android:layout_marginLeft="6dip"
android:textSize="14sp"
android:layout_weight="1" />
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.Widget.SuggestionsPrompt"/>
<TextView android:id="@+id/suggestions_prompt_yes"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="14sp"
android:layout_marginLeft="15dip"
android:textAppearance="@style/TextAppearance.Widget.SuggestionsPrompt"
android:background="@drawable/suggestion_selector"
android:paddingLeft="15dp"
android:paddingRight="15dp"
@ -41,8 +40,8 @@
<TextView android:id="@+id/suggestions_prompt_no"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="14sp"
android:layout_marginLeft="6dip"
android:textAppearance="@style/TextAppearance.Widget.SuggestionsPrompt"
android:background="@drawable/suggestion_selector"
android:nextFocusRight="@+id/suggestions_prompt_no"
android:paddingLeft="15dp"

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

@ -8,11 +8,6 @@
android:layout_height="fill_parent"
android:orientation="vertical">
<ViewStub android:id="@+id/home_empty_view_stub"
android:layout="@layout/home_empty_page"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<org.mozilla.gecko.home.HomeListView
android:id="@+id/list"
style="@style/Widget.TopSitesListView"

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

@ -312,6 +312,10 @@
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.Widget.SuggestionsPrompt" parent="TextAppearance.Small">
<item name="android:textColor">@color/url_bar_title</item>
</style>
<style name="TextAppearance.Widget.Home" />
<style name="TextAppearance.Widget.Home.Header" parent="TextAppearance.Small">

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

@ -259,8 +259,6 @@
<string name="home_last_tabs_empty">&home_last_tabs_empty;</string>
<string name="home_most_recent_title">&home_most_recent_title;</string>
<string name="home_most_recent_empty">&home_most_recent_empty;</string>
<string name="home_most_visited_title">&home_most_visited_title;</string>
<string name="home_most_visited_empty">&home_most_visited_empty;</string>
<string name="home_reading_list_empty">&home_reading_list_empty;</string>
<string name="home_reading_list_hint">&home_reading_list_hint;</string>
<string name="home_reading_list_hint_accessible">&home_reading_list_hint_accessible;</string>

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

@ -1,7 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!DOCTYPE html [
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
%brandDTD;
<!ENTITY % abouthomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
%abouthomeDTD;
]>
<!-- 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
@ -9,6 +15,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&abouthome.title;</title>
<link rel="icon" type="image/png" sizes="64x64" href="chrome://branding/content/favicon64.png" />
</head>
<body>

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

@ -17,6 +17,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&privatebrowsingpage.title;</title>
<meta name="viewport" content="width=device-width, initial-scale=1; user-scalable=no"/>
<link rel="stylesheet" href="chrome://browser/skin/aboutPrivateBrowsing.css" type="text/css" media="all"/>
<link rel="icon" type="image/png" href="chrome://branding/content/favicon32.png" />

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

@ -0,0 +1,5 @@
<!-- 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/. -->
<!ENTITY abouthome.title "&brandShortName; Home">

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

@ -14,6 +14,7 @@
locale/@AB_CD@/browser/aboutDownloads.dtd (%chrome/aboutDownloads.dtd)
locale/@AB_CD@/browser/aboutDownloads.properties (%chrome/aboutDownloads.properties)
locale/@AB_CD@/browser/aboutFeedback.dtd (%chrome/aboutFeedback.dtd)
locale/@AB_CD@/browser/aboutHome.dtd (%chrome/aboutHome.dtd)
locale/@AB_CD@/browser/aboutPrivateBrowsing.dtd (%chrome/aboutPrivateBrowsing.dtd)
locale/@AB_CD@/browser/aboutReader.properties (%chrome/aboutReader.properties)
#ifdef MOZ_SERVICES_HEALTHREPORT

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

@ -113,9 +113,9 @@
#include "nsXPCOMCIDInternal.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsIConsoleService.h"
#include "PSMRunnable.h"
#include "SharedSSLState.h"
#include "nsContentUtils.h"
#include "ssl.h"
#include "secerr.h"
@ -213,11 +213,7 @@ LogInvalidCertError(TransportSecurityInfo *socketInfo,
socketInfo->GetErrorLogMessage(errorCode, errorMessageType, message);
if (!message.IsEmpty()) {
nsCOMPtr<nsIConsoleService> console;
console = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (console) {
console->LogStringMessage(message.get());
}
nsContentUtils::LogSimpleConsoleError(message, "SSL");
}
}

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

@ -18,7 +18,7 @@
#include "nsProxyRelease.h"
#include "PSMRunnable.h"
#include "ScopedNSSTypes.h"
#include "nsIConsoleService.h"
#include "nsContentUtils.h"
#include "nsIHttpChannelInternal.h"
#include "nsNetUtil.h"
#include "SharedSSLState.h"
@ -1042,16 +1042,14 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) {
// localized.
if (!siteSupportsSafeRenego &&
ioLayerHelpers.getWarnLevelMissingRFC5746() > 0) {
nsCOMPtr<nsIConsoleService> console = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (console) {
nsXPIDLCString hostName;
infoObject->GetHostName(getter_Copies(hostName));
nsAutoString msg;
msg.Append(NS_ConvertASCIItoUTF16(hostName));
msg.Append(NS_LITERAL_STRING(" : server does not support RFC 5746, see CVE-2009-3555"));
console->LogStringMessage(msg.get());
}
nsContentUtils::LogSimpleConsoleError(msg, "SSL");
}
ScopedCERTCertificate serverCert(SSL_PeerCertificate(fd));

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

@ -37,6 +37,7 @@
#include "ScopedNSSTypes.h"
#include "SharedSSLState.h"
#include "mozilla/Preferences.h"
#include "nsContentUtils.h"
#include "ssl.h"
#include "secerr.h"
@ -668,11 +669,7 @@ nsHandleSSLError(nsNSSSocketInfo *socketInfo,
socketInfo->GetErrorLogMessage(err, errtype, errorString);
if (!errorString.IsEmpty()) {
nsCOMPtr<nsIConsoleService> console;
console = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (console) {
console->LogStringMessage(errorString.get());
}
nsContentUtils::LogSimpleConsoleError(errorString, "SSL");
}
}

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

@ -3,6 +3,8 @@
include ../../testing/crashtest/sanity/crashtests.list
include ../../accessible/tests/crashtests/crashtests.list
include ../../content/base/crashtests/crashtests.list
include ../../content/canvas/crashtests/crashtests.list
include ../../content/events/crashtests/crashtests.list

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

@ -338,8 +338,8 @@ Download.prototype = {
// While shutting down or disposing of this object, we prevent the download
// from returning to be in progress.
if (this._finalized) {
return Promise.reject(new DownloadError(Cr.NS_ERROR_FAILURE,
"Cannot start after finalization."));
return Promise.reject(new DownloadError({
message: "Cannot start after finalization."}));
}
// Initialize all the status properties for a new or restarted download.
@ -408,15 +408,12 @@ Download.prototype = {
}
}
try {
// Disallow download if parental controls service restricts it.
if (yield DownloadIntegration.shouldBlockForParentalControls(this)) {
let error = new DownloadError(Cr.NS_ERROR_FAILURE, "Download blocked.");
error.becauseBlocked = true;
error.becauseBlockedByParentalControls = true;
throw error;
throw new DownloadError({ becauseBlockedByParentalControls: true });
}
try {
// Execute the actual download through the saver object.
yield this.saver.execute(DS_setProgressBytes.bind(this),
DS_setProperties.bind(this));
@ -430,7 +427,16 @@ Download.prototype = {
// is forced to actually check the status properties to see if the
// download was canceled or failed because of other reasons.
if (this._promiseCanceled) {
throw new DownloadError(Cr.NS_ERROR_FAILURE, "Download canceled.");
throw new DownloadError({ message: "Download canceled." });
}
// An HTTP 450 error code is used by Windows to indicate that a uri is
// blocked by parental controls. This will prevent the download from
// occuring, so an error needs to be raised. This is not performed
// during the parental controls check above as it requires the request
// to start.
if (this._blockedByParentalControls) {
ex = new DownloadError({ becauseBlockedByParentalControls: true });
}
// Update the download error, unless a new attempt already started. The
@ -475,7 +481,7 @@ Download.prototype = {
// Notify the new download state before returning.
this._notifyChange();
return this._currentAttempt;
return currentAttempt;
},
/*
@ -1152,18 +1158,22 @@ DownloadTarget.fromSerializable = function (aSerializable) {
/**
* Provides detailed information about a download failure.
*
* @param aResult
* The result code associated with the error.
* @param aMessage
* The message to be displayed, or null to use the message associated
* with the result code.
* @param aInferCause
* If true, attempts to determine if the cause of the download is a
* network failure or a local file failure, based on a set of known
* values of the result code. This is useful when the error is received
* by a component that handles both aspects of the download.
* @param aProperties
* Object which may contain any of the following properties:
* {
* result: Result error code, defaulting to Cr.NS_ERROR_FAILURE
* message: String error message to be displayed, or null to use the
* message associated with the result code.
* inferCause: If true, attempts to determine if the cause of the
* download is a network failure or a local file failure,
* based on a set of known values of the result code.
* This is useful when the error is received by a
* component that handles both aspects of the download.
* }
* The properties object may also contain any of the DownloadError's
* because properties, which will be set accordingly in the error object.
*/
function DownloadError(aResult, aMessage, aInferCause)
function DownloadError(aProperties)
{
const NS_ERROR_MODULE_BASE_OFFSET = 0x45;
const NS_ERROR_MODULE_NETWORK = 6;
@ -1171,18 +1181,39 @@ function DownloadError(aResult, aMessage, aInferCause)
// Set the error name used by the Error object prototype first.
this.name = "DownloadError";
this.result = aResult || Cr.NS_ERROR_FAILURE;
if (aMessage) {
this.message = aMessage;
this.result = aProperties.result || Cr.NS_ERROR_FAILURE;
if (aProperties.message) {
this.message = aProperties.message;
} else if (aProperties.becauseBlocked ||
aProperties.becauseBlockedByParentalControls) {
this.message = "Download blocked.";
} else {
let exception = new Components.Exception("", this.result);
this.message = exception.toString();
}
if (aInferCause) {
let module = ((aResult & 0x7FFF0000) >> 16) - NS_ERROR_MODULE_BASE_OFFSET;
if (aProperties.inferCause) {
let module = ((this.result & 0x7FFF0000) >> 16) -
NS_ERROR_MODULE_BASE_OFFSET;
this.becauseSourceFailed = (module == NS_ERROR_MODULE_NETWORK);
this.becauseTargetFailed = (module == NS_ERROR_MODULE_FILES);
}
else {
if (aProperties.becauseSourceFailed) {
this.becauseSourceFailed = true;
}
if (aProperties.becauseTargetFailed) {
this.becauseTargetFailed = true;
}
}
if (aProperties.becauseBlockedByParentalControls) {
this.becauseBlocked = true;
this.becauseBlockedByParentalControls = true;
}
else if (aProperties.becauseBlocked) {
this.becauseBlocked = true;
}
this.stack = new Error().stack;
}
@ -1309,6 +1340,31 @@ DownloadSaver.prototype = {
targetUri);
},
/**
* Return true if the request's response has been blocked by Windows parental
* controls with an HTTP 450 error code.
*
* @param aRequest
* nsIRequest object
* @return True if the response is blocked.
*/
isResponseParentalBlocked: function(aRequest)
{
// If the HTTP status is 450, then Windows Parental Controls have
// blocked this download.
if (aRequest instanceof Ci.nsIHttpChannel &&
aRequest.responseStatus == 450) {
// Cancel the request, but set a flag on the download that can be
// retrieved later when handling the cancellation so that the proper
// blocked by parental controls error can be thrown.
this.download._blockedByParentalControls = true;
aRequest.cancel(Cr.NS_BINDING_ABORTED);
return true;
}
return false;
},
/**
* Returns a static representation of the current object state.
*
@ -1420,7 +1476,7 @@ DownloadCopySaver.prototype = {
// Throw a DownloadError indicating that the operation failed because of
// the target file. We cannot translate this into a specific result
// code, but we preserve the original message using the toString method.
let error = new DownloadError(Cr.NS_ERROR_FAILURE, ex.toString());
let error = new DownloadError({ message: ex.toString() });
error.becauseTargetFailed = true;
throw error;
}
@ -1431,7 +1487,7 @@ DownloadCopySaver.prototype = {
if (this._canceled) {
// Don't create the BackgroundFileSaver object if we have been
// canceled meanwhile.
throw new DownloadError(Cr.NS_ERROR_FAILURE, "Saver canceled.");
throw new DownloadError({ message: "Saver canceled." });
}
// Create the object that will save the file in a background thread.
@ -1453,8 +1509,8 @@ DownloadCopySaver.prototype = {
} else {
// Infer the origin of the error from the failure code, because
// BackgroundFileSaver does not provide more specific data.
deferSaveComplete.reject(new DownloadError(aStatus, null,
true));
let properties = { result: aStatus, inferCause: true };
deferSaveComplete.reject(new DownloadError(properties));
}
},
};
@ -1506,6 +1562,10 @@ DownloadCopySaver.prototype = {
onStartRequest: function (aRequest, aContext) {
backgroundFileSaver.onStartRequest(aRequest, aContext);
if (this.isResponseParentalBlocked(aRequest)) {
return;
}
aSetPropertiesFn({ contentType: channel.contentType });
// Ensure we report the value of "Content-Length", if available,
@ -1777,6 +1837,10 @@ DownloadLegacySaver.prototype = {
ex.result == Cr.NS_ERROR_NOT_RESUMABLE) { }
}
if (this.isResponseParentalBlocked(aRequest)) {
return;
}
// For legacy downloads, we must update the referrer at this time.
if (aRequest instanceof Ci.nsIHttpChannel && aRequest.referrer) {
this.download.source.referrer = aRequest.referrer.spec;
@ -1805,7 +1869,8 @@ DownloadLegacySaver.prototype = {
} else {
// Infer the origin of the error from the failure code, because more
// specific data is not available through the nsITransfer implementation.
this.deferExecuted.reject(new DownloadError(aStatus, null, true));
let properties = { result: aStatus, inferCause: true };
this.deferExecuted.reject(new DownloadError(properties));
}
},

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

@ -1355,6 +1355,7 @@ add_task(function test_blocked_parental_controls()
do_throw("The download should have blocked.");
} catch (ex if ex instanceof Downloads.Error && ex.becauseBlocked) {
do_check_true(ex.becauseBlockedByParentalControls);
do_check_true(download.error.becauseBlockedByParentalControls);
}
// Now that the download stopped, the target file should not exist.
@ -1363,6 +1364,32 @@ add_task(function test_blocked_parental_controls()
cleanup();
});
/**
* Test a download that will be blocked by Windows parental controls by
* resulting in an HTTP status code of 450.
*/
add_task(function test_blocked_parental_controls_httpstatus450()
{
let download;
try {
if (!gUseLegacySaver) {
download = yield promiseNewDownload(httpUrl("parentalblocked.zip"));
yield download.start();
}
else {
download = yield promiseStartLegacyDownload(httpUrl("parentalblocked.zip"));
yield promiseDownloadStopped(download);
}
do_throw("The download should have blocked.");
} catch (ex if ex instanceof Downloads.Error && ex.becauseBlocked) {
do_check_true(ex.becauseBlockedByParentalControls);
do_check_true(download.error.becauseBlockedByParentalControls);
do_check_true(download.stopped);
}
do_check_false(yield OS.File.exists(download.target.path));
});
/**
* download.showContainingDirectory() action
*/

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

@ -773,6 +773,13 @@ add_task(function test_common_initialize()
TEST_DATA_SHORT_GZIP_ENCODED_SECOND.length);
});
// This URL will emulate being blocked by Windows Parental controls
gHttpServer.registerPathHandler("/parentalblocked.zip",
function (aRequest, aResponse) {
aResponse.setStatusLine(aRequest.httpVersion, 450,
"Blocked by Windows Parental Controls");
});
// Disable integration with the host application requiring profile access.
DownloadIntegration.dontLoadList = true;
DownloadIntegration.dontLoadObservers = true;

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

@ -9,6 +9,9 @@
"use strict";
XPCOMUtils.defineLazyModuleGetter(this, "DownloadError",
"resource://gre/modules/DownloadCore.jsm");
////////////////////////////////////////////////////////////////////////////////
//// Execution of common tests
@ -17,6 +20,74 @@ let gUseLegacySaver = false;
let scriptFile = do_get_file("common_test_Download.js");
Services.scriptloader.loadSubScript(NetUtil.newURI(scriptFile).spec);
////////////////////////////////////////////////////////////////////////////////
//// Tests
/**
* Tests the DownloadError object.
*/
add_task(function test_DownloadError()
{
let error = new DownloadError({ result: Cr.NS_ERROR_NOT_RESUMABLE,
message: "Not resumable."});
do_check_eq(error.result, Cr.NS_ERROR_NOT_RESUMABLE);
do_check_eq(error.message, "Not resumable.");
do_check_false(error.becauseSourceFailed);
do_check_false(error.becauseTargetFailed);
do_check_false(error.becauseBlocked);
do_check_false(error.becauseBlockedByParentalControls);
error = new DownloadError({ message: "Unknown error."});
do_check_eq(error.result, Cr.NS_ERROR_FAILURE);
do_check_eq(error.message, "Unknown error.");
error = new DownloadError({ result: Cr.NS_ERROR_NOT_RESUMABLE });
do_check_eq(error.result, Cr.NS_ERROR_NOT_RESUMABLE);
do_check_true(error.message.indexOf("Exception") > 0);
// becauseSourceFailed will be set, but not the unknown property.
error = new DownloadError({ message: "Unknown error.",
becauseSourceFailed: true,
becauseUnknown: true });
do_check_true(error.becauseSourceFailed);
do_check_false("becauseUnknown" in error);
error = new DownloadError({ result: Cr.NS_ERROR_MALFORMED_URI,
inferCause: true });
do_check_eq(error.result, Cr.NS_ERROR_MALFORMED_URI);
do_check_true(error.becauseSourceFailed);
do_check_false(error.becauseTargetFailed);
do_check_false(error.becauseBlocked);
do_check_false(error.becauseBlockedByParentalControls);
// This test does not set inferCause, so becauseSourceFailed will not be set.
error = new DownloadError({ result: Cr.NS_ERROR_MALFORMED_URI });
do_check_eq(error.result, Cr.NS_ERROR_MALFORMED_URI);
do_check_false(error.becauseSourceFailed);
error = new DownloadError({ result: Cr.NS_ERROR_FILE_INVALID_PATH,
inferCause: true });
do_check_eq(error.result, Cr.NS_ERROR_FILE_INVALID_PATH);
do_check_false(error.becauseSourceFailed);
do_check_true(error.becauseTargetFailed);
do_check_false(error.becauseBlocked);
do_check_false(error.becauseBlockedByParentalControls);
error = new DownloadError({ becauseBlocked: true });
do_check_eq(error.message, "Download blocked.");
do_check_false(error.becauseSourceFailed);
do_check_false(error.becauseTargetFailed);
do_check_true(error.becauseBlocked);
do_check_false(error.becauseBlockedByParentalControls);
error = new DownloadError({ becauseBlockedByParentalControls: true });
do_check_eq(error.message, "Download blocked.");
do_check_false(error.becauseSourceFailed);
do_check_false(error.becauseTargetFailed);
do_check_true(error.becauseBlocked);
do_check_true(error.becauseBlockedByParentalControls);
});
////////////////////////////////////////////////////////////////////////////////
//// Termination

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

@ -934,7 +934,6 @@ var WalkerActor = protocol.ActorClass({
}
this._installHelperSheet(node);
this.layoutHelpers.scrollIntoViewIfNeeded(node.rawNode);
DOMUtils.addPseudoClassLock(node.rawNode, HIGHLIGHTED_PSEUDO_CLASS);
this._highlightTimeout = setTimeout(this._unhighlight.bind(this), HIGHLIGHTED_TIMEOUT);

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

@ -56,7 +56,7 @@ toolbarspacer {
/* ::::: toolbarpaletteitem ::::: */
toolbarpaletteitem {
cursor: -moz-grab;
cursor: grab;
}
.toolbarpaletteitem-box[type="spacer"],

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

@ -74,7 +74,7 @@ toolbarspacer {
/* ::::: toolbarpaletteitem ::::: */
toolbarpaletteitem {
cursor: -moz-grab;
cursor: grab;
}
.toolbarpaletteitem-box[type="spacer"],

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

@ -41,7 +41,7 @@ toolbarseparator {
/* ::::: toolbarpaletteitem ::::: */
toolbarpaletteitem {
cursor: -moz-grab;
cursor: grab;
}
toolbar[iconsize="small"] toolbarpaletteitem[type="spacer"] {

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

@ -65,7 +65,7 @@ toolbarspacer {
/* ::::: toolbarpaletteitem ::::: */
toolbarpaletteitem {
cursor: -moz-grab;
cursor: grab;
}
.toolbarpaletteitem-box[type="spacer"],