This commit is contained in:
Ryan VanderMeulen 2013-12-13 15:39:51 -05:00
Родитель ef86288f4a 6da77cb0a5
Коммит 0a96ec2e55
15 изменённых файлов: 180 добавлений и 95 удалений

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

@ -197,6 +197,7 @@
<!-- UI tour experience -->
<panel id="UITourTooltip"
type="arrow"
hidden="true"
noautofocus="true"
noautohide="true"
align="start"
@ -206,6 +207,7 @@
<description id="UITourTooltipDescription" flex="1"/>
</panel>
<panel id="UITourHighlightContainer"
hidden="true"
noautofocus="true"
noautohide="true"
consumeoutsideclicks="false">
@ -461,7 +463,7 @@
#ifdef MENUBAR_CAN_AUTOHIDE
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"
#ifdef XP_LINUX
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
autohide="true"
#endif
#endif

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

@ -522,7 +522,6 @@ MenuPopup.prototype = {
aEvent.charCode); // in unsigned long charCodeArg);
ev.mine = true;
this.commands.dispatchEvent(ev);
switch (aEvent.keyCode) {
case aEvent.DOM_VK_ESCAPE:
@ -537,6 +536,7 @@ MenuPopup.prototype = {
if (Util.isNavigationKey(aEvent.keyCode)) {
aEvent.stopPropagation();
aEvent.preventDefault();
this.commands.dispatchEvent(ev);
} else if (!this._wantTypeBehind) {
// Hide the context menu so you can't type behind it.
aEvent.stopPropagation();

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

@ -220,6 +220,7 @@ pref("extensions.blocklist.enabled", true);
pref("extensions.blocklist.interval", 86400);
pref("extensions.blocklist.url", "https://addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/");
pref("extensions.blocklist.detailsURL", "https://www.mozilla.org/%LOCALE%/blocklist/");
pref("extensions.showMismatchUI", false);
/* block popups by default, and notify the user about blocked popups */
pref("dom.disable_open_during_load", true);

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

@ -464,6 +464,7 @@ this.UITour = {
effect = this.highlightEffects[randomEffect];
}
highlighter.setAttribute("active", effect);
highlighter.parentElement.hidden = false;
let targetRect = aTargetEl.getBoundingClientRect();
@ -514,16 +515,15 @@ this.UITour = {
let tooltipTitle = document.getElementById("UITourTooltipTitle");
let tooltipDesc = document.getElementById("UITourTooltipDescription");
if (tooltip.state == "open") {
tooltip.hidePopup();
}
tooltipTitle.textContent = aTitle;
tooltipDesc.textContent = aDescription;
tooltip.hidden = false;
let alignment = "bottomcenter topright";
if (tooltip.state == "open") {
tooltip.hidePopup();
}
tooltip.openPopup(aAnchorEl, alignment);
}

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

@ -11,13 +11,13 @@
.devtools-monospace {
%ifdef XP_MACOSX
font-family: Menlo, monospace;
%endif
%ifdef XP_LINUX
font-family: monospace;
font-size: 80%;
%endif
%ifdef XP_WIN
%elifdef XP_WIN
font-family: Consolas, monospace;
%else
font-family: monospace;
%endif
%if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
font-size: 80%;
%endif
}
@ -62,7 +62,7 @@
background-image: linear-gradient(to bottom, hsla(209,18%,18%,0.9), hsl(210,11%,16%));
border-radius: 3px;
overflow-x: hidden;
%ifdef XP_LINUX
%if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
max-height: 32rem;
%else
max-height: 40rem;

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

@ -54,7 +54,7 @@ html|*.highlighter-nodeinfobar-pseudo-classes {
padding: 0;
width: 26px;
min-height: 26px;
%ifndef XP_LINUX
%if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
background-color: transparent;
%endif
}

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

@ -20,7 +20,7 @@
%ifdef XP_MACOSX
%include ../osx/shared.inc
%elifdef XP_LINUX
%elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
%include ../linux/linuxShared.inc
%else
%include ../windows/windowsShared.inc

До

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

После

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

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

@ -94,49 +94,12 @@ class GlobalHistory {
GeckoAppShell.notifyUriVisited(uri);
}
// Logic ported from nsNavHistory::CanAddURI.
// http://mxr.mozilla.org/mozilla-central/source/toolkit/components/places/nsNavHistory.cpp#1272
private boolean canAddURI(String uri) {
if (uri == null || uri.length() == 0)
return false;
// First, heck the most common cases (HTTP, HTTPS) to avoid most of the work.
if (uri.startsWith("http:") || uri.startsWith("https:"))
return true;
String scheme = Uri.parse(uri).getScheme();
if (scheme == null)
return false;
// Now check for all bad things.
if (scheme.equals("about") ||
scheme.equals("imap") ||
scheme.equals("news") ||
scheme.equals("mailbox") ||
scheme.equals("moz-anno") ||
scheme.equals("view-source") ||
scheme.equals("chrome") ||
scheme.equals("resource") ||
scheme.equals("data") ||
scheme.equals("wyciwyg") ||
scheme.equals("javascript"))
return false;
return true;
}
public void add(String uri) {
if (!canAddURI(uri))
return;
BrowserDB.updateVisitedHistory(GeckoAppShell.getContext().getContentResolver(), uri);
addToGeckoOnly(uri);
}
public void update(String uri, String title) {
if (!canAddURI(uri))
return;
BrowserDB.updateHistoryTitle(GeckoAppShell.getContext().getContentResolver(), uri, title);
}

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

@ -84,6 +84,14 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlag
if (!aURI)
return NS_OK;
// Silently return if URI is something we shouldn't add to DB.
bool canAdd;
nsresult rv = CanAddURI(aURI, &canAdd);
NS_ENSURE_SUCCESS(rv, rv);
if (!canAdd) {
return NS_OK;
}
if (!(aFlags & VisitFlags::TOP_LEVEL))
return NS_OK;
@ -94,7 +102,7 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlag
return NS_OK;
nsAutoCString uri;
nsresult rv = aURI->GetSpec(uri);
rv = aURI->GetSpec(uri);
if (NS_FAILED(rv)) return rv;
NS_ConvertUTF8toUTF16 uriString(uri);
GeckoAppShell::MarkURIVisited(uriString);
@ -104,6 +112,14 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlag
NS_IMETHODIMP
nsAndroidHistory::SetURITitle(nsIURI *aURI, const nsAString& aTitle)
{
// Silently return if URI is something we shouldn't add to DB.
bool canAdd;
nsresult rv = CanAddURI(aURI, &canAdd);
NS_ENSURE_SUCCESS(rv, rv);
if (!canAdd) {
return NS_OK;
}
if (AndroidBridge::Bridge()) {
nsAutoCString uri;
nsresult rv = aURI->GetSpec(uri);
@ -144,3 +160,53 @@ nsAndroidHistory::Run()
}
return NS_OK;
}
// Filter out unwanted URIs such as "chrome:", "mailbox:", etc.
//
// The model is if we don't know differently then add which basically means
// we are suppose to try all the things we know not to allow in and then if
// we don't bail go on and allow it in.
//
// Logic ported from nsNavHistory::CanAddURI.
NS_IMETHODIMP
nsAndroidHistory::CanAddURI(nsIURI* aURI, bool* canAdd)
{
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
NS_ENSURE_ARG(aURI);
NS_ENSURE_ARG_POINTER(canAdd);
nsAutoCString scheme;
nsresult rv = aURI->GetScheme(scheme);
NS_ENSURE_SUCCESS(rv, rv);
// first check the most common cases (HTTP, HTTPS) to allow in to avoid most
// of the work
if (scheme.EqualsLiteral("http")) {
*canAdd = true;
return NS_OK;
}
if (scheme.EqualsLiteral("https")) {
*canAdd = true;
return NS_OK;
}
// now check for all bad things
if (scheme.EqualsLiteral("about") ||
scheme.EqualsLiteral("imap") ||
scheme.EqualsLiteral("news") ||
scheme.EqualsLiteral("mailbox") ||
scheme.EqualsLiteral("moz-anno") ||
scheme.EqualsLiteral("view-source") ||
scheme.EqualsLiteral("chrome") ||
scheme.EqualsLiteral("resource") ||
scheme.EqualsLiteral("data") ||
scheme.EqualsLiteral("wyciwyg") ||
scheme.EqualsLiteral("javascript") ||
scheme.EqualsLiteral("blob")) {
*canAdd = false;
return NS_OK;
}
*canAdd = true;
return NS_OK;
}

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

@ -34,6 +34,8 @@ private:
nsDataHashtable<nsStringHashKey, nsTArray<mozilla::dom::Link *> *> mListeners;
nsTPriorityQueue<nsString> mPendingURIs;
nsresult CanAddURI(nsIURI* aURI, bool* canAdd);
};
#endif

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

@ -14,6 +14,7 @@ add_test(function test_working_bid_exchange() {
_("Ensure that working BrowserID token exchange works as expected.");
let service = "http://example.com/foo";
let duration = 300;
let server = httpd_setup({
"/1.0/foo/1.0": function(request, response) {
@ -29,6 +30,7 @@ add_test(function test_working_bid_exchange() {
key: "key",
api_endpoint: service,
uid: "uid",
duration: duration,
});
response.bodyOutputStream.write(body, body.length);
}
@ -40,12 +42,12 @@ add_test(function test_working_bid_exchange() {
client.getTokenFromBrowserIDAssertion(url, "assertion", cb);
let result = cb.wait();
do_check_eq("object", typeof(result));
do_check_attribute_count(result, 4);
do_check_attribute_count(result, 5);
do_check_eq(service, result.endpoint);
do_check_eq("id", result.id);
do_check_eq("key", result.key);
do_check_eq("uid", result.uid);
do_check_eq(duration, result.duration);
server.stop(run_next_test);
});
@ -200,6 +202,7 @@ add_test(function test_403_no_urls() {
add_test(function test_send_conditions_accepted() {
_("Ensures that the condition acceptance header is sent when asked.");
let duration = 300;
let server = httpd_setup({
"/1.0/foo/1.0": function(request, response) {
do_check_true(request.hasHeader("x-conditions-accepted"));
@ -213,6 +216,7 @@ add_test(function test_send_conditions_accepted() {
key: "key",
api_endpoint: "http://example.com/",
uid: "uid",
duration: duration,
});
response.bodyOutputStream.write(body, body.length);
}
@ -384,6 +388,7 @@ add_test(function test_unhandled_media_type() {
add_test(function test_rich_media_types() {
_("Ensure that extra tokens in the media type aren't rejected.");
let duration = 300;
let server = httpd_setup({
"/foo": function(request, response) {
response.setStatusLine(request.httpVersion, 200, "OK");
@ -394,6 +399,7 @@ add_test(function test_rich_media_types() {
key: "key",
api_endpoint: "foo",
uid: "uid",
duration: duration,
});
response.bodyOutputStream.write(body, body.length);
}
@ -411,6 +417,7 @@ add_test(function test_rich_media_types() {
add_test(function test_exception_during_callback() {
_("Ensure that exceptions thrown during callback handling are handled.");
let duration = 300;
let server = httpd_setup({
"/foo": function(request, response) {
response.setStatusLine(request.httpVersion, 200, "OK");
@ -421,6 +428,7 @@ add_test(function test_exception_during_callback() {
key: "key",
api_endpoint: "foo",
uid: "uid",
duration: duration,
});
response.bodyOutputStream.write(body, body.length);
}

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

@ -359,7 +359,7 @@ TokenServerClient.prototype = {
return;
}
for (let k of ["id", "key", "api_endpoint", "uid"]) {
for (let k of ["id", "key", "api_endpoint", "uid", "duration"]) {
if (!(k in result)) {
let error = new TokenServerClientServerError("Expected key not " +
" present in result: " +
@ -377,6 +377,7 @@ TokenServerClient.prototype = {
key: result.key,
endpoint: result.api_endpoint,
uid: result.uid,
duration: result.duration,
});
}
};

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

@ -228,6 +228,16 @@ add_test(function test_hawk() {
do_check_eq(result.artifacts.hash, "66DiyapJ0oGgj09IXWdMv8VCg9xk0PL5RqX7bNnQW2k=");
do_check_eq(result.artifacts.mac, "2B++3x5xfHEZbPZGDiK3IwfPZctkV4DUr2ORg1vIHvk=");
// the payload "hash" is also non-urlsafe base64 (+/)
result = compute(makeURI("http://example.net/path"), method,
{ credentials: credentials_sha256,
ts: 1353809207,
nonce: "Ygvqdz",
payload: "something else",
});
do_check_eq(result.artifacts.hash, "lERFXr/IKOaAoYw+eBseDUSwmqZTX0uKZpcWLxsdzt8=");
do_check_eq(result.artifacts.mac, "jiZuhsac35oD7IdcblhFncBr8tJFHcwWLr8NIYWr9PQ=");
/* Test non-ascii hostname. HAWK (via the node.js "url" module) punycodes
* "ëxample.net" into "xn--xample-ova.net" before hashing. I still think
* punycode was a bad joke that got out of the lab and into a spec.

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

@ -574,6 +574,22 @@ ProcessDDE(nsINativeAppSupport* aNative, bool aWait)
}
#endif
/**
* Determines if there is support for showing the profile manager
*
* @return true in all environments except for Windows Metro
*/
static bool
CanShowProfileManager()
{
#if defined(XP_WIN)
return XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop;
#else
return true;
#endif
}
bool gSafeMode = false;
/**
@ -1893,6 +1909,10 @@ static nsresult
ShowProfileManager(nsIToolkitProfileService* aProfileSvc,
nsINativeAppSupport* aNative)
{
if (!CanShowProfileManager()) {
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult rv;
nsCOMPtr<nsIFile> profD, profLD;
@ -2243,8 +2263,11 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
PR_fprintf(PR_STDERR, "Error: argument -p is invalid when argument -osint is specified\n");
return NS_ERROR_FAILURE;
}
if (CanShowProfileManager()) {
return ShowProfileManager(aProfileSvc, aNative);
}
}
if (ar) {
ar = CheckArg("osint");
if (ar == ARG_FOUND) {
@ -2271,14 +2294,16 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
return ProfileLockedDialog(profile, unlocker, aNative, aResult);
}
if (CanShowProfileManager()) {
return ShowProfileManager(aProfileSvc, aNative);
}
}
ar = CheckArg("profilemanager", true);
if (ar == ARG_BAD) {
PR_fprintf(PR_STDERR, "Error: argument -profilemanager is invalid when argument -osint is specified\n");
return NS_ERROR_FAILURE;
} else if (ar == ARG_FOUND) {
} else if (ar == ARG_FOUND && CanShowProfileManager()) {
return ShowProfileManager(aProfileSvc, aNative);
}
@ -2303,8 +2328,9 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
}
bool useDefault = true;
if (count > 1)
if (count > 1 && CanShowProfileManager()) {
aProfileSvc->GetStartWithLastProfile(&useDefault);
}
if (useDefault) {
nsCOMPtr<nsIToolkitProfile> profile;
@ -2359,6 +2385,10 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
}
}
if (!CanShowProfileManager()) {
return NS_ERROR_FAILURE;
}
return ShowProfileManager(aProfileSvc, aNative);
}
@ -4072,12 +4102,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
// We have an application restart don't do any shutdown checks here
// In particular we don't want to poison IO for checking late-writes.
gShutdownChecks = SCM_NOTHING;
#if defined(MOZ_METRO) && defined(XP_WIN)
if (rv == NS_SUCCESS_RESTART_METRO_APP) {
LaunchDefaultMetroBrowser();
}
#endif
}
if (!mShuttingDown) {
@ -4114,7 +4138,15 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
MOZ_gdk_display_close(mGdkDisplay);
#endif
#if defined(MOZ_METRO) && defined(XP_WIN)
if (rv == NS_SUCCESS_RESTART_METRO_APP) {
LaunchDefaultMetroBrowser();
rv = NS_OK;
} else
#endif
{
rv = LaunchChild(mNativeApp, true);
}
#ifdef MOZ_CRASHREPORTER
if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)

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

@ -113,8 +113,8 @@ HRESULT SHCreateShellItemArrayFromShellItemDynamic(IShellItem *psi, REFIID riid,
return hr;
}
BOOL
WinLaunchDeferredMetroFirefox(bool aInMetro)
HRESULT
WinLaunchDeferredMetroFirefox()
{
// Create an instance of the Firefox Metro DEH which is used to launch the browser
const CLSID CLSID_FirefoxMetroDEH = {0x5100FEC1,0x212B, 0x4BF5 ,{0x9B,0xF8, 0x3E,0x65, 0x0F,0xD7,0x94,0xA3}};
@ -126,51 +126,46 @@ WinLaunchDeferredMetroFirefox(bool aInMetro)
IID_IExecuteCommand,
getter_AddRefs(executeCommand));
if (FAILED(hr))
return FALSE;
return hr;
// Get the currently running exe path
WCHAR exePath[MAX_PATH + 1] = { L'\0' };
if (!::GetModuleFileNameW(0, exePath, MAX_PATH))
return FALSE;
return hr;
// Convert the path to a long path since GetModuleFileNameW returns the path
// that was used to launch Firefox which is not necessarily a long path.
if (!::GetLongPathNameW(exePath, exePath, MAX_PATH))
return FALSE;
return hr;
// Create an IShellItem for the current browser path
nsRefPtr<IShellItem> shellItem;
hr = WinUtils::SHCreateItemFromParsingName(exePath, nullptr, IID_IShellItem,
getter_AddRefs(shellItem));
if (FAILED(hr))
return FALSE;
return hr;
// Convert to an IShellItemArray which is used for the path to launch
nsRefPtr<IShellItemArray> shellItemArray;
hr = SHCreateShellItemArrayFromShellItemDynamic(shellItem, IID_IShellItemArray, getter_AddRefs(shellItemArray));
if (FAILED(hr))
return FALSE;
return hr;
// Set the path to launch and parameters needed
nsRefPtr<IObjectWithSelection> selection;
hr = executeCommand->QueryInterface(IID_IObjectWithSelection, getter_AddRefs(selection));
if (FAILED(hr))
return FALSE;
return hr;
hr = selection->SetSelection(shellItemArray);
if (FAILED(hr))
return FALSE;
return hr;
if (aInMetro) {
hr = executeCommand->SetParameters(L"--metro-restart");
} else {
hr = executeCommand->SetParameters(L"--desktop-restart");
}
if (FAILED(hr))
return FALSE;
return hr;
// Run the default browser through the DEH
hr = executeCommand->Execute();
return SUCCEEDED(hr);
return executeCommand->Execute();
}
// Called by appstartup->run in xre, which is initiated by a call to
@ -200,22 +195,24 @@ MetroAppShell::Run(void)
mozilla::widget::StopAudioSession();
nsCOMPtr<nsIAppStartup> appStartup (do_GetService(NS_APPSTARTUP_CONTRACTID));
bool restartingInMetro = false, restarting = false;
bool restartingInMetro = false, restartingInDesktop = false;
if (appStartup && NS_SUCCEEDED(appStartup->GetRestartingTouchEnvironment(&restartingInMetro)) &&
restartingInMetro) {
WinLaunchDeferredMetroFirefox(true);
}
if (!appStartup || NS_FAILED(appStartup->GetRestarting(&restarting))) {
if (!appStartup || NS_FAILED(appStartup->GetRestarting(&restartingInDesktop))) {
WinUtils::Log("appStartup->GetRestarting() unsuccessful");
}
// This calls XRE_metroShutdown() in xre. This will also destroy
// MessagePump.
if (appStartup && NS_SUCCEEDED(appStartup->GetRestartingTouchEnvironment(&restartingInMetro)) &&
restartingInMetro) {
restartingInDesktop = false;
}
// This calls XRE_metroShutdown() in xre. Shuts down gecko, including
// releasing the profile, and destroys MessagePump.
sMetroApp->ShutdownXPCOM();
if (restarting) {
// Handle update restart or browser switch requests
if (restartingInDesktop) {
WinUtils::Log("Relaunching desktop browser");
SHELLEXECUTEINFOW sinfo;
memset(&sinfo, 0, sizeof(SHELLEXECUTEINFOW));
sinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
@ -228,6 +225,9 @@ MetroAppShell::Run(void)
sinfo.lpParameters = L"--desktop-restart";
sinfo.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&sinfo);
} else if (restartingInMetro) {
HRESULT hresult = WinLaunchDeferredMetroFirefox();
WinUtils::Log("Relaunching metro browser (hr=%X)", hresult);
}
// This will free the real main thread in CoreApplication::Run()