Merge fx-team to m-c. a=merge

This commit is contained in:
Ryan VanderMeulen 2014-06-10 00:36:38 -04:00
commit fcd9396176
28 changed files with 403 additions and 15 deletions

View File

@ -1363,6 +1363,11 @@ pref("devtools.gcli.hideIntro", false);
// How eager are we to show help: never=1, sometimes=2, always=3
pref("devtools.gcli.eagerHelper", 2);
// Alias to the script URLs for inject command.
pref("devtools.gcli.jquerySrc", "http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js");
pref("devtools.gcli.lodashSrc", "http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js");
pref("devtools.gcli.underscoreSrc", "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js");
// Remember the Web Console filters
pref("devtools.webconsole.filter.network", true);
pref("devtools.webconsole.filter.networkinfo", false);

View File

@ -14,6 +14,7 @@ const commandModules = [
"gcli/commands/cmd",
"gcli/commands/cookie",
"gcli/commands/csscoverage",
"gcli/commands/inject",
"gcli/commands/jsb",
"gcli/commands/listen",
"gcli/commands/media",

View File

@ -50,6 +50,9 @@ support-files =
browser_cmd_csscoverage_sheetB.css
browser_cmd_csscoverage_sheetC.css
browser_cmd_csscoverage_sheetD.css
[browser_cmd_inject.js]
support-files =
browser_cmd_inject.html
[browser_cmd_csscoverage_util.js]
[browser_cmd_jsb.js]
support-files =

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<head>
<body>
</body>
</html>

View File

@ -0,0 +1,98 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the inject commands works as they should
const TEST_URI = 'http://example.com/browser/browser/devtools/commandline/'+
'test/browser_cmd_inject.html';
function test() {
helpers.addTabWithToolbar(TEST_URI, function(options) {
return helpers.audit(options, [
{
setup: 'inject',
check: {
input: 'inject',
hints: ' <library>',
markup: 'VVVVVV',
status: 'ERROR'
},
},
{
setup: 'inject j',
check: {
input: 'inject j',
hints: 'Query',
markup: 'VVVVVVVI',
status: 'ERROR'
},
},
{
setup: 'inject http://example.com/browser/browser/devtools/commandline/test/browser_cmd_inject.js',
check: {
input: 'inject http://example.com/browser/browser/devtools/commandline/test/browser_cmd_inject.js',
hints: '',
markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
status: 'VALID',
args: {
library: {
value: function(library) {
is(library.type, 'string', 'inject type name');
is(library.string, 'http://example.com/browser/browser/devtools/commandline/test/browser_cmd_inject.js',
'inject uri data');
},
status: 'VALID'
}
}
},
exec: {
output: [ /http:\/\/example.com\/browser\/browser\/devtools\/commandline\/test\/browser_cmd_inject.js loaded/ ]
}
},
{
setup: 'inject notauri',
check: {
input: 'inject notauri',
hints: '',
markup: 'VVVVVVVVVVVVVV',
status: 'VALID',
args: {
library: {
value: function(library) {
is(library.type, 'string', 'inject type name');
is(library.string, 'notauri', 'inject notauri data');
},
status: 'VALID'
}
}
},
exec: {
output: [ /Failed to load notauri - Invalid URI/ ]
}
},
{
setup: 'inject jQuery',
check: {
input: 'inject jQuery',
hints: '',
markup: 'VVVVVVVVVVVVV',
status: 'VALID',
args: {
library: {
value: function(library) {
is(library.type, 'selection', 'inject type name');
is(library.selection.name, 'jQuery', 'inject jquery name');
is(library.selection.src, 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js',
'inject jquery src');
},
status: 'VALID'
}
}
},
exec: {
output: [ /jQuery loaded/ ]
}
},
]);
}).then(finish, helpers.handleError);
}

View File

@ -76,6 +76,9 @@ function forEachType(options, typeSpec, callback) {
else if (name === 'remote') {
return;
}
else if (name === 'union') {
typeSpec.types = [{ name: "string" }];
}
var type = types.createType(typeSpec);
var reply = callback(type);
@ -86,6 +89,7 @@ function forEachType(options, typeSpec, callback) {
delete typeSpec.data;
delete typeSpec.delegateType;
delete typeSpec.subtype;
delete typeSpec.types;
return value;
});

View File

@ -177,6 +177,10 @@ helpIntro=GCLI is an experiment to create a highly usable command line for web d
# sub-commands.
subCommands=Sub-Commands
# LOCALIZATION NOTE: This error message is displayed when the command line is
# cannot find a match for the parse types.
commandParseError=Command line parsing error
# LOCALIZATION NOTE (contextDesc, contextManual, contextPrefixDesc): These
# strings are used to describe the 'context' command and its 'prefix'
# parameter. See localization comment for 'connect' for an explanation about

View File

@ -1391,3 +1391,12 @@ mediaEmulateDesc=Emulate a specified CSS media type
mediaEmulateManual=View the document as if rendered on a device supporting the given media type, with the relevant CSS rules applied.
mediaEmulateType=The media type to emulate
mediaResetDesc=Stop emulating a CSS media type
# LOCALIZATION NOTE (injectDesc, injectManual, injectLibraryDesc, injectLoaded,
# injectFailed) These strings describe the 'inject' commands and all available
# parameters.
injectDesc=Inject common libraries into the page
injectManual=Inject common libraries into the content of the page which can also be accessed from the Firefox console.
injectLibraryDesc=Select the library to inject or enter a valid script URI to inject
injectLoaded=%1$S loaded
injectFailed=Failed to load %1$S - Invalid URI

View File

@ -318,6 +318,7 @@ browser.jar:
skin/classic/browser/devtools/font-inspector.css (../shared/devtools/font-inspector.css)
skin/classic/browser/devtools/computedview.css (../shared/devtools/computedview.css)
skin/classic/browser/devtools/arrow-e.png (../shared/devtools/images/arrow-e.png)
skin/classic/browser/devtools/arrow-e@2x.png (../shared/devtools/images/arrow-e@2x.png)
skin/classic/browser/devtools/projecteditor/projecteditor.css (../shared/devtools/projecteditor/projecteditor.css)
skin/classic/browser/devtools/projecteditor/file-icons-sheet@2x.png (../shared/devtools/projecteditor/file-icons-sheet@2x.png)
skin/classic/browser/devtools/app-manager/connection-footer.css (../shared/devtools/app-manager/connection-footer.css)

View File

@ -436,6 +436,7 @@ browser.jar:
skin/classic/browser/devtools/font-inspector.css (../shared/devtools/font-inspector.css)
skin/classic/browser/devtools/computedview.css (../shared/devtools/computedview.css)
skin/classic/browser/devtools/arrow-e.png (../shared/devtools/images/arrow-e.png)
skin/classic/browser/devtools/arrow-e@2x.png (../shared/devtools/images/arrow-e@2x.png)
skin/classic/browser/devtools/projecteditor/projecteditor.css (../shared/devtools/projecteditor/projecteditor.css)
skin/classic/browser/devtools/projecteditor/file-icons-sheet@2x.png (../shared/devtools/projecteditor/file-icons-sheet@2x.png)
skin/classic/browser/devtools/app-manager/connection-footer.css (../shared/devtools/app-manager/connection-footer.css)

View File

@ -29,6 +29,13 @@ menulist:not([editable="true"]) > .menulist-dropmarker {
margin-bottom: 1px;
}
menulist > menupopup menu,
menulist > menupopup menuitem,
button[type="menu"] > menupopup menu,
button[type="menu"] > menupopup menuitem {
-moz-padding-end: 34px;
}
.help-button > .button-box > .button-icon {
-moz-margin-start: 0;
}

View File

@ -51,23 +51,29 @@ body {
outline: 0;
}
.property-value, .other-property-value {
background-image: url(arrow-e.png);
background-repeat: no-repeat;
background-size: 5px 8px;
}
@media (min-resolution: 2dppx) {
.property-value, .other-property-value {
background-image: url(arrow-e@2x.png);
}
}
.property-value {
width: 100%;
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background-image: url(arrow-e.png);
background-repeat: no-repeat;
background-size: 5px 8px;
background-position: 2px center;
padding-left: 10px;
outline: 0;
}
.other-property-value {
background-image: url(arrow-e.png);
background-repeat: no-repeat;
background-size: 5px 8px;
background-position: left center;
padding-left: 8px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

View File

@ -66,27 +66,29 @@
.stylesheet-sidebar {
width: 230px;
-moz-border-start: 1px solid;
}
.theme-light .stylesheet-sidebar {
border-left: 1px solid #A6A6A6;
border-color: #aaa; /* Splitters */
}
.theme-dark .stylesheet-sidebar {
border-left: 1px solid #606C75;
border-color: #000; /* Splitters */
}
.theme-light .media-rule-label {
border-bottom: 1px solid #CCC;
border-bottom-color: #cddae5; /* Grey */
}
.theme-dark .media-rule-label {
border-bottom: 1px solid #343C45;
border-bottom-color: #303b47; /* Grey */
}
.media-rule-label {
padding: 4px;
cursor: pointer;
border-bottom: 1px solid;
}
.theme-light .media-condition-unmatched {

View File

@ -355,6 +355,7 @@ browser.jar:
skin/classic/browser/devtools/font-inspector.css (../shared/devtools/font-inspector.css)
skin/classic/browser/devtools/computedview.css (../shared/devtools/computedview.css)
skin/classic/browser/devtools/arrow-e.png (../shared/devtools/images/arrow-e.png)
skin/classic/browser/devtools/arrow-e@2x.png (../shared/devtools/images/arrow-e@2x.png)
skin/classic/browser/devtools/projecteditor/projecteditor.css (../shared/devtools/projecteditor/projecteditor.css)
skin/classic/browser/devtools/projecteditor/file-icons-sheet@2x.png (../shared/devtools/projecteditor/file-icons-sheet@2x.png)
skin/classic/browser/devtools/app-manager/connection-footer.css (../shared/devtools/app-manager/connection-footer.css)
@ -758,6 +759,7 @@ browser.jar:
skin/classic/aero/browser/devtools/font-inspector.css (../shared/devtools/font-inspector.css)
skin/classic/aero/browser/devtools/computedview.css (../shared/devtools/computedview.css)
skin/classic/aero/browser/devtools/arrow-e.png (../shared/devtools/images/arrow-e.png)
skin/classic/aero/browser/devtools/arrow-e.png (../shared/devtools/images/arrow-e@2x.png)
skin/classic/aero/browser/devtools/projecteditor/projecteditor.css (../shared/devtools/projecteditor/projecteditor.css)
skin/classic/aero/browser/devtools/projecteditor/file-icons-sheet@2x.png (../shared/devtools/projecteditor/file-icons-sheet@2x.png)
skin/classic/aero/browser/devtools/app-manager/connection-footer.css (../shared/devtools/app-manager/connection-footer.css)

View File

@ -13630,6 +13630,11 @@ nsGlobalWindow::GetDialogArguments(JSContext* aCx, ErrorResult& aError)
MOZ_ASSERT(IsModalContentWindow(),
"This should only be called on modal windows!");
if (!mDialogArguments) {
MOZ_ASSERT(mIsClosed, "This window should be closed!");
return JS::UndefinedValue();
}
// This does an internal origin check, and returns undefined if the subject
// does not subsumes the origin of the arguments.
JS::Rooted<JSObject*> wrapper(aCx, GetWrapper());

View File

@ -8,7 +8,6 @@ support-files =
file_empty.html
iframe_postMessage_solidus.html
[test_Image_constructor.html]
[test_appname_override.html]
[test_audioWindowUtils.html]
[test_audioNotification.html]
@ -22,6 +21,8 @@ support-files =
[test_consoleEmptyStack.html]
[test_constructor-assignment.html]
[test_constructor.html]
[test_dialogArguments.html]
skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s
[test_document.all_unqualified.html]
[test_domcursor.html]
[test_domrequest.html]
@ -37,6 +38,7 @@ support-files =
[test_getFeature_without_perm.html]
[test_history_document_open.html]
[test_history_state_null.html]
[test_Image_constructor.html]
[test_innersize_scrollport.html]
[test_messageChannel.html]
[test_messageChannel_cloning.html]

View File

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<title>Test for Bug 1019761</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<script type="application/javascript">
/*
Tests whether Firefox crashes when accessing the dialogArguments property
of a modal window that has been closed.
*/
SimpleTest.waitForExplicitFinish();
function openModal() {
showModalDialog("javascript:opener.winRef = window; \
window.opener.setTimeout(\'winRef.dialogArguments;\', 0);\
window.close();");
ok(true, "dialogArguments did not cause a crash.");
SimpleTest.finish();
}
window.onload = openModal;
</script>
</body>
</html>

View File

@ -109,7 +109,6 @@
<!ENTITY pref_category_home "Home">
<!ENTITY pref_category_home_summary "Customize your homepage">
<!ENTITY pref_category_home_panels "Panels">
<!ENTITY pref_home_add_panel "Add panel">
<!ENTITY home_add_panel_title "Add new panel">
<!ENTITY home_add_panel_empty "Sorry, we couldn\'t find any panels for you to add.">
<!-- Localization note (home_add_panel_installed):

View File

@ -122,7 +122,6 @@
<string name="pref_category_home">&pref_category_home;</string>
<string name="pref_category_home_summary">&pref_category_home_summary;</string>
<string name="pref_category_home_panels">&pref_category_home_panels;</string>
<string name="pref_home_add_panel">&pref_home_add_panel;</string>
<string name="home_add_panel_title">&home_add_panel_title;</string>
<string name="home_add_panel_empty">&home_add_panel_empty;</string>
<string name="home_add_panel_installed">&home_add_panel_installed;</string>

View File

@ -151,7 +151,7 @@ class TabsTray extends TwoWayView
@Override
public void onClick(View v) {
TabRow tab = (TabRow) v.getTag();
final int pos = (isVertical() ? tab.info.getWidth() : tab.info.getHeight());
final int pos = (isVertical() ? tab.info.getWidth() : 0 - tab.info.getHeight());
animateClose(tab.info, pos);
}
};

View File

@ -53,6 +53,28 @@ exports.asyncOnce = function asyncOnce(func) {
};
};
/**
* Adds an event listener to the given element, and then removes its event
* listener once the event is called, returning the event object as a promise.
* @param nsIDOMElement element
* The DOM element to listen on
* @param String event
* The name of the event type to listen for
* @param Boolean useCapture
* Should we initiate the capture phase?
* @return Promise
* The promise resolved with the event object when the event first
* happens
*/
exports.listenOnce = function listenOnce(element, event, useCapture) {
return new Promise(function(resolve, reject) {
var onEvent = function(ev) {
element.removeEventListener(event, onEvent, useCapture);
resolve(ev);
}
element.addEventListener(event, onEvent, useCapture);
});
};
/**
* Call a function that expects a callback as the last argument and returns a

View File

@ -0,0 +1,80 @@
/* 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";
const { Services } = require("resource://gre/modules/Services.jsm");
const { listenOnce } = require("devtools/async-utils");
const gcli = require("gcli/index");
exports.items = [
{
name: "inject",
description: gcli.lookup("injectDesc"),
manual: gcli.lookup("injectManual"),
params: [{
name: 'library',
type: {
name: "union",
types: [
{
name: "selection",
lookup: [
{
name: "jQuery",
value: {
name: "jQuery",
src: Services.prefs.getCharPref("devtools.gcli.jquerySrc")
}
},
{
name: "lodash",
value: {
name: "lodash",
src: Services.prefs.getCharPref("devtools.gcli.lodashSrc")
}
},
{
name: "underscore",
value: {
name: "underscore",
src: Services.prefs.getCharPref("devtools.gcli.underscoreSrc")
}
}
]
},
{
name: "string"
}
]
},
description: gcli.lookup("injectLibraryDesc")
}],
exec: function*(args, context) {
let document = context.environment.document;
let library = args.library;
let name = (library.type === "selection") ?
library.selection.name : library.string;
let src = (library.type === "selection") ?
library.selection.src : library.string;
try {
// Check if URI is valid
Services.io.newURI(src, null, null);
} catch(e) {
return gcli.lookupFormat("injectFailed", [name]);
}
let newSource = document.createElement("script");
newSource.setAttribute("src", src);
let loadPromise = listenOnce(newSource, "load");
document.head.appendChild(newSource);
yield loadPromise;
return gcli.lookupFormat("injectLoaded", [name]);
}
}
];

View File

@ -8,6 +8,7 @@ const { Cc, Ci, Cu } = require("chrome");
const gcli = require("gcli/index");
const XMLHttpRequest = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"];
loader.lazyImporter(this, "Preferences", "resource://gre/modules/Preferences.jsm");
loader.lazyImporter(this, "js_beautify", "resource:///modules/devtools/Jsbeautify.jsm");
exports.items = [
@ -29,7 +30,7 @@ exports.items = [
type: "number",
description: gcli.lookup("jsbIndentSizeDesc"),
manual: gcli.lookup("jsbIndentSizeManual"),
defaultValue: 2
defaultValue: Preferences.get("devtools.editor.tabsize", 2),
},
{
name: "indentChar",

View File

@ -53,6 +53,7 @@ var items = [
require('../types/resource').items,
require('../types/setting').items,
require('../types/string').items,
require('../types/union').items,
require('../fields/delegate').items,
require('../fields/selection').items,

View File

@ -48,6 +48,7 @@ var items = [
require('./types/resource').items,
require('./types/setting').items,
require('./types/string').items,
require('./types/union').items,
require('./fields/delegate').items,
require('./fields/selection').items,

View File

@ -0,0 +1,96 @@
/*
* Copyright 2014, Mozilla Foundation and contributors
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var Promise = require('../util/promise').Promise;
var l10n = require('../util/l10n');
var centralTypes = require("./types").centralTypes;
var Conversion = require("./types").Conversion;
var Status = require("./types").Status;
exports.items = [
{
// The union type allows for a combination of different parameter types.
item: "type",
name: "union",
constructor: function() {
// Get the properties of the type. The last object in the list of types
// should always be a string type.
this.types = this.types.map(function(typeData) {
typeData.type = centralTypes.createType(typeData);
typeData.lookup = typeData.lookup;
return typeData;
});
},
stringify: function(value, context) {
if (value == null) {
return "";
}
var type = this.types.find(function(typeData) {
return typeData.name == value.type;
}).type;
return type.stringify(value[value.type], context);
},
parse: function(arg, context) {
// Try to parse the given argument in the provided order of the parameter
// types. Returns a promise containing the Conversion of the value that
// was parsed.
var self = this;
var onError = function(i) {
if (i >= self.types.length) {
return Promise.reject(new Conversion(undefined, arg, Status.ERROR,
l10n.lookup("commandParseError")));
} else {
return tryNext(i + 1);
}
};
var tryNext = function(i) {
var type = self.types[i].type;
try {
return type.parse(arg, context).then(function(conversion) {
if (conversion.getStatus() === Status.VALID ||
conversion.getStatus() === Status.INCOMPLETE) {
// Converts the conversion value of the union type to an
// object that identifies the current working type and the
// data associated with it
if (conversion.value) {
var oldConversionValue = conversion.value;
conversion.value = { type: type.name };
conversion.value[type.name] = oldConversionValue;
}
return conversion;
} else {
return onError(i);
}
});
} catch(e) {
return onError(i);
}
};
return Promise.resolve(tryNext(0));
},
}
];