mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Merging cedar with mozilla-central.
This commit is contained in:
commit
52ff4fdee7
@ -1005,6 +1005,19 @@ pref("devtools.chrome.enabled", false);
|
||||
// Change to -1 if you do not want the Web Console to remember its last height.
|
||||
pref("devtools.hud.height", 0);
|
||||
|
||||
// Remember the Web Console position. Possible values:
|
||||
// above - above the web page,
|
||||
// below - below the web page,
|
||||
// window - in a separate window/popup panel.
|
||||
pref("devtools.webconsole.position", "above");
|
||||
|
||||
// The number of lines that are displayed in the web console for the Net,
|
||||
// CSS, JS and Web Developer categories.
|
||||
pref("devtools.hud.loglimit.network", 200);
|
||||
pref("devtools.hud.loglimit.cssparser", 200);
|
||||
pref("devtools.hud.loglimit.exception", 200);
|
||||
pref("devtools.hud.loglimit.console", 200);
|
||||
|
||||
// Whether the character encoding menu is under the main Firefox button. This
|
||||
// preference is a string so that localizers can alter it.
|
||||
pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties");
|
||||
|
@ -462,7 +462,6 @@ statuspanel {
|
||||
margin-top: -3em;
|
||||
left: 0;
|
||||
max-width: 50%;
|
||||
-moz-transition: opacity 100ms ease-out;
|
||||
}
|
||||
|
||||
statuspanel:-moz-locale-dir(ltr)[mirror],
|
||||
@ -482,6 +481,7 @@ statuspanel[type=status] {
|
||||
}
|
||||
|
||||
statuspanel[type=overLink] {
|
||||
-moz-transition: opacity 100ms ease-out;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource:///modules/PropertyPanel.jsm");
|
||||
|
||||
const SCRATCHPAD_CONTEXT_CONTENT = 1;
|
||||
const SCRATCHPAD_CONTEXT_CHROME = 2;
|
||||
const SCRATCHPAD_CONTEXT_BROWSER = 2;
|
||||
const SCRATCHPAD_WINDOW_URL = "chrome://browser/content/scratchpad.xul";
|
||||
const SCRATCHPAD_L10N = "chrome://browser/locale/scratchpad.properties";
|
||||
const SCRATCHPAD_WINDOW_FEATURES = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
|
||||
@ -75,7 +75,7 @@ var Scratchpad = {
|
||||
* Possible values:
|
||||
* - SCRATCHPAD_CONTEXT_CONTENT to execute code in the context of the current
|
||||
* tab content window object.
|
||||
* - SCRATCHPAD_CONTEXT_CHROME to execute code in the context of the
|
||||
* - SCRATCHPAD_CONTEXT_BROWSER to execute code in the context of the
|
||||
* currently active chrome window object.
|
||||
*/
|
||||
executionContext: SCRATCHPAD_CONTEXT_CONTENT,
|
||||
@ -121,6 +121,11 @@ var Scratchpad = {
|
||||
return recentWin ? recentWin.gBrowser : null;
|
||||
},
|
||||
|
||||
insertIntro: function SP_insertIntro()
|
||||
{
|
||||
this.textbox.value = this.strings.GetStringFromName("scratchpadIntro");
|
||||
},
|
||||
|
||||
/**
|
||||
* Cached Cu.Sandbox object for the active tab content window object.
|
||||
*/
|
||||
@ -129,8 +134,9 @@ var Scratchpad = {
|
||||
/**
|
||||
* Get the Cu.Sandbox object for the active tab content window object. Note
|
||||
* that the returned object is cached for later reuse. The cached object is
|
||||
* kept only for the current browser window and it is reset for each context
|
||||
* switch or navigator:browser window switch.
|
||||
* kept only for the current location in the current tab of the current
|
||||
* browser window and it is reset for each context switch,
|
||||
* navigator:browser window switch, tab switch or navigation.
|
||||
*/
|
||||
get contentSandbox()
|
||||
{
|
||||
@ -141,12 +147,16 @@ var Scratchpad = {
|
||||
}
|
||||
|
||||
if (!this._contentSandbox ||
|
||||
this.browserWindow != this._previousBrowserWindow) {
|
||||
this.browserWindow != this._previousBrowserWindow ||
|
||||
this._previousBrowser != this.gBrowser.selectedBrowser ||
|
||||
this._previousLocation != this.gBrowser.contentWindow.location.href) {
|
||||
let contentWindow = this.gBrowser.selectedBrowser.contentWindow;
|
||||
this._contentSandbox = new Cu.Sandbox(contentWindow,
|
||||
{ sandboxPrototype: contentWindow, wantXrays: false });
|
||||
|
||||
this._previousBrowserWindow = this.browserWindow;
|
||||
this._previousBrowser = this.gBrowser.selectedBrowser;
|
||||
this._previousLocation = contentWindow.location.href;
|
||||
}
|
||||
|
||||
return this._contentSandbox;
|
||||
@ -283,7 +293,7 @@ var Scratchpad = {
|
||||
* Execute the selected text (if any) or the entire textbox content in the
|
||||
* current context.
|
||||
*/
|
||||
execute: function SP_execute()
|
||||
run: function SP_run()
|
||||
{
|
||||
let selection = this.selectedText || this.textbox.value;
|
||||
let result = this.evalForContext(selection);
|
||||
@ -298,7 +308,7 @@ var Scratchpad = {
|
||||
*/
|
||||
inspect: function SP_inspect()
|
||||
{
|
||||
let [selection, result] = this.execute();
|
||||
let [selection, result] = this.run();
|
||||
|
||||
if (result) {
|
||||
this.openPropertyPanel(selection, result);
|
||||
@ -307,11 +317,11 @@ var Scratchpad = {
|
||||
|
||||
/**
|
||||
* Execute the selected text (if any) or the entire textbox content in the
|
||||
* current context. The evaluation result is "printed" in the textbox after
|
||||
* current context. The evaluation result is inserted into the textbox after
|
||||
* the selected text, or at the end of the textbox value if there is no
|
||||
* selected text.
|
||||
*/
|
||||
print: function SP_print()
|
||||
display: function SP_display()
|
||||
{
|
||||
let selectionStart = this.textbox.selectionStart;
|
||||
let selectionEnd = this.textbox.selectionEnd;
|
||||
@ -319,7 +329,7 @@ var Scratchpad = {
|
||||
selectionEnd = this.textbox.value.length;
|
||||
}
|
||||
|
||||
let [selection, result] = this.execute();
|
||||
let [selection, result] = this.run();
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
@ -556,23 +566,23 @@ var Scratchpad = {
|
||||
setContentContext: function SP_setContentContext()
|
||||
{
|
||||
let content = document.getElementById("sp-menu-content");
|
||||
document.getElementById("sp-menu-chrome").removeAttribute("checked");
|
||||
document.getElementById("sp-menu-browser").removeAttribute("checked");
|
||||
content.setAttribute("checked", true);
|
||||
this.statusbarStatus.label = content.getAttribute("label");
|
||||
this.executionContext = SCRATCHPAD_CONTEXT_CONTENT;
|
||||
this.statusbarStatus.label = content.getAttribute("label");
|
||||
this.resetContext();
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the current execution context to be the most recent chrome window.
|
||||
*/
|
||||
setChromeContext: function SP_setChromeContext()
|
||||
setBrowserContext: function SP_setBrowserContext()
|
||||
{
|
||||
let chrome = document.getElementById("sp-menu-chrome");
|
||||
let browser = document.getElementById("sp-menu-browser");
|
||||
document.getElementById("sp-menu-content").removeAttribute("checked");
|
||||
chrome.setAttribute("checked", true);
|
||||
this.statusbarStatus.label = chrome.getAttribute("label");
|
||||
this.executionContext = SCRATCHPAD_CONTEXT_CHROME;
|
||||
browser.setAttribute("checked", true);
|
||||
this.executionContext = SCRATCHPAD_CONTEXT_BROWSER;
|
||||
this.statusbarStatus.label = browser.getAttribute("label");
|
||||
this.resetContext();
|
||||
},
|
||||
|
||||
@ -584,6 +594,8 @@ var Scratchpad = {
|
||||
this._chromeSandbox = null;
|
||||
this._contentSandbox = null;
|
||||
this._previousWindow = null;
|
||||
this._previousBrowser = null;
|
||||
this._previousLocation = null;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -604,10 +616,10 @@ var Scratchpad = {
|
||||
*/
|
||||
onLoad: function SP_onLoad()
|
||||
{
|
||||
let chromeContextMenu = document.getElementById("sp-menu-chrome");
|
||||
let chromeContextMenu = document.getElementById("sp-menu-browser");
|
||||
let errorConsoleMenu = document.getElementById("sp-menu-errorConsole");
|
||||
let errorConsoleCommand = document.getElementById("sp-cmd-errorConsole");
|
||||
let chromeContextCommand = document.getElementById("sp-cmd-chromeContext");
|
||||
let chromeContextCommand = document.getElementById("sp-cmd-browserContext");
|
||||
|
||||
let chrome = Services.prefs.getBoolPref(DEVTOOLS_CHROME_ENABLED);
|
||||
if (chrome) {
|
||||
@ -616,6 +628,7 @@ var Scratchpad = {
|
||||
errorConsoleCommand.removeAttribute("disabled");
|
||||
chromeContextCommand.removeAttribute("disabled");
|
||||
}
|
||||
this.insertIntro();
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -70,11 +70,11 @@
|
||||
-->
|
||||
|
||||
<command id="sp-cmd-close" oncommand="window.close();"/>
|
||||
<command id="sp-cmd-execute" oncommand="Scratchpad.execute();"/>
|
||||
<command id="sp-cmd-run" oncommand="Scratchpad.run();"/>
|
||||
<command id="sp-cmd-inspect" oncommand="Scratchpad.inspect();"/>
|
||||
<command id="sp-cmd-print" oncommand="Scratchpad.print();"/>
|
||||
<command id="sp-cmd-display" oncommand="Scratchpad.display();"/>
|
||||
<command id="sp-cmd-contentContext" oncommand="Scratchpad.setContentContext();"/>
|
||||
<command id="sp-cmd-chromeContext" oncommand="Scratchpad.setChromeContext();" disabled="true"/>
|
||||
<command id="sp-cmd-browserContext" oncommand="Scratchpad.setBrowserContext();" disabled="true"/>
|
||||
<command id="sp-cmd-resetContext" oncommand="Scratchpad.resetContext();"/>
|
||||
<command id="sp-cmd-errorConsole" oncommand="Scratchpad.openErrorConsole();" disabled="true"/>
|
||||
<command id="sp-cmd-webConsole" oncommand="Scratchpad.openWebConsole();"/>
|
||||
@ -118,17 +118,17 @@
|
||||
<key id="key_selectAll" key="&selectAllCmd.key;" modifiers="accel"/>
|
||||
<key id="key_undo" key="&undoCmd.key;" modifiers="accel"/>
|
||||
<key id="key_redo" key="&undoCmd.key;" modifiers="accel,shift"/>
|
||||
<key id="sp-key-execute"
|
||||
key="&execute.key;"
|
||||
command="sp-cmd-execute"
|
||||
<key id="sp-key-run"
|
||||
key="&run.key;"
|
||||
command="sp-cmd-run"
|
||||
modifiers="accel"/>
|
||||
<key id="sp-key-inspect"
|
||||
key="&inspect.key;"
|
||||
command="sp-cmd-inspect"
|
||||
modifiers="accel"/>
|
||||
<key id="sp-key-print"
|
||||
key="&print.key;"
|
||||
command="sp-cmd-print"
|
||||
<key id="sp-key-display"
|
||||
key="&display.key;"
|
||||
command="sp-cmd-display"
|
||||
modifiers="accel"/>
|
||||
<key id="sp-key-errorConsole"
|
||||
key="&errorConsoleCmd.commandkey;"
|
||||
@ -220,7 +220,6 @@
|
||||
key="key_selectAll"
|
||||
accesskey="&selectAllCmd.accesskey;"
|
||||
command="cmd_selectAll"/>
|
||||
<menuseparator/>
|
||||
|
||||
<!-- TODO: bug 650345 - implement search and replace
|
||||
<menuitem id="sp-menu-find"
|
||||
@ -238,38 +237,44 @@
|
||||
<menuseparator id="sp-execute-separator"/>
|
||||
-->
|
||||
|
||||
<menuitem id="sp-text-execute"
|
||||
label="&execute.label;"
|
||||
accesskey="&execute.accesskey;"
|
||||
key="sp-key-execute"
|
||||
command="sp-cmd-execute"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menu id="sp-execute-menu" label="&executeMenu.label;"
|
||||
accesskey="&executeMenu.accesskey;">
|
||||
<menupopup id="sp-menu_executepopup">
|
||||
<menuitem id="sp-text-run"
|
||||
label="&run.label;"
|
||||
accesskey="&run.accesskey;"
|
||||
key="sp-key-run"
|
||||
command="sp-cmd-run"/>
|
||||
<menuitem id="sp-text-inspect"
|
||||
label="&inspect.label;"
|
||||
accesskey="&inspect.accesskey;"
|
||||
key="sp-key-inspect"
|
||||
command="sp-cmd-inspect"/>
|
||||
<menuitem id="sp-text-print"
|
||||
label="&print.label;"
|
||||
accesskey="&print.accesskey;"
|
||||
key="sp-key-print"
|
||||
command="sp-cmd-print"/>
|
||||
<menuitem id="sp-text-display"
|
||||
label="&display.label;"
|
||||
accesskey="&display.accesskey;"
|
||||
key="sp-key-display"
|
||||
command="sp-cmd-display"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menu id="sp-context-menu"
|
||||
label="&contextMenu.label;"
|
||||
accesskey="&contextMenu.accesskey;">
|
||||
<menupopup id="sp-menu-context">
|
||||
<menu id="sp-environment-menu"
|
||||
label="&environmentMenu.label;"
|
||||
accesskey="&environmentMenu.accesskey;">
|
||||
<menupopup id="sp-menu-environment">
|
||||
<menuitem id="sp-menu-content"
|
||||
label="&contentContext.label;"
|
||||
accesskey="&contentContext.accesskey;"
|
||||
command="sp-cmd-contentContext"
|
||||
checked="true"
|
||||
type="radio"/>
|
||||
<menuitem id="sp-menu-chrome" hidden="true"
|
||||
command="sp-cmd-chromeContext"
|
||||
label="&chromeContext.label;"
|
||||
accesskey="&chromeContext.accesskey;"
|
||||
<menuitem id="sp-menu-browser" hidden="true"
|
||||
command="sp-cmd-browserContext"
|
||||
label="&browserContext.label;"
|
||||
accesskey="&browserContext.accesskey;"
|
||||
type="radio"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="sp-menu-resetContext"
|
||||
@ -306,21 +311,21 @@
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_selectAll"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="sp-text-execute"
|
||||
label="&execute.label;"
|
||||
accesskey="&execute.accesskey;"
|
||||
key="sp-key-execute"
|
||||
command="sp-cmd-execute"/>
|
||||
<menuitem id="sp-text-run"
|
||||
label="&run.label;"
|
||||
accesskey="&run.accesskey;"
|
||||
key="sp-key-run"
|
||||
command="sp-cmd-run"/>
|
||||
<menuitem id="sp-text-inspect"
|
||||
label="&inspect.label;"
|
||||
accesskey="&inspect.accesskey;"
|
||||
key="sp-key-inspect"
|
||||
command="sp-cmd-inspect"/>
|
||||
<menuitem id="sp-text-print"
|
||||
label="&print.label;"
|
||||
accesskey="&print.accesskey;"
|
||||
key="sp-key-print"
|
||||
command="sp-cmd-print"/>
|
||||
<menuitem id="sp-text-display"
|
||||
label="&display.label;"
|
||||
accesskey="&display.accesskey;"
|
||||
key="sp-key-display"
|
||||
command="sp-cmd-display"/>
|
||||
</menupopup>
|
||||
</popupset>
|
||||
|
||||
@ -328,7 +333,7 @@
|
||||
multiline="true"
|
||||
flex="1"
|
||||
context="scratchpad-text-popup"
|
||||
placeholder="&textbox.placeholder;" />
|
||||
placeholder="&textbox.placeholder1;" />
|
||||
<statusbar id="scratchpad-statusbar" align="end">
|
||||
<statusbarpanel id="scratchpad-status"
|
||||
label="&contentContext.label;"
|
||||
|
@ -2902,7 +2902,7 @@
|
||||
tabWidth += "px";
|
||||
for (let i = numPinned; i < tabs.length; i++) {
|
||||
let tab = tabs[i];
|
||||
tab.style.maxWidth = tabWidth;
|
||||
tab.style.setProperty("max-width", tabWidth, "important");
|
||||
if (!isEndTab) { // keep tabs the same width
|
||||
tab.style.MozTransition = "none";
|
||||
tab.clientTop; // flush styles to skip animation; see bug 649247
|
||||
|
@ -194,6 +194,7 @@ _BROWSER_FILES = \
|
||||
browser_inspector_treePanel_result.html \
|
||||
browser_scratchpad_initialization.js \
|
||||
browser_scratchpad_contexts.js \
|
||||
browser_scratchpad_tab_switch.js \
|
||||
browser_scratchpad_execute_print.js \
|
||||
browser_scratchpad_inspect.js \
|
||||
browser_scratchpad_files.js \
|
||||
|
@ -36,7 +36,7 @@ function runTests()
|
||||
ok(sp, "Scratchpad object exists in new window");
|
||||
|
||||
let chromeContextMenu = gScratchpadWindow.document.
|
||||
getElementById("sp-menu-chrome");
|
||||
getElementById("sp-menu-browser");
|
||||
ok(chromeContextMenu, "Chrome context menuitem element exists");
|
||||
ok(!chromeContextMenu.hasAttribute("hidden"),
|
||||
"Chrome context menuitem is visible");
|
||||
@ -54,7 +54,7 @@ function runTests()
|
||||
"Error console menuitem is visible");
|
||||
|
||||
let chromeContextCommand = gScratchpadWindow.document.
|
||||
getElementById("sp-cmd-chromeContext");
|
||||
getElementById("sp-cmd-browserContext");
|
||||
ok(chromeContextCommand, "Chrome context command element exists");
|
||||
ok(!chromeContextCommand.hasAttribute("disabled"),
|
||||
"Chrome context command is disabled");
|
||||
|
@ -27,11 +27,11 @@ function runTests()
|
||||
let sp = gScratchpadWindow.Scratchpad;
|
||||
|
||||
let contentMenu = gScratchpadWindow.document.getElementById("sp-menu-content");
|
||||
let chromeMenu = gScratchpadWindow.document.getElementById("sp-menu-chrome");
|
||||
let chromeMenu = gScratchpadWindow.document.getElementById("sp-menu-browser");
|
||||
let statusbar = sp.statusbarStatus;
|
||||
|
||||
ok(contentMenu, "found #sp-menu-content");
|
||||
ok(chromeMenu, "found #sp-menu-chrome");
|
||||
ok(chromeMenu, "found #sp-menu-browser");
|
||||
ok(statusbar, "found Scratchpad.statusbarStatus");
|
||||
|
||||
sp.setContentContext();
|
||||
@ -54,14 +54,14 @@ function runTests()
|
||||
ok(!content.wrappedJSObject.foobarBug636725,
|
||||
"no content.foobarBug636725");
|
||||
|
||||
sp.execute();
|
||||
sp.run();
|
||||
|
||||
is(content.wrappedJSObject.foobarBug636725, "aloha",
|
||||
"content.foobarBug636725 has been set");
|
||||
|
||||
sp.setChromeContext();
|
||||
sp.setBrowserContext();
|
||||
|
||||
is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CHROME,
|
||||
is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_BROWSER,
|
||||
"executionContext is chrome");
|
||||
|
||||
is(chromeMenu.getAttribute("checked"), "true",
|
||||
@ -77,37 +77,37 @@ function runTests()
|
||||
|
||||
ok(!window.foobarBug636725, "no window.foobarBug636725");
|
||||
|
||||
sp.execute();
|
||||
sp.run();
|
||||
|
||||
is(window.foobarBug636725, "aloha2", "window.foobarBug636725 has been set");
|
||||
|
||||
sp.textbox.value = "window.gBrowser";
|
||||
|
||||
is(typeof sp.execute()[1].addTab, "function",
|
||||
is(typeof sp.run()[1].addTab, "function",
|
||||
"chrome context has access to chrome objects");
|
||||
|
||||
// Check that the sandbox is cached.
|
||||
|
||||
sp.textbox.value = "typeof foobarBug636725cache;";
|
||||
is(sp.execute()[1], "undefined", "global variable does not exist");
|
||||
is(sp.run()[1], "undefined", "global variable does not exist");
|
||||
|
||||
sp.textbox.value = "var foobarBug636725cache = 'foo';";
|
||||
sp.execute();
|
||||
sp.run();
|
||||
|
||||
sp.textbox.value = "typeof foobarBug636725cache;";
|
||||
is(sp.execute()[1], "string",
|
||||
is(sp.run()[1], "string",
|
||||
"global variable exists across two different executions");
|
||||
|
||||
sp.resetContext();
|
||||
|
||||
is(sp.execute()[1], "undefined",
|
||||
is(sp.run()[1], "undefined",
|
||||
"global variable no longer exists after calling resetContext()");
|
||||
|
||||
sp.textbox.value = "var foobarBug636725cache2 = 'foo';";
|
||||
sp.execute();
|
||||
sp.run();
|
||||
|
||||
sp.textbox.value = "typeof foobarBug636725cache2;";
|
||||
is(sp.execute()[1], "string",
|
||||
is(sp.run()[1], "string",
|
||||
"global variable exists across two different executions");
|
||||
|
||||
sp.setContentContext();
|
||||
@ -115,7 +115,7 @@ function runTests()
|
||||
is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT,
|
||||
"executionContext is content");
|
||||
|
||||
is(sp.execute()[1], "undefined",
|
||||
is(sp.run()[1], "undefined",
|
||||
"global variable no longer exists after changing the context");
|
||||
|
||||
gScratchpadWindow.close();
|
||||
|
@ -17,7 +17,7 @@ function test()
|
||||
gScratchpadWindow.addEventListener("load", runTests, false);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,<p>test execute() and print() in Scratchpad";
|
||||
content.location = "data:text/html,<p>test run() and display() in Scratchpad";
|
||||
}
|
||||
|
||||
function runTests()
|
||||
@ -31,7 +31,7 @@ function runTests()
|
||||
ok(sp.textbox, "textbox exists");
|
||||
sp.textbox.value = "++window.foobarBug636725";
|
||||
|
||||
let exec = sp.execute();
|
||||
let exec = sp.run();
|
||||
is(exec[0], sp.textbox.value, "execute()[0] is correct");
|
||||
is(exec[1], content.wrappedJSObject.foobarBug636725,
|
||||
"execute()[1] is correct");
|
||||
@ -42,7 +42,7 @@ function runTests()
|
||||
is(content.wrappedJSObject.foobarBug636725, 2,
|
||||
"execute() updated window.foobarBug636725");
|
||||
|
||||
sp.print();
|
||||
sp.display();
|
||||
|
||||
is(content.wrappedJSObject.foobarBug636725, 3,
|
||||
"print() updated window.foobarBug636725");
|
||||
@ -69,7 +69,7 @@ function runTests()
|
||||
is(sp.textbox.selectionStart, 0, "selectionStart is 0");
|
||||
is(sp.textbox.selectionEnd, 29, "selectionEnd is 29");
|
||||
|
||||
exec = sp.execute();
|
||||
exec = sp.run();
|
||||
|
||||
is(exec[0], "window.foobarBug636725 = 'a';",
|
||||
"execute()[0] is correct");
|
||||
@ -88,7 +88,7 @@ function runTests()
|
||||
|
||||
sp.selectRange(0, 22);
|
||||
|
||||
sp.print();
|
||||
sp.display();
|
||||
|
||||
is(content.wrappedJSObject.foobarBug636725, "a",
|
||||
"print() worked for the selected range");
|
||||
|
@ -28,12 +28,12 @@ function runTests()
|
||||
|
||||
let sp = gScratchpadWindow.Scratchpad;
|
||||
ok(sp, "Scratchpad object exists in new window");
|
||||
is(typeof sp.execute, "function", "Scratchpad.execute() exists");
|
||||
is(typeof sp.run, "function", "Scratchpad.run() exists");
|
||||
is(typeof sp.inspect, "function", "Scratchpad.inspect() exists");
|
||||
is(typeof sp.print, "function", "Scratchpad.print() exists");
|
||||
is(typeof sp.display, "function", "Scratchpad.display() exists");
|
||||
|
||||
let chromeContextMenu = gScratchpadWindow.document.
|
||||
getElementById("sp-menu-chrome");
|
||||
getElementById("sp-menu-browser");
|
||||
ok(chromeContextMenu, "Chrome context menuitem element exists");
|
||||
is(chromeContextMenu.getAttribute("hidden"), "true",
|
||||
"Chrome context menuitem is hidden");
|
||||
@ -51,7 +51,7 @@ function runTests()
|
||||
"Error console menu item is hidden");
|
||||
|
||||
let chromeContextCommand = gScratchpadWindow.document.
|
||||
getElementById("sp-cmd-chromeContext");
|
||||
getElementById("sp-cmd-browserContext");
|
||||
ok(chromeContextCommand, "Chrome context command element exists");
|
||||
is(chromeContextCommand.getAttribute("disabled"), "true",
|
||||
"Chrome context command is disabled");
|
||||
|
111
browser/base/content/test/browser_scratchpad_tab_switch.js
Normal file
111
browser/base/content/test/browser_scratchpad_tab_switch.js
Normal file
@ -0,0 +1,111 @@
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Reference to the Scratchpad chrome window object.
|
||||
let gScratchpadWindow;
|
||||
let tab1;
|
||||
let tab2;
|
||||
let sp;
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
|
||||
tab1 = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab1;
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
tab2 = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab2;
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
gScratchpadWindow = Scratchpad.openScratchpad();
|
||||
gScratchpadWindow.addEventListener("load", runTests, false);
|
||||
}, true);
|
||||
content.location = "data:text/html,test context switch in Scratchpad tab 2";
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,test context switch in Scratchpad tab 1";
|
||||
}
|
||||
|
||||
function runTests()
|
||||
{
|
||||
gScratchpadWindow.removeEventListener("load", runTests, true);
|
||||
|
||||
sp = gScratchpadWindow.Scratchpad;
|
||||
|
||||
let contentMenu = gScratchpadWindow.document.getElementById("sp-menu-content");
|
||||
let browserMenu = gScratchpadWindow.document.getElementById("sp-menu-browser");
|
||||
let statusbar = sp.statusbarStatus;
|
||||
|
||||
ok(contentMenu, "found #sp-menu-content");
|
||||
ok(browserMenu, "found #sp-menu-browser");
|
||||
ok(statusbar, "found Scratchpad.statusbarStatus");
|
||||
|
||||
sp.setContentContext();
|
||||
|
||||
is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT,
|
||||
"executionContext is content");
|
||||
|
||||
is(contentMenu.getAttribute("checked"), "true",
|
||||
"content menuitem is checked");
|
||||
|
||||
ok(!browserMenu.hasAttribute("checked"),
|
||||
"chrome menuitem is not checked");
|
||||
|
||||
is(statusbar.getAttribute("label"), contentMenu.getAttribute("label"),
|
||||
"statusbar label is correct");
|
||||
|
||||
ok(sp.textbox, "textbox exists");
|
||||
sp.textbox.value = "window.foosbug653108 = 'aloha';";
|
||||
|
||||
ok(!content.wrappedJSObject.foosbug653108,
|
||||
"no content.foosbug653108");
|
||||
|
||||
sp.run();
|
||||
|
||||
is(content.wrappedJSObject.foosbug653108, "aloha",
|
||||
"content.foosbug653108 has been set");
|
||||
|
||||
gBrowser.tabContainer.addEventListener("TabSelect", runTests2, true);
|
||||
gBrowser.selectedTab = tab1;
|
||||
}
|
||||
|
||||
function runTests2() {
|
||||
gBrowser.tabContainer.removeEventListener("TabSelect", runTests2, true);
|
||||
|
||||
ok(!window.foosbug653108, "no window.foosbug653108");
|
||||
|
||||
sp.textbox.value = "window.foosbug653108";
|
||||
let result = sp.run();
|
||||
|
||||
isnot(result, "aloha", "window.foosbug653108 is not aloha");
|
||||
|
||||
sp.textbox.value = "window.foosbug653108 = 'ahoyhoy';";
|
||||
sp.run();
|
||||
|
||||
is(content.wrappedJSObject.foosbug653108, "ahoyhoy",
|
||||
"content.foosbug653108 has been set 2");
|
||||
|
||||
gBrowser.selectedBrowser.addEventListener("load", runTests3, true);
|
||||
content.location = "data:text/html,test context switch in Scratchpad location 2";
|
||||
}
|
||||
|
||||
function runTests3() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", runTests3, true);
|
||||
// Check that the sandbox is not cached.
|
||||
|
||||
sp.textbox.value = "typeof foosbug653108;";
|
||||
is(sp.run()[1], "undefined", "global variable does not exist");
|
||||
|
||||
gScratchpadWindow.close();
|
||||
gScratchpadWindow = null;
|
||||
tab1 = null;
|
||||
tab2 = null;
|
||||
sp = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
@ -33,10 +33,11 @@ function runTests()
|
||||
"sp-menu-open": "openFile",
|
||||
"sp-menu-save": "saveFile",
|
||||
"sp-menu-saveas": "saveFileAs",
|
||||
"sp-text-execute": "execute",
|
||||
"sp-text-run": "run",
|
||||
"sp-text-inspect": "inspect",
|
||||
"sp-text-display": "display",
|
||||
"sp-menu-content": "setContentContext",
|
||||
"sp-menu-chrome": "setChromeContext",
|
||||
"sp-menu-browser": "setBrowserContext",
|
||||
"sp-menu-resetContext": "resetContext",
|
||||
"sp-menu-errorConsole": "openErrorConsole",
|
||||
"sp-menu-webConsole": "openWebConsole",
|
||||
|
@ -61,33 +61,58 @@
|
||||
<!ENTITY selectAllCmd.key "A">
|
||||
<!ENTITY selectAllCmd.accesskey "A">
|
||||
|
||||
<!ENTITY execute.label "Execute">
|
||||
<!ENTITY execute.accesskey "E">
|
||||
<!ENTITY execute.key "t">
|
||||
<!ENTITY run.label "Run">
|
||||
<!ENTITY run.accesskey "R">
|
||||
<!ENTITY run.key "r">
|
||||
|
||||
<!ENTITY inspect.label "Inspect">
|
||||
<!ENTITY inspect.accesskey "I">
|
||||
<!ENTITY inspect.key "i">
|
||||
|
||||
<!ENTITY print.label "Print">
|
||||
<!ENTITY print.accesskey "p">
|
||||
<!ENTITY print.key "r">
|
||||
<!ENTITY display.label "Display">
|
||||
<!ENTITY display.accesskey "D">
|
||||
<!ENTITY display.key "l">
|
||||
|
||||
<!-- LOCALIZATION NOTE (environmentMenu.label, accesskey): This menu item was
|
||||
- renamed from "Context" to avoid confusion with the right-click context
|
||||
- menu in the text area. It refers to the JavaScript Environment (or context)
|
||||
- the user is evaluating against. I.e., Content (current tab) or Chrome
|
||||
- (browser).
|
||||
-->
|
||||
<!ENTITY environmentMenu.label "Environment">
|
||||
<!ENTITY environmentMenu.accesskey "N">
|
||||
|
||||
<!-- LOCALIZATION NOTE (contextMenu.label, accesskey): No longer used.
|
||||
<!ENTITY contextMenu.label "Context">
|
||||
<!ENTITY contextMenu.accesskey "C">
|
||||
-->
|
||||
|
||||
<!ENTITY contentContext.label "Content">
|
||||
<!ENTITY contentContext.accesskey "C">
|
||||
|
||||
<!-- LOCALIZATION NOTE (browserContext.label, accesskey): This menu item is used
|
||||
- to select an execution environment for the browser window itself as opposed
|
||||
- to content. This is a feature for browser and addon developers and only
|
||||
- enabled via the devtools.chrome.enabled preference. Formerly, this label
|
||||
- was called "Chrome".
|
||||
-->
|
||||
<!ENTITY browserContext.label "Browser">
|
||||
<!ENTITY browserContext.accesskey "B">
|
||||
|
||||
<!-- LOCALIZATION NOTE (chromeContext.label, accesskey): No longer used.
|
||||
<!ENTITY chromeContext.label "Chrome">
|
||||
<!ENTITY chromeContext.accesskey "H">
|
||||
-->
|
||||
|
||||
<!-- LOCALIZATION NOTE (resetContext.label): This command allows the developer
|
||||
- to reset/clear the global object of the context where the code executes.
|
||||
- to reset/clear the global object of the environment where the code executes.
|
||||
-->
|
||||
<!ENTITY resetContext.label "Reset">
|
||||
<!ENTITY resetContext.accesskey "R">
|
||||
|
||||
<!ENTITY executeMenu.label "Execute">
|
||||
<!ENTITY executeMenu.accesskey "X">
|
||||
|
||||
<!ENTITY toolsMenu.label "Tools">
|
||||
<!ENTITY toolsMenu.accesskey "T">
|
||||
|
||||
@ -99,5 +124,9 @@
|
||||
<!ENTITY webConsoleCmd.accesskey "W">
|
||||
<!ENTITY webConsoleCmd.commandkey "k">
|
||||
|
||||
<!ENTITY textbox.placeholder "// Enter some JavaScript, select it, right click and select Execute, Inspect or Print.">
|
||||
<!-- LOCALIZATION NOTE (textbox.placeholder1): This is some placeholder text
|
||||
- that appears when the Scratchpad's text area is empty and unfocused.
|
||||
- It should be a one-line JavaScript comment, i.e., preceded by '//'
|
||||
-->
|
||||
<!ENTITY textbox.placeholder1 "// Enter some JavaScript, select it, right click and select Run, Inspect or Display.">
|
||||
|
||||
|
@ -28,3 +28,8 @@ saveFileAs=Save File As
|
||||
# LOCALIZATION NOTE (saveFile.failed): This is the message displayed when file
|
||||
# save fails.
|
||||
saveFile.failed=The file save operation failed.
|
||||
|
||||
# LOCALIZATION NOTE (scratchpadIntro): This is a multi-line comment explaining
|
||||
# how to use the Scratchpad. Note that this should be a valid JavaScript
|
||||
# comment inside /* and */.
|
||||
scratchpadIntro=/*\n * This is a JavaScript Scratchpad.\n *\n * Enter some JavaScript, then Right Click or choose from the Execute Menu:\n * 1. Run to evaluate the selected text,\n * 2. Inspect to bring up an Object Inspector on the result, or,\n * 3. Display to insert the result in a comment after the selection.\n */\n\n
|
||||
|
@ -441,20 +441,23 @@ function FindProxyForURL(url, host)
|
||||
var isHttp = matches[1] == 'http';
|
||||
var isHttps = matches[1] == 'https';
|
||||
var isWebSocket = matches[1] == 'ws';
|
||||
var isWebSocketSSL = matches[1] == 'wss';
|
||||
if (!matches[3])
|
||||
{
|
||||
if (isHttp | isWebSocket) matches[3] = '80';
|
||||
if (isHttps) matches[3] = '443';
|
||||
if (isHttps | isWebSocketSSL) matches[3] = '443';
|
||||
}
|
||||
if (isWebSocket)
|
||||
matches[1] = 'http';
|
||||
if (isWebSocketSSL)
|
||||
matches[1] = 'https';
|
||||
|
||||
var origin = matches[1] + '://' + matches[2] + ':' + matches[3];
|
||||
if (origins.indexOf(origin) < 0)
|
||||
return 'DIRECT';
|
||||
if (isHttp)
|
||||
return 'PROXY %(remote)s:%(httpport)s';
|
||||
if (isHttps || isWebSocket)
|
||||
if (isHttps || isWebSocket || isWebSocketSSL)
|
||||
return 'PROXY %(remote)s:%(sslport)s';
|
||||
return 'DIRECT';
|
||||
}""" % { "origins": origins,
|
||||
|
@ -150,6 +150,19 @@ nsNullPrincipalURI::SetPath(const nsACString &aPath)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipalURI::GetRef(nsACString &_ref)
|
||||
{
|
||||
_ref.Truncate();
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipalURI::SetRef(const nsACString &aRef)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipalURI::GetPrePath(nsACString &_prePath)
|
||||
{
|
||||
@ -224,11 +237,18 @@ nsNullPrincipalURI::Clone(nsIURI **_newURI)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri =
|
||||
new nsNullPrincipalURI(mScheme + NS_LITERAL_CSTRING(":") + mPath);
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_OUT_OF_MEMORY);
|
||||
uri.forget(_newURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipalURI::CloneIgnoringRef(nsIURI **_newURI)
|
||||
{
|
||||
// GetRef/SetRef not supported by nsNullPrincipalURI, so
|
||||
// CloneIgnoringRef() is the same as Clone().
|
||||
return Clone(_newURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipalURI::Equals(nsIURI *aOther, PRBool *_equals)
|
||||
{
|
||||
@ -243,6 +263,14 @@ nsNullPrincipalURI::Equals(nsIURI *aOther, PRBool *_equals)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipalURI::EqualsExceptRef(nsIURI *aOther, PRBool *_equals)
|
||||
{
|
||||
// GetRef/SetRef not supported by nsNullPrincipalURI, so
|
||||
// EqualsExceptRef() is the same as Equals().
|
||||
return Equals(aOther, _equals);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipalURI::Resolve(const nsACString &aRelativePath,
|
||||
nsACString &_resolvedURI)
|
||||
|
@ -2027,8 +2027,8 @@ case "$target" in
|
||||
MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
|
||||
fi
|
||||
_PEDANTIC=
|
||||
CFLAGS="$CFLAGS -fpascal-strings -fno-common"
|
||||
CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
|
||||
CFLAGS="$CFLAGS -fno-common"
|
||||
CXXFLAGS="$CXXFLAGS -fno-common"
|
||||
DLL_SUFFIX=".dylib"
|
||||
DSO_LDOPTS=''
|
||||
STRIP="$STRIP -x -S"
|
||||
@ -4861,7 +4861,7 @@ NSS_DISABLE_DBM=
|
||||
NECKO_WIFI=1
|
||||
NECKO_COOKIES=1
|
||||
NECKO_DISK_CACHE=1
|
||||
NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource wyciwyg"
|
||||
NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg"
|
||||
USE_ARM_KUSER=
|
||||
BUILD_CTYPES=1
|
||||
XPC_IDISPATCH_SUPPORT=
|
||||
|
@ -51,10 +51,11 @@ interface nsPIDOMWindow;
|
||||
* http://dev.w3.org/html5/websockets/
|
||||
*
|
||||
*/
|
||||
[scriptable, uuid(4403cd57-07fc-477f-a062-d6ba7dd0781b)]
|
||||
[scriptable, uuid(431aea4c-568a-470e-b876-c57a29ff0fc6)]
|
||||
interface nsIWebSocket : nsISupports
|
||||
{
|
||||
readonly attribute DOMString url;
|
||||
readonly attribute DOMString protocol;
|
||||
|
||||
//ready state
|
||||
const unsigned short CONNECTING = 0;
|
||||
|
@ -307,13 +307,12 @@ nsresult
|
||||
Link::SetHash(const nsAString &aHash)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri(GetURIToMutate());
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
|
||||
if (!url) {
|
||||
if (!uri) {
|
||||
// Ignore failures to be compatible with NS4.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
(void)url->SetRef(NS_ConvertUTF16toUTF8(aHash));
|
||||
(void)uri->SetRef(NS_ConvertUTF16toUTF8(aHash));
|
||||
SetHrefAttribute(uri);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -444,15 +443,14 @@ Link::GetHash(nsAString &_hash)
|
||||
_hash.Truncate();
|
||||
|
||||
nsCOMPtr<nsIURI> uri(GetURI());
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
|
||||
if (!url) {
|
||||
// Do not throw! Not having a valid URI or URL should result in an empty
|
||||
if (!uri) {
|
||||
// Do not throw! Not having a valid URI should result in an empty
|
||||
// string.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCAutoString ref;
|
||||
nsresult rv = url->GetRef(ref);
|
||||
nsresult rv = uri->GetRef(ref);
|
||||
if (NS_SUCCEEDED(rv) && !ref.IsEmpty()) {
|
||||
NS_UnescapeURL(ref); // XXX may result in random non-ASCII bytes!
|
||||
_hash.Assign(PRUnichar('#'));
|
||||
|
@ -694,14 +694,10 @@ nsExternalResourceMap::RequestResource(nsIURI* aURI,
|
||||
|
||||
// First, make sure we strip the ref from aURI.
|
||||
nsCOMPtr<nsIURI> clone;
|
||||
aURI->Clone(getter_AddRefs(clone));
|
||||
if (!clone) {
|
||||
nsresult rv = aURI->CloneIgnoringRef(getter_AddRefs(clone));
|
||||
if (NS_FAILED(rv) || !clone) {
|
||||
return nsnull;
|
||||
}
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(clone));
|
||||
if (url) {
|
||||
url->SetRef(EmptyCString());
|
||||
}
|
||||
|
||||
ExternalResource* resource;
|
||||
mMap.Get(clone, &resource);
|
||||
@ -712,14 +708,11 @@ nsExternalResourceMap::RequestResource(nsIURI* aURI,
|
||||
nsRefPtr<PendingLoad> load;
|
||||
mPendingLoads.Get(clone, getter_AddRefs(load));
|
||||
if (load) {
|
||||
NS_ADDREF(*aPendingLoad = load);
|
||||
load.forget(aPendingLoad);
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
load = new PendingLoad(aDisplayDocument);
|
||||
if (!load) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (!mPendingLoads.Put(clone, load)) {
|
||||
return nsnull;
|
||||
@ -730,7 +723,7 @@ nsExternalResourceMap::RequestResource(nsIURI* aURI,
|
||||
// chances are it failed for good reasons (security check, etc).
|
||||
AddExternalResource(clone, nsnull, nsnull, aDisplayDocument);
|
||||
} else {
|
||||
NS_ADDREF(*aPendingLoad = load);
|
||||
load.forget(aPendingLoad);
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
|
@ -147,12 +147,15 @@ public:
|
||||
NS_DECL_NSISERIALIZABLE
|
||||
NS_DECL_NSICLASSINFO
|
||||
|
||||
// Override Clone() and Equals()
|
||||
NS_IMETHOD Clone(nsIURI** aClone);
|
||||
NS_IMETHOD Equals(nsIURI* aOther, PRBool *aResult);
|
||||
// Override CloneInternal() and EqualsInternal()
|
||||
virtual nsresult CloneInternal(RefHandlingEnum aRefHandlingMode,
|
||||
nsIURI** aClone);
|
||||
virtual nsresult EqualsInternal(nsIURI* aOther,
|
||||
RefHandlingEnum aRefHandlingMode,
|
||||
PRBool* aResult);
|
||||
|
||||
// Override StartClone to hand back a nsFileDataURI
|
||||
virtual nsSimpleURI* StartClone()
|
||||
virtual nsSimpleURI* StartClone(RefHandlingEnum /* unused */)
|
||||
{ return new nsFileDataURI(); }
|
||||
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
@ -213,12 +216,13 @@ nsFileDataURI::Write(nsIObjectOutputStream* aStream)
|
||||
}
|
||||
|
||||
// nsIURI methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileDataURI::Clone(nsIURI** aClone)
|
||||
nsresult
|
||||
nsFileDataURI::CloneInternal(nsSimpleURI::RefHandlingEnum aRefHandlingMode,
|
||||
nsIURI** aClone)
|
||||
{
|
||||
nsCOMPtr<nsIURI> simpleClone;
|
||||
nsresult rv = nsSimpleURI::Clone(getter_AddRefs(simpleClone));
|
||||
nsresult rv =
|
||||
nsSimpleURI::CloneInternal(aRefHandlingMode, getter_AddRefs(simpleClone));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -236,8 +240,10 @@ nsFileDataURI::Clone(nsIURI** aClone)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileDataURI::Equals(nsIURI* aOther, PRBool *aResult)
|
||||
/* virtual */ nsresult
|
||||
nsFileDataURI::EqualsInternal(nsIURI* aOther,
|
||||
nsSimpleURI::RefHandlingEnum aRefHandlingMode,
|
||||
PRBool* aResult)
|
||||
{
|
||||
if (!aOther) {
|
||||
*aResult = PR_FALSE;
|
||||
@ -258,7 +264,8 @@ nsFileDataURI::Equals(nsIURI* aOther, PRBool *aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsSimpleURI::Equals(otherFileDataUri, aResult);
|
||||
return nsSimpleURI::EqualsInternal(otherFileDataUri, aRefHandlingMode,
|
||||
aResult);
|
||||
}
|
||||
|
||||
// nsIClassInfo methods:
|
||||
|
@ -1580,18 +1580,6 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI)
|
||||
}
|
||||
|
||||
// Bug 136580: Check for recursive frame loading
|
||||
// pre-grab these for speed
|
||||
nsCOMPtr<nsIURI> cloneURI;
|
||||
rv = aURI->Clone(getter_AddRefs(cloneURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Bug 98158/193011: We need to ignore data after the #
|
||||
nsCOMPtr<nsIURL> cloneURL(do_QueryInterface(cloneURI)); // QI can fail
|
||||
if (cloneURL) {
|
||||
rv = cloneURL->SetRef(EmptyCString());
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
PRInt32 matchCount = 0;
|
||||
treeItem->GetSameTypeParent(getter_AddRefs(parentAsItem));
|
||||
while (parentAsItem) {
|
||||
@ -1602,17 +1590,9 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI)
|
||||
nsCOMPtr<nsIURI> parentURI;
|
||||
parentAsNav->GetCurrentURI(getter_AddRefs(parentURI));
|
||||
if (parentURI) {
|
||||
nsCOMPtr<nsIURI> parentClone;
|
||||
rv = parentURI->Clone(getter_AddRefs(parentClone));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIURL> parentURL(do_QueryInterface(parentClone));
|
||||
if (parentURL) {
|
||||
rv = parentURL->SetRef(EmptyCString());
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// Bug 98158/193011: We need to ignore data after the #
|
||||
PRBool equal;
|
||||
rv = cloneURI->Equals(parentClone, &equal);
|
||||
rv = aURI->EqualsExceptRef(parentURI, &equal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (equal) {
|
||||
|
@ -380,6 +380,7 @@ GK_ATOM(flip, "flip")
|
||||
GK_ATOM(floating, "floating")
|
||||
GK_ATOM(floatList, "Float-list")
|
||||
GK_ATOM(floor, "floor")
|
||||
GK_ATOM(flowlength, "flowlength")
|
||||
GK_ATOM(focus, "focus")
|
||||
GK_ATOM(following, "following")
|
||||
GK_ATOM(followingSibling, "following-sibling")
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsBindingManager.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsIDOMNode.h"
|
||||
@ -48,50 +47,23 @@
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
static PRBool EqualExceptRef(nsIURL* aURL1, nsIURL* aURL2)
|
||||
{
|
||||
nsCOMPtr<nsIURI> u1;
|
||||
nsCOMPtr<nsIURI> u2;
|
||||
|
||||
nsresult rv = aURL1->Clone(getter_AddRefs(u1));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = aURL2->Clone(getter_AddRefs(u2));
|
||||
}
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIURL> url1 = do_QueryInterface(u1);
|
||||
nsCOMPtr<nsIURL> url2 = do_QueryInterface(u2);
|
||||
if (!url1 || !url2) {
|
||||
NS_WARNING("Cloning a URL produced a non-URL");
|
||||
return PR_FALSE;
|
||||
}
|
||||
url1->SetRef(EmptyCString());
|
||||
url2->SetRef(EmptyCString());
|
||||
|
||||
PRBool equal;
|
||||
rv = url1->Equals(url2, &equal);
|
||||
return NS_SUCCEEDED(rv) && equal;
|
||||
}
|
||||
|
||||
void
|
||||
nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI,
|
||||
PRBool aWatch, PRBool aReferenceImage)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aFromContent, "Reset() expects non-null content pointer");
|
||||
NS_ABORT_IF_FALSE(aURI, "Reset() expects non-null URI for referenced elem");
|
||||
|
||||
Unlink();
|
||||
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(aURI);
|
||||
if (!url)
|
||||
return;
|
||||
|
||||
nsCAutoString refPart;
|
||||
url->GetRef(refPart);
|
||||
aURI->GetRef(refPart);
|
||||
// Unescape %-escapes in the reference. The result will be in the
|
||||
// origin charset of the URL, hopefully...
|
||||
NS_UnescapeURL(refPart);
|
||||
|
||||
nsCAutoString charset;
|
||||
url->GetOriginCharset(charset);
|
||||
aURI->GetOriginCharset(charset);
|
||||
nsAutoString ref;
|
||||
nsresult rv = nsContentUtils::ConvertStringFromCharset(charset, refPart, ref);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -109,9 +81,10 @@ nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI,
|
||||
if (bindingParent) {
|
||||
nsXBLBinding* binding = doc->BindingManager()->GetBinding(bindingParent);
|
||||
if (binding) {
|
||||
nsCOMPtr<nsIURL> bindingDocumentURL =
|
||||
do_QueryInterface(binding->PrototypeBinding()->DocURI());
|
||||
if (EqualExceptRef(url, bindingDocumentURL)) {
|
||||
PRBool isEqualExceptRef;
|
||||
rv = aURI->EqualsExceptRef(binding->PrototypeBinding()->DocURI(),
|
||||
&isEqualExceptRef);
|
||||
if (NS_SUCCEEDED(rv) && isEqualExceptRef) {
|
||||
// XXX sXBL/XBL2 issue
|
||||
// Our content is an anonymous XBL element from a binding inside the
|
||||
// same document that the referenced URI points to. In order to avoid
|
||||
@ -139,13 +112,12 @@ nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI,
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURL> documentURL = do_QueryInterface(doc->GetDocumentURI());
|
||||
// We've already checked that |url| is an nsIURL. So if the document URI is
|
||||
// not an nsIURL then |url| is certainly not going to be pointing to the same
|
||||
// document as the document URI.
|
||||
if (!documentURL || !EqualExceptRef(url, documentURL)) {
|
||||
PRBool isEqualExceptRef;
|
||||
rv = aURI->EqualsExceptRef(doc->GetDocumentURI(), &isEqualExceptRef);
|
||||
if (NS_FAILED(rv) || !isEqualExceptRef) {
|
||||
nsRefPtr<nsIDocument::ExternalResourceLoad> load;
|
||||
doc = doc->RequestExternalResource(url, aFromContent, getter_AddRefs(load));
|
||||
doc = doc->RequestExternalResource(aURI, aFromContent,
|
||||
getter_AddRefs(load));
|
||||
if (!doc) {
|
||||
if (!load || !aWatch) {
|
||||
// Nothing will ever happen here
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -50,7 +50,6 @@
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsDOMEventTargetWrapperCache.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIProxiedProtocolHandler.h"
|
||||
|
||||
#define DEFAULT_WS_SCHEME_PORT 80
|
||||
#define DEFAULT_WSS_SCHEME_PORT 443
|
||||
@ -101,8 +100,6 @@ public:
|
||||
PRBool aWantsUntrusted,
|
||||
PRUint8 optional_argc);
|
||||
|
||||
static void ReleaseGlobals();
|
||||
|
||||
// Determine if preferences allow WebSocket
|
||||
static PRBool PrefEnabled();
|
||||
|
||||
@ -116,7 +113,7 @@ protected:
|
||||
nsresult EstablishConnection();
|
||||
|
||||
nsresult CreateAndDispatchSimpleEvent(const nsString& aName);
|
||||
nsresult CreateAndDispatchMessageEvent(nsCString *aData);
|
||||
nsresult CreateAndDispatchMessageEvent(const nsACString& aData);
|
||||
nsresult CreateAndDispatchCloseEvent(PRBool aWasClean);
|
||||
|
||||
// called from mConnection accordingly to the situation
|
||||
@ -147,7 +144,8 @@ protected:
|
||||
nsCString mAsciiHost; // hostname
|
||||
PRUint32 mPort;
|
||||
nsCString mResource; // [filepath[?query]]
|
||||
nsCString mOrigin;
|
||||
nsString mUTF16Origin;
|
||||
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCString mProtocol;
|
||||
|
||||
@ -175,44 +173,4 @@ private:
|
||||
nsWebSocket& operator=(const nsWebSocket& x);
|
||||
};
|
||||
|
||||
#define NS_WSPROTOCOLHANDLER_CONTRACTID \
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ws"
|
||||
|
||||
#define NS_WSSPROTOCOLHANDLER_CONTRACTID \
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "wss"
|
||||
|
||||
#define NS_WSPROTOCOLHANDLER_CID \
|
||||
{ /* a4e6aa3b-b6db-4809-aa11-e292e074cbc4 */ \
|
||||
0xa4e6aa3b, \
|
||||
0xb6db, \
|
||||
0x4809, \
|
||||
{0xaa, 0x11, 0xe2, 0x92, 0xe0, 0x74, 0xcb, 0xc4} \
|
||||
}
|
||||
|
||||
#define NS_WSSPROTOCOLHANDLER_CID \
|
||||
{ /* c6531804-b5c8-4a53-80bf-e339b82d3161 */ \
|
||||
0xc6531804, \
|
||||
0xb5c8, \
|
||||
0x4a53, \
|
||||
{0x80, 0xbf, 0xe3, 0x39, 0xb8, 0x2d, 0x31, 0x61} \
|
||||
}
|
||||
|
||||
class nsWSProtocolHandler: public nsIProxiedProtocolHandler
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROTOCOLHANDLER
|
||||
NS_DECL_NSIPROXIEDPROTOCOLHANDLER
|
||||
|
||||
nsWSProtocolHandler() {};
|
||||
};
|
||||
|
||||
class nsWSSProtocolHandler: public nsWSProtocolHandler
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD GetScheme(nsACString & aScheme);
|
||||
NS_IMETHOD GetDefaultPort(PRInt32 *aDefaultPort);
|
||||
nsWSSProtocolHandler() {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -6,6 +6,9 @@ import sys
|
||||
# see the list of tests in test_websocket.html
|
||||
|
||||
def web_socket_do_extra_handshake(request):
|
||||
# must set request.ws_protocol to the selected version from ws_requested_protocols
|
||||
request.ws_protocol = request.ws_requested_protocols[0]
|
||||
|
||||
if request.ws_protocol == "test 2.1":
|
||||
time.sleep(5)
|
||||
pass
|
||||
@ -42,6 +45,7 @@ def web_socket_transfer_data(request):
|
||||
if msgutil.receive_message(request) == "5":
|
||||
resp = "あいうえお"
|
||||
msgutil.send_message(request, resp.decode('utf-8'))
|
||||
msgutil.close_connection(request)
|
||||
elif request.ws_protocol == "test 7":
|
||||
try:
|
||||
while not request.client_terminated:
|
||||
@ -62,6 +66,9 @@ def web_socket_transfer_data(request):
|
||||
if msgutil.receive_message(request) == "client data":
|
||||
resp = "server data"
|
||||
msgutil.send_message(request, resp.decode('utf-8'))
|
||||
msgutil.close_connection(request)
|
||||
elif request.ws_protocol == "test 12":
|
||||
msgutil.close_connection(request)
|
||||
elif request.ws_protocol == "test 13":
|
||||
# first one binary message containing the byte 0x61 ('a')
|
||||
request.connection.write('\xff\x01\x61')
|
||||
@ -69,7 +76,7 @@ def web_socket_transfer_data(request):
|
||||
request.connection.write('\x01\x61\xff')
|
||||
msgutil.close_connection(request)
|
||||
elif request.ws_protocol == "test 14":
|
||||
request.connection.write('\xff\x00')
|
||||
msgutil.close_connection(request)
|
||||
msgutil.send_message(request, "server data")
|
||||
elif request.ws_protocol == "test 15":
|
||||
msgutil.close_connection(request, True)
|
||||
|
@ -1,6 +1,9 @@
|
||||
from mod_pywebsocket import msgutil
|
||||
|
||||
def web_socket_do_extra_handshake(request):
|
||||
# must set request.ws_protocol to the selected version from ws_requested_protocols
|
||||
request.ws_protocol = request.ws_requested_protocols[0]
|
||||
|
||||
if (request.ws_protocol == 'error'):
|
||||
raise ValueError('Error')
|
||||
pass
|
||||
|
@ -51,7 +51,6 @@ var last_test = 22;
|
||||
var current_test = first_test;
|
||||
|
||||
var timeoutToAbortTest = 60000;
|
||||
var timeoutToOpenWS = 25000;
|
||||
var all_ws = [];
|
||||
|
||||
function shouldNotOpen(e)
|
||||
@ -264,7 +263,7 @@ function test6()
|
||||
ws.onmessage = function(e)
|
||||
{
|
||||
if (counter == 5) {
|
||||
ok(e.data == "あいうえお");
|
||||
ok(e.data == "あいうえお", "test 6 counter 5 data ok");
|
||||
ws.close();
|
||||
doTest(7);
|
||||
} else {
|
||||
@ -278,16 +277,25 @@ function test6()
|
||||
|
||||
function test7()
|
||||
{
|
||||
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 7");
|
||||
ws.onopen = function()
|
||||
{
|
||||
ws.close();
|
||||
}
|
||||
ws.onclose = function(e)
|
||||
{
|
||||
shouldCloseNotCleanly(e);
|
||||
doTest(8);
|
||||
};
|
||||
// with pywebsockets for -06 ths test no longer does anything useful
|
||||
// as the server handles the receipt of the close event directly, not
|
||||
// as part of the wsh - so we cannot fake the non-clean close which is
|
||||
// what we're trying to do here.
|
||||
|
||||
ok(true, "test disabled");
|
||||
current_test++;
|
||||
doTest(8);
|
||||
|
||||
// var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 7");
|
||||
// ws.onopen = function()
|
||||
// {
|
||||
// ws.close();
|
||||
// }
|
||||
// ws.onclose = function(e)
|
||||
// {
|
||||
// shouldCloseNotCleanly(e);
|
||||
// doTest(8);
|
||||
// };
|
||||
}
|
||||
|
||||
function test8()
|
||||
@ -338,21 +346,24 @@ function test10()
|
||||
function test11()
|
||||
{
|
||||
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 11");
|
||||
ok(ws.readyState == 0, "bad readyState in test 11!");
|
||||
ok(ws.readyState == 0, "create bad readyState in test 11!");
|
||||
ws.onopen = function()
|
||||
{
|
||||
ok(ws.readyState == 1, "bad readyState in test 11!");
|
||||
ok(ws.readyState == 1, "open bad readyState in test 11!");
|
||||
ws.send("client data");
|
||||
}
|
||||
ws.onmessage = function(e)
|
||||
{
|
||||
ok(e.data == "server data", "bad received message in test 11!");
|
||||
ws.close();
|
||||
ok(ws.readyState == 2, "bad readyState in test 11!");
|
||||
|
||||
// this ok() is disabled due to a race condition - it state may have
|
||||
// advanced through 2 (closing) and into 3 (closed) before it is evald
|
||||
// ok(ws.readyState == 2, "onmessage bad readyState in test 11!");
|
||||
}
|
||||
ws.onclose = function(e)
|
||||
{
|
||||
ok(ws.readyState == 3, "bad readyState in test 11!");
|
||||
ok(ws.readyState == 3, "onclose bad readyState in test 11!");
|
||||
shouldCloseCleanly(e);
|
||||
doTest(12);
|
||||
}
|
||||
@ -372,23 +383,34 @@ function test12()
|
||||
ok(true, "couldn't send an unpaired surrogate!");
|
||||
}
|
||||
ws.close();
|
||||
|
||||
// there isnt really a server implementation of test 12, so just
|
||||
// ignore an error
|
||||
ws.onerror = function()
|
||||
{
|
||||
}
|
||||
|
||||
doTest(13);
|
||||
};
|
||||
}
|
||||
|
||||
function test13()
|
||||
{
|
||||
// previous versions of this test counted the number of protocol errors returned, but the
|
||||
// protocol stack typically closes down after reporting a protocol level error - trying
|
||||
// to resync is too dangerous
|
||||
|
||||
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 13");
|
||||
ws._timesCalledOnError = 0;
|
||||
ws.onerror = function()
|
||||
{
|
||||
ws._timesCalledOnError++;
|
||||
if (ws._timesCalledOnError == 2) {
|
||||
ok(true, "test 13 succeeded");
|
||||
doTest(14);
|
||||
}
|
||||
}
|
||||
ws.onclose = shouldCloseCleanly;
|
||||
ws.onclose = function(e)
|
||||
{
|
||||
ok(ws._timesCalledOnError > 0, "no error events");
|
||||
doTest(14);
|
||||
}
|
||||
}
|
||||
|
||||
function test14()
|
||||
@ -413,6 +435,12 @@ function test15()
|
||||
shouldCloseNotCleanly(e);
|
||||
doTest(16);
|
||||
};
|
||||
|
||||
// termination of the connection might cause an error event if it happens in OPEN
|
||||
ws.onerror = function()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function test16()
|
||||
@ -428,7 +456,13 @@ function test16()
|
||||
{
|
||||
ok(false, "shouldn't send message after calling close()");
|
||||
}
|
||||
ws.onclose = shouldCloseCleanly;
|
||||
|
||||
ws.onerror = function()
|
||||
{
|
||||
}
|
||||
ws.onclose = function()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
var status_test17 = "not started";
|
||||
@ -593,9 +627,6 @@ function test22()
|
||||
};
|
||||
}
|
||||
|
||||
var domBranch;
|
||||
var oldPrefVal;
|
||||
|
||||
function finishWSTest()
|
||||
{
|
||||
for (i = 0; i < all_ws.length; ++i) {
|
||||
@ -604,20 +635,11 @@ function finishWSTest()
|
||||
ok(false, "didn't called close on test " + all_ws[i]._testNumber + "!");
|
||||
}
|
||||
}
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
domBranch.setBoolPref("override-security-block", oldPrefVal);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function testWebSocket ()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefService =
|
||||
Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
domBranch = prefService.getBranch("network.websocket.");
|
||||
oldPrefVal = domBranch.getBoolPref("override-security-block");
|
||||
domBranch.setBoolPref("override-security-block", true);
|
||||
doTest(first_test);
|
||||
}
|
||||
|
||||
|
@ -17,24 +17,8 @@
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var ws;
|
||||
var oldPrefVal;
|
||||
var domBranch;
|
||||
|
||||
function finishWSTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
domBranch.setBoolPref("override-security-block", oldPrefVal);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function testWebSocket () {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefService =
|
||||
Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
domBranch = prefService.getBranch("network.websocket.");
|
||||
oldPrefVal = domBranch.getBoolPref("override-security-block");
|
||||
domBranch.setBoolPref("override-security-block", true);
|
||||
|
||||
ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_hello");
|
||||
ws.onopen = function(e) {
|
||||
ws.send("data");
|
||||
@ -43,12 +27,12 @@ function testWebSocket () {
|
||||
}
|
||||
ws.onerror = function(e) {
|
||||
ok(false, "onerror called!");
|
||||
finishWSTest();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
ws.onmessage = function(e) {
|
||||
is(e.data, "Hello world!", "Wrong data");
|
||||
ws.close();
|
||||
finishWSTest();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,6 @@
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var ws;
|
||||
var oldPrefVal;
|
||||
var domBranch;
|
||||
|
||||
var params = ["protocol", "resource", "origin", "end"];
|
||||
var results = ["test", "/tests/content/base/test/file_ws_basic_tests", "http://mochi.test:8888", "end"];
|
||||
@ -32,20 +30,10 @@ function forcegc(){
|
||||
}
|
||||
|
||||
function finishWSTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
domBranch.setBoolPref("override-security-block", oldPrefVal);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function testWebSocket () {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefService =
|
||||
Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
domBranch = prefService.getBranch("network.websocket.");
|
||||
oldPrefVal = domBranch.getBoolPref("override-security-block");
|
||||
domBranch.setBoolPref("override-security-block", true);
|
||||
|
||||
var url = "ws://mochi.test:8888/tests/content/base/test/file_ws_basic_tests";
|
||||
ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_ws_basic_tests", "test");
|
||||
is(ws.url, url, "Wrong Websocket.url!");
|
||||
|
@ -1225,20 +1225,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
|
||||
nsMouseScrollEvent* msEvent = static_cast<nsMouseScrollEvent*>(aEvent);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(actionslot, ".action");
|
||||
NS_NAMED_LITERAL_CSTRING(numlinesslot, ".numlines");
|
||||
NS_NAMED_LITERAL_CSTRING(sysnumlinesslot, ".sysnumlines");
|
||||
|
||||
nsCAutoString baseKey;
|
||||
GetBasePrefKeyForMouseWheel(msEvent, baseKey);
|
||||
|
||||
nsCAutoString sysNumLinesKey(baseKey);
|
||||
sysNumLinesKey.Append(sysnumlinesslot);
|
||||
PRBool useSysNumLines = nsContentUtils::GetBoolPref(sysNumLinesKey.get());
|
||||
|
||||
nsCAutoString actionKey(baseKey);
|
||||
actionKey.Append(actionslot);
|
||||
PRInt32 action = nsContentUtils::GetIntPref(actionKey.get());
|
||||
PRBool useSysNumLines = UseSystemScrollSettingFor(msEvent);
|
||||
PRInt32 action = GetWheelActionFor(msEvent);
|
||||
|
||||
if (!useSysNumLines) {
|
||||
// If the scroll event's delta isn't to our liking, we can
|
||||
@ -1254,9 +1242,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
// second item, if the parameter is negative we swap
|
||||
// directions.
|
||||
|
||||
nsCAutoString numLinesKey(baseKey);
|
||||
numLinesKey.Append(numlinesslot);
|
||||
PRInt32 numLines = nsContentUtils::GetIntPref(numLinesKey.get());
|
||||
PRInt32 numLines = GetScrollLinesFor(msEvent);
|
||||
|
||||
PRBool swapDirs = (numLines < 0);
|
||||
PRInt32 userSize = swapDirs ? -numLines : numLines;
|
||||
@ -2573,6 +2559,66 @@ nsEventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
|
||||
nsEventDispatcher::Dispatch(targetContent, aPresContext, &event, nsnull, aStatus);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStateManager::ComputeWheelActionFor(nsMouseScrollEvent* aMouseEvent,
|
||||
PRBool aUseSystemSettings)
|
||||
{
|
||||
PRInt32 action = GetWheelActionFor(aMouseEvent);
|
||||
if (aUseSystemSettings &&
|
||||
(aMouseEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)) {
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
|
||||
if (aMouseEvent->message == NS_MOUSE_PIXEL_SCROLL) {
|
||||
if (action == MOUSE_SCROLL_N_LINES || action == MOUSE_SCROLL_PAGE ||
|
||||
(aMouseEvent->scrollFlags & nsMouseScrollEvent::kIsMomentum)) {
|
||||
action = MOUSE_SCROLL_PIXELS;
|
||||
} else {
|
||||
// Do not scroll pixels when zooming
|
||||
action = -1;
|
||||
}
|
||||
} else if (aMouseEvent->scrollFlags & nsMouseScrollEvent::kHasPixels) {
|
||||
if (aUseSystemSettings ||
|
||||
action == MOUSE_SCROLL_N_LINES || action == MOUSE_SCROLL_PAGE ||
|
||||
(aMouseEvent->scrollFlags & nsMouseScrollEvent::kIsMomentum)) {
|
||||
// Don't scroll lines when a pixel scroll event will follow.
|
||||
// Also, don't do history scrolling or zooming for momentum scrolls.
|
||||
action = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStateManager::GetWheelActionFor(nsMouseScrollEvent* aMouseEvent)
|
||||
{
|
||||
nsCAutoString prefName;
|
||||
GetBasePrefKeyForMouseWheel(aMouseEvent, prefName);
|
||||
prefName.Append(".action");
|
||||
return nsContentUtils::GetIntPref(prefName.get());
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsEventStateManager::GetScrollLinesFor(nsMouseScrollEvent* aMouseEvent)
|
||||
{
|
||||
NS_ASSERTION(!UseSystemScrollSettingFor(aMouseEvent),
|
||||
"GetScrollLinesFor() called when should use system settings");
|
||||
nsCAutoString prefName;
|
||||
GetBasePrefKeyForMouseWheel(aMouseEvent, prefName);
|
||||
prefName.Append(".numlines");
|
||||
return nsContentUtils::GetIntPref(prefName.get());
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsEventStateManager::UseSystemScrollSettingFor(nsMouseScrollEvent* aMouseEvent)
|
||||
{
|
||||
nsCAutoString prefName;
|
||||
GetBasePrefKeyForMouseWheel(aMouseEvent, prefName);
|
||||
prefName.Append(".sysnumlines");
|
||||
return nsContentUtils::GetBoolPref(prefName.get());
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsEventStateManager::DoScrollText(nsIFrame* aTargetFrame,
|
||||
nsMouseScrollEvent* aMouseEvent,
|
||||
@ -3062,45 +3108,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
if (*aStatus != nsEventStatus_eConsumeNoDefault) {
|
||||
// Build the preference keys, based on the event properties.
|
||||
NS_NAMED_LITERAL_CSTRING(actionslot, ".action");
|
||||
NS_NAMED_LITERAL_CSTRING(sysnumlinesslot, ".sysnumlines");
|
||||
|
||||
nsCAutoString baseKey;
|
||||
GetBasePrefKeyForMouseWheel(msEvent, baseKey);
|
||||
|
||||
// Extract the preferences
|
||||
nsCAutoString actionKey(baseKey);
|
||||
actionKey.Append(actionslot);
|
||||
|
||||
nsCAutoString sysNumLinesKey(baseKey);
|
||||
sysNumLinesKey.Append(sysnumlinesslot);
|
||||
|
||||
PRInt32 action = nsContentUtils::GetIntPref(actionKey.get());
|
||||
PRBool useSysNumLines =
|
||||
nsContentUtils::GetBoolPref(sysNumLinesKey.get());
|
||||
|
||||
if (useSysNumLines) {
|
||||
if (msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
|
||||
if (aEvent->message == NS_MOUSE_PIXEL_SCROLL) {
|
||||
if (action == MOUSE_SCROLL_N_LINES || action == MOUSE_SCROLL_PAGE ||
|
||||
(msEvent->scrollFlags & nsMouseScrollEvent::kIsMomentum)) {
|
||||
action = MOUSE_SCROLL_PIXELS;
|
||||
} else {
|
||||
// Do not scroll pixels when zooming
|
||||
action = -1;
|
||||
}
|
||||
} else if (msEvent->scrollFlags & nsMouseScrollEvent::kHasPixels) {
|
||||
if (useSysNumLines || action == MOUSE_SCROLL_N_LINES ||
|
||||
(msEvent->scrollFlags & nsMouseScrollEvent::kIsMomentum)) {
|
||||
// Don't scroll lines when a pixel scroll event will follow.
|
||||
// Also, don't do history scrolling or zooming for momentum scrolls.
|
||||
action = -1;
|
||||
}
|
||||
}
|
||||
PRBool useSysNumLines = UseSystemScrollSettingFor(msEvent);
|
||||
PRInt32 action = ComputeWheelActionFor(msEvent, useSysNumLines);
|
||||
|
||||
switch (action) {
|
||||
case MOUSE_SCROLL_N_LINES:
|
||||
@ -4686,13 +4695,35 @@ nsEventStateManager::DoQueryScrollTargetInfo(nsQueryContentEvent* aEvent,
|
||||
nsIFrame* aTargetFrame)
|
||||
{
|
||||
nsMouseScrollEvent* msEvent = aEvent->mInput.mMouseScrollEvent;
|
||||
nsIScrollableFrame::ScrollUnit unit;
|
||||
if (msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage) {
|
||||
unit = nsIScrollableFrame::PAGES;
|
||||
} else {
|
||||
unit = nsIScrollableFrame::LINES;
|
||||
|
||||
// Don't use high resolution scrolling when user customize the scrolling
|
||||
// speed.
|
||||
if (!UseSystemScrollSettingFor(msEvent)) {
|
||||
return;
|
||||
}
|
||||
DoScrollText(aTargetFrame, msEvent, unit, PR_FALSE, aEvent);
|
||||
|
||||
nsIScrollableFrame::ScrollUnit unit;
|
||||
PRBool allowOverrideSystemSettings;
|
||||
switch (ComputeWheelActionFor(msEvent, PR_TRUE)) {
|
||||
case MOUSE_SCROLL_N_LINES:
|
||||
unit = nsIScrollableFrame::LINES;
|
||||
allowOverrideSystemSettings = PR_TRUE;
|
||||
break;
|
||||
case MOUSE_SCROLL_PAGE:
|
||||
unit = nsIScrollableFrame::PAGES;
|
||||
allowOverrideSystemSettings = PR_FALSE;
|
||||
break;
|
||||
case MOUSE_SCROLL_PIXELS:
|
||||
unit = nsIScrollableFrame::DEVICE_PIXELS;
|
||||
allowOverrideSystemSettings = PR_FALSE;
|
||||
default:
|
||||
// Don't use high resolution scrolling when the action doesn't scroll
|
||||
// contents.
|
||||
return;
|
||||
}
|
||||
|
||||
DoScrollText(aTargetFrame, msEvent, unit,
|
||||
allowOverrideSystemSettings, aEvent);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -342,6 +342,33 @@ protected:
|
||||
nsresult GetMarkupDocumentViewer(nsIMarkupDocumentViewer** aMv);
|
||||
nsresult ChangeTextSize(PRInt32 change);
|
||||
nsresult ChangeFullZoom(PRInt32 change);
|
||||
/**
|
||||
* Computes the action for the aMouseEvent with prefs. The result is
|
||||
* MOUSE_SCROLL_N_LINES, MOUSE_SCROLL_PAGE, MOUSE_SCROLL_HISTORY,
|
||||
* MOUSE_SCROLL_ZOOM, MOUSE_SCROLL_PIXELS or -1.
|
||||
* When the result is -1, nothing happens for the event.
|
||||
*
|
||||
* @param aUseSystemSettings Set the result of UseSystemScrollSettingFor().
|
||||
*/
|
||||
PRInt32 ComputeWheelActionFor(nsMouseScrollEvent* aMouseEvent,
|
||||
PRBool aUseSystemSettings);
|
||||
/**
|
||||
* Gets the wheel action for the aMouseEvent ONLY with the pref.
|
||||
* When you actually do something for the event, probably you should use
|
||||
* ComputeWheelActionFor().
|
||||
*/
|
||||
PRInt32 GetWheelActionFor(nsMouseScrollEvent* aMouseEvent);
|
||||
/**
|
||||
* Gets the pref value for line scroll amount for the aMouseEvent.
|
||||
* Note that this method doesn't check whether the aMouseEvent is line scroll
|
||||
* event and doesn't use system settings.
|
||||
*/
|
||||
PRInt32 GetScrollLinesFor(nsMouseScrollEvent* aMouseEvent);
|
||||
/**
|
||||
* Whether use system scroll settings or settings in our prefs for the event.
|
||||
* TRUE, if use system scroll settings. Otherwise, FALSE.
|
||||
*/
|
||||
PRBool UseSystemScrollSettingFor(nsMouseScrollEvent* aMouseEvent);
|
||||
// end mousewheel functions
|
||||
|
||||
/*
|
||||
|
@ -83,16 +83,11 @@ PRBool nsXMLEventsListener::InitXMLEventsListener(nsIDocument * aDocument,
|
||||
nsIURI *baseURI = aDocument->GetDocBaseURI();
|
||||
rv = NS_NewURI( getter_AddRefs(handlerURI), handlerURIStr, nsnull, baseURI);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIURL> handlerURL(do_QueryInterface(handlerURI));
|
||||
if (handlerURL) {
|
||||
handlerURL->GetRef(handlerRef);
|
||||
handlerURL->SetRef(EmptyCString());
|
||||
//We support only XML Events Basic.
|
||||
docURI->Equals(handlerURL, &equals);
|
||||
if (equals) {
|
||||
handler =
|
||||
aDocument->GetElementById(NS_ConvertUTF8toUTF16(handlerRef));
|
||||
}
|
||||
handlerURI->GetRef(handlerRef);
|
||||
// We support only XML Events Basic.
|
||||
rv = docURI->EqualsExceptRef(handlerURI, &equals);
|
||||
if (NS_SUCCEEDED(rv) && equals) {
|
||||
handler = aDocument->GetElementById(NS_ConvertUTF8toUTF16(handlerRef));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,6 @@ public:
|
||||
RestoreSelectionState(nsTextEditorState *aState, nsTextControlFrame *aFrame,
|
||||
PRInt32 aStart, PRInt32 aEnd)
|
||||
: mFrame(aFrame),
|
||||
mWeakFrame(aFrame),
|
||||
mStart(aStart),
|
||||
mEnd(aEnd),
|
||||
mTextEditorState(aState)
|
||||
@ -92,19 +91,24 @@ public:
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() {
|
||||
if (mWeakFrame.IsAlive()) {
|
||||
if (mFrame) {
|
||||
// SetSelectionRange leads to Selection::AddRange which flushes Layout -
|
||||
// need to block script to avoid nested PrepareEditor calls (bug 642800).
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
mFrame->SetSelectionRange(mStart, mEnd);
|
||||
mTextEditorState->HideSelectionIfBlurred();
|
||||
}
|
||||
mTextEditorState->FinishedRestoringSelection();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Let the text editor tell us we're no longer relevant - avoids use of nsWeakFrame
|
||||
void Revoke() {
|
||||
mFrame = nsnull;
|
||||
}
|
||||
|
||||
private:
|
||||
nsTextControlFrame* mFrame;
|
||||
nsWeakFrame mWeakFrame;
|
||||
PRInt32 mStart;
|
||||
PRInt32 mEnd;
|
||||
nsTextEditorState* mTextEditorState;
|
||||
@ -645,7 +649,7 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
nsWeakFrame mFrame;
|
||||
nsIFrame* mFrame;
|
||||
|
||||
nsITextControlElement* const mTxtCtrlElement;
|
||||
|
||||
@ -673,7 +677,8 @@ protected:
|
||||
*/
|
||||
|
||||
nsTextInputListener::nsTextInputListener(nsITextControlElement* aTxtCtrlElement)
|
||||
: mTxtCtrlElement(aTxtCtrlElement)
|
||||
: mFrame(nsnull)
|
||||
, mTxtCtrlElement(aTxtCtrlElement)
|
||||
, mSelectionWasCollapsed(PR_TRUE)
|
||||
, mHadUndoItems(PR_FALSE)
|
||||
, mHadRedoItems(PR_FALSE)
|
||||
@ -703,7 +708,9 @@ NS_IMETHODIMP
|
||||
nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection* aSel, PRInt16 aReason)
|
||||
{
|
||||
PRBool collapsed;
|
||||
if (!mFrame.IsAlive() || !aDoc || !aSel || NS_FAILED(aSel->GetIsCollapsed(&collapsed)))
|
||||
nsWeakFrame weakFrame = mFrame;
|
||||
|
||||
if (!aDoc || !aSel || NS_FAILED(aSel->GetIsCollapsed(&collapsed)))
|
||||
return NS_OK;
|
||||
|
||||
// Fire the select event
|
||||
@ -748,7 +755,7 @@ nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection*
|
||||
|
||||
mSelectionWasCollapsed = collapsed;
|
||||
|
||||
if (!mFrame.IsAlive() || !nsContentUtils::IsFocusedContent(mFrame->GetContent()))
|
||||
if (!weakFrame.IsAlive() || !nsContentUtils::IsFocusedContent(mFrame->GetContent()))
|
||||
return NS_OK;
|
||||
|
||||
return UpdateTextInputCommands(NS_LITERAL_STRING("select"));
|
||||
@ -799,7 +806,6 @@ DoCommandCallback(const char *aCommand, void *aData)
|
||||
NS_IMETHODIMP
|
||||
nsTextInputListener::KeyDown(nsIDOMEvent *aDOMEvent)
|
||||
{
|
||||
NS_ENSURE_STATE(mFrame.IsAlive());
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent(do_QueryInterface(aDOMEvent));
|
||||
NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG);
|
||||
|
||||
@ -818,7 +824,6 @@ nsTextInputListener::KeyDown(nsIDOMEvent *aDOMEvent)
|
||||
NS_IMETHODIMP
|
||||
nsTextInputListener::KeyPress(nsIDOMEvent *aDOMEvent)
|
||||
{
|
||||
NS_ENSURE_STATE(mFrame.IsAlive());
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent(do_QueryInterface(aDOMEvent));
|
||||
NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG);
|
||||
|
||||
@ -837,7 +842,6 @@ nsTextInputListener::KeyPress(nsIDOMEvent *aDOMEvent)
|
||||
NS_IMETHODIMP
|
||||
nsTextInputListener::KeyUp(nsIDOMEvent *aDOMEvent)
|
||||
{
|
||||
NS_ENSURE_STATE(mFrame.IsAlive());
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent(do_QueryInterface(aDOMEvent));
|
||||
NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG);
|
||||
|
||||
@ -859,8 +863,9 @@ nsTextInputListener::KeyUp(nsIDOMEvent *aDOMEvent)
|
||||
NS_IMETHODIMP
|
||||
nsTextInputListener::EditAction()
|
||||
{
|
||||
NS_ENSURE_STATE(mFrame.IsAlive());
|
||||
nsITextControlFrame* frameBase = do_QueryFrame(mFrame.GetFrame());
|
||||
nsWeakFrame weakFrame = mFrame;
|
||||
|
||||
nsITextControlFrame* frameBase = do_QueryFrame(mFrame);
|
||||
nsTextControlFrame* frame = static_cast<nsTextControlFrame*> (frameBase);
|
||||
NS_ASSERTION(frame, "Where is our frame?");
|
||||
//
|
||||
@ -887,7 +892,7 @@ nsTextInputListener::EditAction()
|
||||
mHadRedoItems = numRedoItems != 0;
|
||||
}
|
||||
|
||||
if (!mFrame.IsAlive()) {
|
||||
if (!weakFrame.IsAlive()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -916,8 +921,6 @@ nsTextInputListener::EditAction()
|
||||
nsresult
|
||||
nsTextInputListener::UpdateTextInputCommands(const nsAString& commandsToUpdate)
|
||||
{
|
||||
NS_ENSURE_STATE(mFrame.IsAlive());
|
||||
|
||||
nsIContent* content = mFrame->GetContent();
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
|
||||
@ -967,6 +970,7 @@ nsTextInputListener::GetKeyBindings()
|
||||
|
||||
nsTextEditorState::nsTextEditorState(nsITextControlElement* aOwningElement)
|
||||
: mTextCtrlElement(aOwningElement),
|
||||
mRestoringSelection(nsnull),
|
||||
mBoundFrame(nsnull),
|
||||
mTextListener(nsnull),
|
||||
mEditorInitialized(PR_FALSE),
|
||||
@ -1385,8 +1389,13 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
|
||||
|
||||
// Restore our selection after being bound to a new frame
|
||||
if (mSelState) {
|
||||
nsContentUtils::AddScriptRunner(new RestoreSelectionState(this, mBoundFrame, mSelState->mStart, mSelState->mEnd));
|
||||
mSelState = nsnull;
|
||||
if (mRestoringSelection) // paranoia
|
||||
mRestoringSelection->Revoke();
|
||||
mRestoringSelection = new RestoreSelectionState(this, mBoundFrame, mSelState->mStart, mSelState->mEnd);
|
||||
if (mRestoringSelection) {
|
||||
nsContentUtils::AddScriptRunner(mRestoringSelection);
|
||||
mSelState = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -1419,6 +1428,11 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
|
||||
nsAutoString value;
|
||||
GetValue(value, PR_TRUE);
|
||||
|
||||
if (mRestoringSelection) {
|
||||
mRestoringSelection->Revoke();
|
||||
mRestoringSelection = nsnull;
|
||||
}
|
||||
|
||||
// Save our selection state if needed.
|
||||
// Note that nsTextControlFrame::GetSelectionRange attempts to initialize the
|
||||
// editor before grabbing the range, and because this is not an acceptable
|
||||
|
@ -140,6 +140,8 @@ struct SelectionState;
|
||||
* frame is bound to the text editor state object.
|
||||
*/
|
||||
|
||||
class RestoreSelectionState;
|
||||
|
||||
class nsTextEditorState {
|
||||
public:
|
||||
explicit nsTextEditorState(nsITextControlElement* aOwningElement);
|
||||
@ -213,6 +215,8 @@ public:
|
||||
void HideSelectionIfBlurred();
|
||||
|
||||
private:
|
||||
friend class RestoreSelectionState;
|
||||
|
||||
// not copy constructible
|
||||
nsTextEditorState(const nsTextEditorState&);
|
||||
// not assignable
|
||||
@ -225,6 +229,8 @@ private:
|
||||
void DestroyEditor();
|
||||
void Clear();
|
||||
|
||||
void FinishedRestoringSelection() { mRestoringSelection = nsnull; }
|
||||
|
||||
class InitializationGuard {
|
||||
public:
|
||||
explicit InitializationGuard(nsTextEditorState& aState) :
|
||||
@ -253,6 +259,7 @@ private:
|
||||
nsITextControlElement* const mTextCtrlElement;
|
||||
nsRefPtr<nsTextInputSelectionImpl> mSelCon;
|
||||
nsAutoPtr<SelectionState> mSelState;
|
||||
RestoreSelectionState* mRestoringSelection;
|
||||
nsCOMPtr<nsIEditor> mEditor;
|
||||
nsCOMPtr<nsIContent> mRootNode;
|
||||
nsCOMPtr<nsIContent> mPlaceholderDiv;
|
||||
|
@ -305,16 +305,13 @@ nsXBLPrototypeBinding::Init(const nsACString& aID,
|
||||
nsresult rv = aInfo->DocumentURI()->Clone(getter_AddRefs(mBindingURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// The binding URI might not be a nsIURL (e.g. for data: URIs). In that case,
|
||||
// we always use the first binding, so we don't need to keep track of the ID.
|
||||
nsCOMPtr<nsIURL> bindingURL = do_QueryInterface(mBindingURI);
|
||||
if (bindingURL) {
|
||||
if (aFirstBinding) {
|
||||
rv = mBindingURI->Clone(getter_AddRefs(mAlternateBindingURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
bindingURL->SetRef(aID);
|
||||
// The binding URI might be an immutable URI (e.g. for about: URIs). In that case,
|
||||
// we'll fail in SetRef below, but that doesn't matter much for now.
|
||||
if (aFirstBinding) {
|
||||
rv = mBindingURI->Clone(getter_AddRefs(mAlternateBindingURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
mBindingURI->SetRef(aID);
|
||||
|
||||
mXBLDocInfoWeak = aInfo;
|
||||
|
||||
|
@ -862,9 +862,7 @@ nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI,
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCAutoString ref;
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(aURI));
|
||||
if (url)
|
||||
url->GetRef(ref);
|
||||
aURI->GetRef(ref);
|
||||
|
||||
nsCOMPtr<nsIDocument> boundDocument = aBoundElement->GetOwnerDoc();
|
||||
|
||||
@ -1129,12 +1127,8 @@ nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement,
|
||||
nsRefPtr<nsXBLDocumentInfo> info;
|
||||
|
||||
nsCOMPtr<nsIURI> documentURI;
|
||||
rv = aBindingURI->Clone(getter_AddRefs(documentURI));
|
||||
rv = aBindingURI->CloneIgnoringRef(getter_AddRefs(documentURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURL> documentURL(do_QueryInterface(documentURI));
|
||||
if (documentURL)
|
||||
documentURL->SetRef(EmptyCString());
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
// We've got a file. Check our XBL document cache.
|
||||
|
@ -743,15 +743,10 @@ TX_CompileStylesheet(nsINode* aNode, txMozillaXSLTProcessor* aProcessor,
|
||||
nsIURI* docUri = doc->GetDocumentURI();
|
||||
NS_ENSURE_TRUE(docUri, NS_ERROR_FAILURE);
|
||||
|
||||
docUri->Clone(getter_AddRefs(uri));
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
// We need to remove the ref, a URL with a ref would mean that we have an
|
||||
// We need to remove the ref, a URI with a ref would mean that we have an
|
||||
// embedded stylesheet.
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(uri);
|
||||
if (url) {
|
||||
url->SetRef(EmptyCString());
|
||||
}
|
||||
docUri->CloneIgnoringRef(getter_AddRefs(uri));
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
uri->GetSpec(spec);
|
||||
NS_ConvertUTF8toUTF16 stylesheetURI(spec);
|
||||
|
@ -328,34 +328,29 @@ nsXULContentUtils::MakeElementURI(nsIDocument* aDocument,
|
||||
// Convert an element's ID to a URI that can be used to refer to
|
||||
// the element in the XUL graph.
|
||||
|
||||
nsIURI *docURL = aDocument->GetDocumentURI();
|
||||
NS_ENSURE_TRUE(docURL, NS_ERROR_UNEXPECTED);
|
||||
nsIURI *docURI = aDocument->GetDocumentURI();
|
||||
NS_ENSURE_TRUE(docURI, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIURI> docURIClone;
|
||||
nsresult rv = docURL->Clone(getter_AddRefs(docURIClone));
|
||||
nsRefPtr<nsIURI> docURIClone;
|
||||
nsresult rv = docURI->Clone(getter_AddRefs(docURIClone));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURL> mutableURL(do_QueryInterface(docURIClone));
|
||||
if (!mutableURL) {
|
||||
nsCString uri;
|
||||
rv = docURL->GetSpec(aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString ref;
|
||||
NS_EscapeURL(NS_ConvertUTF16toUTF8(aElementID), esc_FilePath | esc_AlwaysCopy, ref);
|
||||
|
||||
aURI.Append('#');
|
||||
aURI.Append(ref);
|
||||
|
||||
return NS_OK;
|
||||
rv = docURIClone->SetRef(NS_ConvertUTF16toUTF8(aElementID));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return docURIClone->GetSpec(aURI);
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(mutableURL, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
rv = mutableURL->SetRef(NS_ConvertUTF16toUTF8(aElementID));
|
||||
// docURIClone is apparently immutable. Fine - we can append ref manually.
|
||||
rv = docURI->GetSpec(aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return mutableURL->GetSpec(aURI);
|
||||
nsCAutoString ref;
|
||||
NS_EscapeURL(NS_ConvertUTF16toUTF8(aElementID), esc_FilePath | esc_AlwaysCopy, ref);
|
||||
|
||||
aURI.Append('#');
|
||||
aURI.Append(ref);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -390,27 +385,9 @@ nsXULContentUtils::MakeElementID(nsIDocument* aDocument,
|
||||
aDocument->GetDocumentCharacterSet().get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(uri);
|
||||
if (url) {
|
||||
nsCAutoString ref;
|
||||
url->GetRef(ref);
|
||||
CopyUTF8toUTF16(ref, aElementID);
|
||||
} else {
|
||||
const char* start = aURI.BeginReading();
|
||||
const char* end = aURI.EndReading();
|
||||
const char* chr = end;
|
||||
|
||||
while (--chr >= start) {
|
||||
if (*chr == '#') {
|
||||
nsDependentCSubstring ref = Substring(chr + 1, end);
|
||||
nsCAutoString unescaped;
|
||||
CopyUTF8toUTF16(NS_UnescapeURL(ref, esc_FilePath, unescaped), aElementID);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
aElementID.Truncate();
|
||||
}
|
||||
nsCAutoString ref;
|
||||
uri->GetRef(ref);
|
||||
CopyUTF8toUTF16(ref, aElementID);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -122,9 +122,15 @@ ConsoleAPI.prototype = {
|
||||
if (!aID)
|
||||
return;
|
||||
|
||||
let stack = this.getStackTrace();
|
||||
// Skip the first frame since it contains an internal call.
|
||||
let frame = stack[1];
|
||||
let consoleEvent = {
|
||||
ID: aID,
|
||||
level: aLevel,
|
||||
filename: frame.filename,
|
||||
lineNumber: frame.lineNumber,
|
||||
functionName: frame.functionName,
|
||||
arguments: aArguments
|
||||
};
|
||||
|
||||
@ -157,7 +163,7 @@ ConsoleAPI.prototype = {
|
||||
}
|
||||
|
||||
return stack;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
let NSGetFactory = XPCOMUtils.generateNSGetFactory([ConsoleAPI]);
|
||||
|
@ -374,46 +374,45 @@ nsLocation::GetHash(nsAString& aHash)
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = GetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv) || !uri) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
|
||||
nsCAutoString ref;
|
||||
nsAutoString unicodeRef;
|
||||
|
||||
if (url) {
|
||||
nsCAutoString ref;
|
||||
nsAutoString unicodeRef;
|
||||
rv = uri->GetRef(ref);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsITextToSubURI> textToSubURI(
|
||||
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv));
|
||||
|
||||
rv = url->GetRef(ref);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsITextToSubURI> textToSubURI(
|
||||
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCAutoString charset;
|
||||
url->GetOriginCharset(charset);
|
||||
nsCAutoString charset;
|
||||
uri->GetOriginCharset(charset);
|
||||
|
||||
rv = textToSubURI->UnEscapeURIForUI(charset, ref, unicodeRef);
|
||||
}
|
||||
rv = textToSubURI->UnEscapeURIForUI(charset, ref, unicodeRef);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
// Oh, well. No intl here!
|
||||
NS_UnescapeURL(ref);
|
||||
CopyASCIItoUTF16(ref, unicodeRef);
|
||||
rv = NS_OK;
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
// Oh, well. No intl here!
|
||||
NS_UnescapeURL(ref);
|
||||
CopyASCIItoUTF16(ref, unicodeRef);
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !unicodeRef.IsEmpty()) {
|
||||
aHash.Assign(PRUnichar('#'));
|
||||
aHash.Append(unicodeRef);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv) && !unicodeRef.IsEmpty()) {
|
||||
aHash.Assign(PRUnichar('#'));
|
||||
aHash.Append(unicodeRef);
|
||||
}
|
||||
|
||||
if (aHash == mCachedHash) {
|
||||
// Work around ShareThis stupidly polling location.hash every
|
||||
// 5ms all the time by handing out the same exact string buffer
|
||||
// we handed out last time.
|
||||
aHash = mCachedHash;
|
||||
} else {
|
||||
mCachedHash = aHash;
|
||||
}
|
||||
if (aHash == mCachedHash) {
|
||||
// Work around ShareThis stupidly polling location.hash every
|
||||
// 5ms all the time by handing out the same exact string buffer
|
||||
// we handed out last time.
|
||||
aHash = mCachedHash;
|
||||
} else {
|
||||
mCachedHash = aHash;
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -424,17 +423,17 @@ nsLocation::SetHash(const nsAString& aHash)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = GetWritableURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv) || !uri) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
|
||||
if (url) {
|
||||
NS_ConvertUTF16toUTF8 hash(aHash);
|
||||
if (hash.IsEmpty() || hash.First() != PRUnichar('#')) {
|
||||
hash.Insert(PRUnichar('#'), 0);
|
||||
}
|
||||
rv = url->SetRef(hash);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetURI(url);
|
||||
}
|
||||
NS_ConvertUTF16toUTF8 hash(aHash);
|
||||
if (hash.IsEmpty() || hash.First() != PRUnichar('#')) {
|
||||
hash.Insert(PRUnichar('#'), 0);
|
||||
}
|
||||
rv = uri->SetRef(hash);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetURI(uri);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -22,6 +22,7 @@
|
||||
* David Dahl <ddahl@mozilla.com>
|
||||
* Rob Campbell <rcampbell@mozilla.com>
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
* Panos Astithas <past@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@ -39,7 +40,7 @@
|
||||
|
||||
const TEST_URI = "http://example.com/browser/dom/tests/browser/test-console-api.html";
|
||||
|
||||
var gWindow;
|
||||
var gWindow, gLevel, gArgs;
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
@ -65,8 +66,6 @@ function test() {
|
||||
}, false);
|
||||
}
|
||||
|
||||
var gWindow;
|
||||
|
||||
function testConsoleData(aMessageObject) {
|
||||
let messageWindow = getWindowByWindowId(aMessageObject.ID);
|
||||
is(messageWindow, gWindow, "found correct window by window ID");
|
||||
@ -79,9 +78,8 @@ function testConsoleData(aMessageObject) {
|
||||
is(aMessageObject.arguments.toSource(), gArgs.toSource(),
|
||||
"stack trace is correct");
|
||||
|
||||
// Test finished
|
||||
ConsoleObserver.destroy();
|
||||
finish();
|
||||
// Now test the location information in console.log()
|
||||
startLocationTest();
|
||||
}
|
||||
else {
|
||||
gArgs.forEach(function (a, i) {
|
||||
@ -95,6 +93,26 @@ function testConsoleData(aMessageObject) {
|
||||
}
|
||||
}
|
||||
|
||||
function testLocationData(aMessageObject) {
|
||||
let messageWindow = getWindowByWindowId(aMessageObject.ID);
|
||||
is(messageWindow, gWindow, "found correct window by window ID");
|
||||
|
||||
is(aMessageObject.level, gLevel, "expected level received");
|
||||
ok(aMessageObject.arguments, "we have arguments");
|
||||
|
||||
is(aMessageObject.filename, gArgs[0].filename, "filename matches");
|
||||
is(aMessageObject.lineNumber, gArgs[0].lineNumber, "lineNumber matches");
|
||||
is(aMessageObject.functionName, gArgs[0].functionName, "functionName matches");
|
||||
is(aMessageObject.arguments.length, gArgs[0].arguments.length, "arguments.length matches");
|
||||
gArgs[0].arguments.forEach(function (a, i) {
|
||||
is(aMessageObject.arguments[i], a, "correct arg " + i);
|
||||
});
|
||||
|
||||
// Test finished
|
||||
ConsoleObserver.destroy();
|
||||
finish();
|
||||
}
|
||||
|
||||
function startTraceTest() {
|
||||
gLevel = "trace";
|
||||
gArgs = [
|
||||
@ -109,7 +127,27 @@ function startTraceTest() {
|
||||
EventUtils.synthesizeMouse(button, 2, 2, {}, gWindow);
|
||||
}
|
||||
|
||||
var gLevel, gArgs;
|
||||
function startLocationTest() {
|
||||
// Reset the observer function to cope with the fabricated test data.
|
||||
ConsoleObserver.observe = function CO_observe(aSubject, aTopic, aData) {
|
||||
try {
|
||||
testLocationData(aSubject.wrappedJSObject);
|
||||
} catch (ex) {
|
||||
// XXX Exceptions in this function currently aren't reported, because of
|
||||
// some XPConnect weirdness, so report them manually
|
||||
ok(false, "Exception thrown in CO_observe: " + ex);
|
||||
}
|
||||
};
|
||||
gLevel = "log";
|
||||
gArgs = [
|
||||
{filename: TEST_URI, lineNumber: 19, functionName: "foobar646025", arguments: ["omg", "o", "d"]}
|
||||
];
|
||||
|
||||
let button = gWindow.document.getElementById("test-location");
|
||||
ok(button, "found #test-location button");
|
||||
EventUtils.synthesizeMouse(button, 2, 2, {}, gWindow);
|
||||
}
|
||||
|
||||
function expect(level) {
|
||||
gLevel = level;
|
||||
gArgs = Array.slice(arguments, 1);
|
||||
|
@ -15,6 +15,10 @@
|
||||
return foobar585956b(omg + "a");
|
||||
}
|
||||
|
||||
function foobar646025(omg) {
|
||||
console.log(omg, "o", "d");
|
||||
}
|
||||
|
||||
function test() {
|
||||
var str = "Test Message."
|
||||
console.foobar(str); // if this throws, we don't execute following funcs
|
||||
@ -29,5 +33,6 @@
|
||||
<h1>Console API Test Page</h1>
|
||||
<button onclick="test();">Log stuff</button>
|
||||
<button id="test-trace" onclick="foobar585956a('omg');">Test trace</button>
|
||||
<button id="test-location" onclick="foobar646025('omg');">Test location</button>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -242,8 +242,7 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIContent *aRoot, nsISelectionController *
|
||||
mSelConWeak = do_GetWeakReference(aSelCon); // weak reference to selectioncontroller
|
||||
selCon = aSelCon;
|
||||
} else {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
GetPresShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
selCon = do_QueryInterface(presShell);
|
||||
}
|
||||
NS_ASSERTION(selCon, "Selection controller should be available at this point");
|
||||
@ -315,8 +314,7 @@ nsEditor::PostCreate()
|
||||
// update nsTextStateManager and caret if we have focus
|
||||
nsCOMPtr<nsIContent> focusedContent = GetFocusedContent();
|
||||
if (focusedContent) {
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ASSERTION(ps, "no pres shell even though we have focus");
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_UNEXPECTED);
|
||||
nsPresContext* pc = ps->GetPresContext();
|
||||
@ -396,12 +394,11 @@ nsEditor::GetDesiredSpellCheckState()
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
rv = GetPresShell(getter_AddRefs(presShell));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
if (presShell) {
|
||||
nsPresContext* context = presShell->GetPresContext();
|
||||
if (context && !context->IsDynamic()) {
|
||||
return PR_FALSE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -528,19 +525,14 @@ nsEditor::GetDocument(nsIDOMDocument **aDoc)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsEditor::GetPresShell(nsIPresShell **aPS)
|
||||
already_AddRefed<nsIPresShell>
|
||||
nsEditor::GetPresShell()
|
||||
{
|
||||
NS_ENSURE_TRUE(aPS, NS_ERROR_NULL_POINTER);
|
||||
*aPS = nsnull; // init out param
|
||||
NS_PRECONDITION(mDocWeak, "bad state, null mDocWeak");
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocWeak);
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_NOT_INITIALIZED);
|
||||
*aPS = doc->GetShell();
|
||||
NS_ENSURE_TRUE(*aPS, NS_ERROR_NOT_INITIALIZED);
|
||||
NS_ADDREF(*aPS);
|
||||
return NS_OK;
|
||||
NS_ENSURE_TRUE(doc, NULL);
|
||||
nsRefPtr<nsIPresShell> ps = doc->GetShell();
|
||||
return ps.forget();
|
||||
}
|
||||
|
||||
|
||||
@ -569,8 +561,7 @@ nsEditor::GetSelectionController(nsISelectionController **aSel)
|
||||
if (mSelConWeak) {
|
||||
selCon = do_QueryReferent(mSelConWeak);
|
||||
} else {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
GetPresShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
selCon = do_QueryInterface(presShell);
|
||||
}
|
||||
NS_ENSURE_TRUE(selCon, NS_ERROR_NOT_INITIALIZED);
|
||||
@ -939,8 +930,7 @@ nsEditor::EndPlaceHolderTransaction()
|
||||
// Hide the caret here to avoid hiding it twice, once in EndUpdateViewBatch
|
||||
// and once in ScrollSelectionIntoView.
|
||||
nsRefPtr<nsCaret> caret;
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
GetPresShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
|
||||
if (presShell)
|
||||
caret = presShell->GetCaret();
|
||||
@ -2778,8 +2768,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
|
||||
}
|
||||
}
|
||||
// handle selection
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
if (ps)
|
||||
ps->FlushPendingNotifications(Flush_Frames);
|
||||
|
||||
@ -3907,8 +3896,7 @@ nsEditor::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
|
||||
|
||||
NS_ENSURE_TRUE(aResult && content, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// Look at the node (and its parent if it's not an element), and grab its style context
|
||||
@ -4117,8 +4105,7 @@ nsresult nsEditor::BeginUpdateViewBatch()
|
||||
}
|
||||
|
||||
// Turn off view updating.
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
if (ps) {
|
||||
nsCOMPtr<nsIViewManager> viewManager = ps->GetViewManager();
|
||||
if (viewManager) {
|
||||
@ -4153,8 +4140,7 @@ nsresult nsEditor::EndUpdateViewBatch()
|
||||
// to draw at the correct position.
|
||||
|
||||
nsRefPtr<nsCaret> caret;
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
GetPresShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
|
||||
if (presShell)
|
||||
caret = presShell->GetCaret();
|
||||
@ -5083,9 +5069,8 @@ nsEditor::InitializeSelection(nsIDOMEventTarget* aFocusEventTarget)
|
||||
nsresult rv = GetSelection(getter_AddRefs(selection));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
rv = GetPresShell(getter_AddRefs(presShell));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
rv = GetSelectionController(getter_AddRefs(selCon));
|
||||
|
@ -145,8 +145,8 @@ public:
|
||||
nsIEditor)
|
||||
|
||||
/* ------------ utility methods -------------- */
|
||||
NS_IMETHOD GetPresShell(nsIPresShell **aPS);
|
||||
void NotifyEditorObservers(void);
|
||||
already_AddRefed<nsIPresShell> GetPresShell();
|
||||
void NotifyEditorObservers();
|
||||
|
||||
/* ------------ nsIEditor methods -------------- */
|
||||
NS_DECL_NSIEDITOR
|
||||
|
@ -257,9 +257,7 @@ nsEditorEventListener::GetPresShell()
|
||||
{
|
||||
NS_PRECONDITION(mEditor,
|
||||
"The caller must check whether this is connected to an editor");
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
mEditor->GetPresShell(getter_AddRefs(ps));
|
||||
return ps.forget();
|
||||
return mEditor->GetPresShell();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -311,8 +311,7 @@ nsHTMLEditor::HideGrabber()
|
||||
NS_ENSURE_TRUE(mGrabber, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// get the presshell's document observer interface.
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
// We allow the pres shell to be null; when it is, we presume there
|
||||
// are no document observers to notify, but we still want to
|
||||
// UnbindFromTree.
|
||||
@ -428,8 +427,7 @@ nsresult
|
||||
nsHTMLEditor::EndMoving()
|
||||
{
|
||||
if (mPositioningShadow) {
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
|
@ -156,8 +156,7 @@ nsHTMLEditor::CreateAnonymousElement(const nsAString & aTag, nsIDOMNode * aPare
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// Get the pres shell
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// Create a new node through the element factory
|
||||
|
@ -175,8 +175,7 @@ nsHTMLEditor::~nsHTMLEditor()
|
||||
|
||||
if (mLinkHandler && mDocWeak)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
|
||||
if (ps && ps->GetPresContext())
|
||||
{
|
||||
@ -305,8 +304,7 @@ nsHTMLEditor::Init(nsIDOMDocument *aDoc,
|
||||
mHTMLCSSUtils = new nsHTMLCSSUtils(this);
|
||||
|
||||
// disable links
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
GetPresShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_NULL_POINTER);
|
||||
@ -3498,8 +3496,7 @@ nsHTMLEditor::ReplaceStyleSheet(const nsAString& aURL)
|
||||
|
||||
// Make sure the pres shell doesn't disappear during the load.
|
||||
NS_ENSURE_TRUE(mDocWeak, NS_ERROR_NOT_INITIALIZED);
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<nsIURI> uaURI;
|
||||
@ -3543,8 +3540,7 @@ nsHTMLEditor::AddOverrideStyleSheet(const nsAString& aURL)
|
||||
return NS_OK;
|
||||
|
||||
// Make sure the pres shell doesn't disappear during the load.
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<nsIURI> uaURI;
|
||||
@ -3608,8 +3604,7 @@ nsHTMLEditor::RemoveOverrideStyleSheet(const nsAString &aURL)
|
||||
NS_ENSURE_TRUE(sheet, NS_OK); /// Don't fail if sheet not found
|
||||
|
||||
NS_ENSURE_TRUE(mDocWeak, NS_ERROR_NOT_INITIALIZED);
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
ps->RemoveOverrideStyleSheet(sheet);
|
||||
@ -4202,8 +4197,7 @@ nsHTMLEditor::SelectAll()
|
||||
return selection->SelectAllChildren(mRootElement);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
nsIContent *rootContent = anchorContent->GetSelectionRootContent(ps);
|
||||
NS_ENSURE_TRUE(rootContent, NS_ERROR_UNEXPECTED);
|
||||
|
||||
@ -5596,8 +5590,7 @@ nsHTMLEditor::GetElementOrigin(nsIDOMElement * aElement, PRInt32 & aX, PRInt32 &
|
||||
aY = 0;
|
||||
|
||||
NS_ENSURE_TRUE(mDocWeak, NS_ERROR_NOT_INITIALIZED);
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||
|
@ -124,8 +124,7 @@ nsHTMLEditor::HideInlineTableEditingUI()
|
||||
RemoveMouseClickListener(mAddRowAfterButton);
|
||||
|
||||
// get the presshell's document observer interface.
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
// We allow the pres shell to be null; when it is, we presume there
|
||||
// are no document observers to notify, but we still want to
|
||||
// UnbindFromTree.
|
||||
|
@ -432,8 +432,7 @@ nsHTMLEditor::HideResizers(void)
|
||||
NS_ENSURE_TRUE(mResizedObject, NS_OK);
|
||||
|
||||
// get the presshell's document observer interface.
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
// We allow the pres shell to be null; when it is, we presume there
|
||||
// are no document observers to notify, but we still want to
|
||||
// UnbindFromTree.
|
||||
|
@ -2643,8 +2643,7 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell,
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(mDocWeak, NS_ERROR_NOT_INITIALIZED);
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<nsIContent> nodeAsContent( do_QueryInterface(aCell) );
|
||||
@ -2661,11 +2660,10 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell,
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **tableLayoutObject)
|
||||
{
|
||||
*tableLayoutObject=nsnull;
|
||||
*tableLayoutObject = nsnull;
|
||||
NS_ENSURE_TRUE(aTable, NS_ERROR_NOT_INITIALIZED);
|
||||
NS_ENSURE_TRUE(mDocWeak, NS_ERROR_NOT_INITIALIZED);
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<nsIContent> nodeAsContent( do_QueryInterface(aTable) );
|
||||
|
@ -853,9 +853,8 @@ NS_IMETHODIMP nsPlaintextEditor::InsertLineBreak()
|
||||
|
||||
// Batching the selection and moving nodes out from under the caret causes
|
||||
// caret turds. Ask the shell to invalidate the caret now to avoid the turds.
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
res = GetPresShell(getter_AddRefs(shell));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_NOT_INITIALIZED);
|
||||
shell->MaybeInvalidateCaretPosition();
|
||||
|
||||
nsTextRulesInfo ruleInfo(nsTextEditRules::kInsertBreak);
|
||||
@ -948,8 +947,7 @@ nsPlaintextEditor::UpdateIMEComposition(const nsAString& aCompositionString,
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
GetPresShell(getter_AddRefs(ps));
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
@ -1272,8 +1270,7 @@ nsPlaintextEditor::FireClipboardEvent(PRInt32 aType)
|
||||
if (aType == NS_PASTE)
|
||||
ForceCompositionEnd();
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
GetPresShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
NS_ENSURE_TRUE(presShell, PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
|
@ -56,10 +56,8 @@ nsTextEditRules::CheckBidiLevelForDeletion(nsISelection *aSelection,
|
||||
NS_ENSURE_ARG_POINTER(aCancel);
|
||||
*aCancel = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult res = mEditor->GetPresShell(getter_AddRefs(shell));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_NULL_POINTER);
|
||||
nsCOMPtr<nsIPresShell> shell = mEditor->GetPresShell();
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_NULL_POINTER);
|
||||
|
@ -323,8 +323,8 @@ public:
|
||||
gfxRect DeviceToUser(const gfxRect& rect) const;
|
||||
|
||||
/**
|
||||
* Converts a point from user to device coordinates using the inverse
|
||||
* transformation matrix.
|
||||
* Converts a point from user to device coordinates using the transformation
|
||||
* matrix.
|
||||
*/
|
||||
gfxPoint UserToDevice(const gfxPoint& point) const;
|
||||
|
||||
|
@ -309,8 +309,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsXMLHttpRequest, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebSocket)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWSProtocolHandler)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWSSProtocolHandler)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDOMFileReader, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormData)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFileDataProtocolHandler)
|
||||
@ -842,8 +840,6 @@ NS_DEFINE_NAMED_CID(NS_FORMDATA_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_FILEDATAPROTOCOLHANDLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_XMLHTTPREQUEST_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WEBSOCKET_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WSPROTOCOLHANDLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WSSPROTOCOLHANDLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DOMPARSER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DOMSTORAGE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DOMSTORAGE2_CID);
|
||||
@ -991,8 +987,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
|
||||
{ &kNS_FILEDATAPROTOCOLHANDLER_CID, false, NULL, nsFileDataProtocolHandlerConstructor },
|
||||
{ &kNS_XMLHTTPREQUEST_CID, false, NULL, nsXMLHttpRequestConstructor },
|
||||
{ &kNS_WEBSOCKET_CID, false, NULL, nsWebSocketConstructor },
|
||||
{ &kNS_WSPROTOCOLHANDLER_CID, false, NULL, nsWSProtocolHandlerConstructor },
|
||||
{ &kNS_WSSPROTOCOLHANDLER_CID, false, NULL, nsWSSProtocolHandlerConstructor },
|
||||
{ &kNS_DOMPARSER_CID, false, NULL, nsDOMParserConstructor },
|
||||
{ &kNS_DOMSTORAGE_CID, false, NULL, NS_NewDOMStorage },
|
||||
{ &kNS_DOMSTORAGE2_CID, false, NULL, NS_NewDOMStorage2 },
|
||||
@ -1135,8 +1129,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
|
||||
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX FILEDATA_SCHEME, &kNS_FILEDATAPROTOCOLHANDLER_CID },
|
||||
{ NS_XMLHTTPREQUEST_CONTRACTID, &kNS_XMLHTTPREQUEST_CID },
|
||||
{ NS_WEBSOCKET_CONTRACTID, &kNS_WEBSOCKET_CID },
|
||||
{ NS_WSPROTOCOLHANDLER_CONTRACTID, &kNS_WSPROTOCOLHANDLER_CID },
|
||||
{ NS_WSSPROTOCOLHANDLER_CONTRACTID, &kNS_WSSPROTOCOLHANDLER_CID },
|
||||
{ NS_DOMPARSER_CONTRACTID, &kNS_DOMPARSER_CID },
|
||||
{ "@mozilla.org/dom/storage;1", &kNS_DOMSTORAGE_CID },
|
||||
{ "@mozilla.org/dom/storage;2", &kNS_DOMSTORAGE2_CID },
|
||||
|
@ -80,7 +80,6 @@
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#include "nsCrossSiteListenerProxy.h"
|
||||
#include "nsWebSocket.h"
|
||||
#include "nsDOMThreadService.h"
|
||||
#include "nsHTMLDNSPrefetch.h"
|
||||
#include "nsHtml5Module.h"
|
||||
@ -369,8 +368,6 @@ nsLayoutStatics::Shutdown()
|
||||
|
||||
nsCORSListenerProxy::Shutdown();
|
||||
|
||||
nsWebSocket::ReleaseGlobals();
|
||||
|
||||
nsIPresShell::ReleaseStatics();
|
||||
|
||||
nsHtml5Module::ReleaseStatics();
|
||||
|
@ -201,6 +201,12 @@ nsTextControlFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
{
|
||||
mScrollEvent.Revoke();
|
||||
|
||||
EditorInitializer* initializer = (EditorInitializer*) Properties().Get(TextControlInitializer());
|
||||
if (initializer) {
|
||||
initializer->Revoke();
|
||||
Properties().Delete(TextControlInitializer());
|
||||
}
|
||||
|
||||
// Unbind the text editor state object from the frame. The editor will live
|
||||
// on, but things like controllers will be released.
|
||||
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
|
||||
@ -445,10 +451,17 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||
if (initEagerly) {
|
||||
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
|
||||
"Someone forgot a script blocker?");
|
||||
|
||||
if (!nsContentUtils::AddScriptRunner(new EditorInitializer(this))) {
|
||||
EditorInitializer* initializer = (EditorInitializer*) Properties().Get(TextControlInitializer());
|
||||
if (initializer) {
|
||||
initializer->Revoke();
|
||||
}
|
||||
initializer = new EditorInitializer(this);
|
||||
if (!nsContentUtils::AddScriptRunner(initializer)) {
|
||||
initializer->Revoke(); // paranoia
|
||||
delete initializer;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
Properties().Set(TextControlInitializer(),initializer);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -180,6 +180,11 @@ public:
|
||||
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
// Temp reference to scriptrunner
|
||||
// We could make these auto-Revoking via the "delete" entry for safety
|
||||
NS_DECLARE_FRAME_PROPERTY(TextControlInitializer, nsnull)
|
||||
|
||||
|
||||
public: //for methods who access nsTextControlFrame directly
|
||||
void FireOnInput(PRBool aTrusted);
|
||||
void SetValueChanged(PRBool aValueChanged);
|
||||
@ -286,23 +291,27 @@ protected:
|
||||
class EditorInitializer : public nsRunnable {
|
||||
public:
|
||||
EditorInitializer(nsTextControlFrame* aFrame) :
|
||||
mWeakFrame(aFrame),
|
||||
mFrame(aFrame) {}
|
||||
|
||||
NS_IMETHOD Run() {
|
||||
if (mWeakFrame) {
|
||||
if (mFrame) {
|
||||
nsCOMPtr<nsIPresShell> shell =
|
||||
mWeakFrame.GetFrame()->PresContext()->GetPresShell();
|
||||
mFrame->PresContext()->GetPresShell();
|
||||
PRBool observes = shell->ObservesNativeAnonMutationsForPrint();
|
||||
shell->ObserveNativeAnonMutationsForPrint(PR_TRUE);
|
||||
mFrame->EnsureEditorInitialized();
|
||||
shell->ObserveNativeAnonMutationsForPrint(observes);
|
||||
mFrame->FinishedInitializer();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// avoids use of nsWeakFrame
|
||||
void Revoke() {
|
||||
mFrame = nsnull;
|
||||
}
|
||||
|
||||
private:
|
||||
nsWeakFrame mWeakFrame;
|
||||
nsTextControlFrame* mFrame;
|
||||
};
|
||||
|
||||
@ -388,6 +397,10 @@ private:
|
||||
*/
|
||||
nsresult GetRootNodeAndInitializeEditor(nsIDOMElement **aRootElement);
|
||||
|
||||
void FinishedInitializer() {
|
||||
Properties().Delete(TextControlInitializer());
|
||||
}
|
||||
|
||||
private:
|
||||
// these packed bools could instead use the high order bits on mState, saving 4 bytes
|
||||
PRPackedBool mUseEditor;
|
||||
|
@ -608,20 +608,61 @@ PRInt32 nsTextFrame::GetContentEnd() const {
|
||||
return next ? next->GetContentOffset() : mContent->GetText()->GetLength();
|
||||
}
|
||||
|
||||
PRInt32 nsTextFrame::GetInFlowContentLength() {
|
||||
#ifdef IBMBIDI
|
||||
nsTextFrame* nextBidi = nsnull;
|
||||
PRInt32 start = -1, end;
|
||||
struct FlowLengthProperty {
|
||||
PRInt32 mStartOffset;
|
||||
// The offset of the next fixed continuation after mStartOffset, or
|
||||
// of the end of the text if there is none
|
||||
PRInt32 mEndFlowOffset;
|
||||
|
||||
if (mState & NS_FRAME_IS_BIDI) {
|
||||
nextBidi = static_cast<nsTextFrame*>(GetLastInFlow()->GetNextContinuation());
|
||||
if (nextBidi) {
|
||||
nextBidi->GetOffsets(start, end);
|
||||
return start - mContentOffset;
|
||||
static void Destroy(void* aObject, nsIAtom* aPropertyName,
|
||||
void* aPropertyValue, void* aData)
|
||||
{
|
||||
delete static_cast<FlowLengthProperty*>(aPropertyValue);
|
||||
}
|
||||
};
|
||||
|
||||
PRInt32 nsTextFrame::GetInFlowContentLength() {
|
||||
if (!(mState & NS_FRAME_IS_BIDI)) {
|
||||
return mContent->TextLength() - mContentOffset;
|
||||
}
|
||||
|
||||
nsTextFrame* nextBidi = nsnull;
|
||||
PRInt32 start = -1, end, endFlow;
|
||||
FlowLengthProperty* flowLength =
|
||||
static_cast<FlowLengthProperty*>(mContent->GetProperty(nsGkAtoms::flowlength));
|
||||
|
||||
if (flowLength && flowLength->mStartOffset <= mContentOffset &&
|
||||
flowLength->mEndFlowOffset > mContentOffset) {
|
||||
#ifdef DEBUG
|
||||
GetOffsets(start, end);
|
||||
NS_ASSERTION(flowLength->mEndFlowOffset >= end,
|
||||
"frame crosses fixed continuation boundary");
|
||||
#endif
|
||||
return flowLength->mEndFlowOffset - mContentOffset;
|
||||
}
|
||||
|
||||
nextBidi = static_cast<nsTextFrame*>(GetLastInFlow()->GetNextContinuation());
|
||||
if (nextBidi) {
|
||||
nextBidi->GetOffsets(start, end);
|
||||
endFlow = start;
|
||||
} else {
|
||||
endFlow = mContent->TextLength();
|
||||
}
|
||||
|
||||
if (!flowLength) {
|
||||
flowLength = new FlowLengthProperty;
|
||||
if (NS_FAILED(mContent->SetProperty(nsGkAtoms::flowlength, flowLength,
|
||||
FlowLengthProperty::Destroy))) {
|
||||
delete flowLength;
|
||||
flowLength = nsnull;
|
||||
}
|
||||
}
|
||||
#endif //IBMBIDI
|
||||
return mContent->TextLength() - mContentOffset;
|
||||
if (flowLength) {
|
||||
flowLength->mStartOffset = mContentOffset;
|
||||
flowLength->mEndFlowOffset = endFlow;
|
||||
}
|
||||
|
||||
return endFlow - mContentOffset;
|
||||
}
|
||||
|
||||
// Smarter versions of XP_IS_SPACE.
|
||||
@ -3649,9 +3690,12 @@ nsTextFrame::Init(nsIContent* aContent,
|
||||
NS_PRECONDITION(aContent->IsNodeOfType(nsINode::eTEXT),
|
||||
"Bogus content!");
|
||||
|
||||
// Remove any NewlineOffsetProperty since it might be invalid
|
||||
// if the content was modified while there was no frame
|
||||
// Remove any NewlineOffsetProperty or InFlowContentLengthProperty since they
|
||||
// might be invalid if the content was modified while there was no frame
|
||||
aContent->DeleteProperty(nsGkAtoms::newline);
|
||||
if (PresContext()->BidiEnabled()) {
|
||||
aContent->DeleteProperty(nsGkAtoms::flowlength);
|
||||
}
|
||||
|
||||
// Since our content has a frame now, this flag is no longer needed.
|
||||
aContent->UnsetFlags(NS_CREATE_FRAME_IF_NON_WHITESPACE);
|
||||
@ -4043,6 +4087,9 @@ NS_IMETHODIMP
|
||||
nsTextFrame::CharacterDataChanged(CharacterDataChangeInfo* aInfo)
|
||||
{
|
||||
mContent->DeleteProperty(nsGkAtoms::newline);
|
||||
if (PresContext()->BidiEnabled()) {
|
||||
mContent->DeleteProperty(nsGkAtoms::flowlength);
|
||||
}
|
||||
|
||||
// Find the first frame whose text has changed. Frames that are entirely
|
||||
// before the text change are completely unaffected.
|
||||
@ -7468,6 +7515,7 @@ void
|
||||
nsTextFrame::AdjustOffsetsForBidi(PRInt32 aStart, PRInt32 aEnd)
|
||||
{
|
||||
AddStateBits(NS_FRAME_IS_BIDI);
|
||||
mContent->DeleteProperty(nsGkAtoms::flowlength);
|
||||
|
||||
/*
|
||||
* After Bidi resolution we may need to reassign text runs.
|
||||
|
@ -32,7 +32,7 @@ load 375562-1.xhtml
|
||||
load 377824-1.xhtml
|
||||
load 379418-1.xhtml
|
||||
load 385226-1.xhtml
|
||||
asserts(2-3) load 393760-1.xhtml # Bug 541620
|
||||
load 393760-1.xhtml
|
||||
load 397518-1.xhtml
|
||||
load 400475-1.xhtml
|
||||
load 402400-1.xhtml
|
||||
|
@ -88,6 +88,10 @@ nsMathMLmfencedFrame::SetInitialChildList(nsIAtom* aListName,
|
||||
nsresult rv = nsMathMLContainerFrame::SetInitialChildList(aListName, aChildList);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// InheritAutomaticData will not get called if our parent is not a mathml
|
||||
// frame, so initialize NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY for
|
||||
// GetPreferredStretchSize() from Reflow().
|
||||
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
// No need to track the style contexts given to our MathML chars.
|
||||
// The Style System will use Get/SetAdditionalStyleContext() to keep them
|
||||
// up-to-date if dynamic changes arise.
|
||||
@ -310,8 +314,6 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsBoundingMetrics containerSize;
|
||||
nsStretchDirection stretchDir = NS_STRETCH_DIRECTION_VERTICAL;
|
||||
|
||||
nsPresentationData presentationData;
|
||||
GetPresentationData(presentationData);
|
||||
GetPreferredStretchSize(*aReflowState.rendContext,
|
||||
0, /* i.e., without embellishments */
|
||||
stretchDir, containerSize);
|
||||
|
@ -89,7 +89,9 @@ for codepoint in range(ord("A"), ord("A") + 1):
|
||||
|
||||
f.generate("mark" + mark + charname + "-" + uposname +
|
||||
"underline.ttf")
|
||||
|
||||
|
||||
# font with a ligature involving a space
|
||||
|
||||
f = fontforge.font()
|
||||
n = "MarkAB-spaceliga"
|
||||
f.fontname = n
|
||||
@ -113,3 +115,30 @@ g.importOutlines("mark2-glyph.svg")
|
||||
g.width = 1800
|
||||
|
||||
f.generate("markAB-spaceliga.otf")
|
||||
|
||||
# font with a known line-height (which is greater than winascent + windescent).
|
||||
|
||||
f = fontforge.font()
|
||||
lineheight = 1500
|
||||
n = "MarkA-lineheight" + str(lineheight)
|
||||
f.fontname = n
|
||||
f.familyname = n
|
||||
f.fullname = n
|
||||
f.copyright = "Copyright (c) 2008-2011 Mozilla Corporation"
|
||||
|
||||
g = f.createChar(ord(" "), "space")
|
||||
g.width = 1000
|
||||
g = f.createChar(ord("A"), "A")
|
||||
g.importOutlines("mark-glyph.svg")
|
||||
g.width = 1500
|
||||
|
||||
f.os2_typoascent_add = False
|
||||
f.os2_typoascent = 800
|
||||
f.os2_typodescent_add = False
|
||||
f.os2_typodescent = -200
|
||||
f.os2_use_typo_metrics = True
|
||||
f.os2_typolinegap = lineheight - (f.os2_typoascent - f.os2_typodescent)
|
||||
# glyph height is 800 (hhea ascender - descender)
|
||||
f.hhea_linegap = lineheight - 800
|
||||
|
||||
f.generate("markA-lineheight" + str(lineheight) + ".ttf")
|
||||
|
BIN
layout/reftests/fonts/markA-lineheight1500.ttf
Normal file
BIN
layout/reftests/fonts/markA-lineheight1500.ttf
Normal file
Binary file not shown.
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#float-blue {
|
||||
float: left;
|
||||
margin-right: 20px;
|
||||
background-color: blue;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
.dyn {
|
||||
display: none;
|
||||
}
|
||||
.float-green {
|
||||
float: left;
|
||||
margin: 0 20px;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementsByClassName('dyn')[0].style.display = 'block';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="float-blue"></div>
|
||||
<div class="float-green dyn"></div>
|
||||
<div class="float-green"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#float-blue {
|
||||
float: right;
|
||||
margin-left: 20px;
|
||||
background-color: blue;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
.dyn {
|
||||
display: none;
|
||||
}
|
||||
.float-green {
|
||||
float: right;
|
||||
margin: 0 20px;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementsByClassName('dyn')[0].style.display = 'block';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="float-blue"></div>
|
||||
<div class="float-green dyn"></div>
|
||||
<div class="float-green"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#float-blue {
|
||||
float: left;
|
||||
margin-right: 20px;
|
||||
background-color: blue;
|
||||
height: 100px;
|
||||
}
|
||||
.dyn {
|
||||
display: none;
|
||||
}
|
||||
.float-green {
|
||||
float: left;
|
||||
margin: 0 20px;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementsByClassName('dyn')[0].style.display = 'block';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="float-blue"><div class="float-green dyn"></div></div><div class="float-green"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#float-blue {
|
||||
float: left;
|
||||
margin: 0 20px;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
.float-green {
|
||||
float: left;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="float-blue"></div><div class="float-green"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#float-blue {
|
||||
float: left;
|
||||
margin-right: 40px;
|
||||
border: solid blue;
|
||||
border-width: 0 20px;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
.float-green {
|
||||
float: left;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="float-blue"></div><div class="float-green"></div>
|
||||
</body>
|
||||
</html>
|
23
layout/reftests/margin-collapsing/block-horizontal-3.html
Normal file
23
layout/reftests/margin-collapsing/block-horizontal-3.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#float-blue {
|
||||
float: left;
|
||||
margin-right: 20px;
|
||||
background-color: blue;
|
||||
height: 100px;
|
||||
}
|
||||
.float-green {
|
||||
float: left;
|
||||
margin: 0 20px;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="float-blue"><div class="float-green"></div></div><div class="float-green"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#float-blue {
|
||||
float: right;
|
||||
margin-left: 20px;
|
||||
background-color: blue;
|
||||
height: 100px;
|
||||
}
|
||||
.dyn {
|
||||
display: none;
|
||||
}
|
||||
.float-green {
|
||||
float: right;
|
||||
margin: 0 20px;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementsByClassName('dyn')[0].style.display = 'block';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="float-blue"><div class="float-green dyn"></div></div><div class="float-green"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#float-blue {
|
||||
float: right;
|
||||
margin: 0 20px;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
.float-green {
|
||||
float: right;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="float-blue"></div><div class="float-green"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#float-blue {
|
||||
float: right;
|
||||
margin-left: 40px;
|
||||
border: solid blue;
|
||||
border-width: 0 20px;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
.float-green {
|
||||
float: right;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="float-blue"></div><div class="float-green"></div>
|
||||
</body>
|
||||
</html>
|
23
layout/reftests/margin-collapsing/block-horizontal-4.html
Normal file
23
layout/reftests/margin-collapsing/block-horizontal-4.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#float-blue {
|
||||
float: right;
|
||||
margin-left: 20px;
|
||||
background-color: blue;
|
||||
height: 100px;
|
||||
}
|
||||
.float-green {
|
||||
float: right;
|
||||
margin: 0 20px;
|
||||
background-color: green;
|
||||
width: 40px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="float-blue"><div class="float-green"></div></div><div class="float-green"></div>
|
||||
</body>
|
||||
</html>
|
20
layout/reftests/margin-collapsing/block-sibling-1-noref.html
Normal file
20
layout/reftests/margin-collapsing/block-sibling-1-noref.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#sibling1 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
#sibling2 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sibling1"></div>
|
||||
<div id="sibling2"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#sibling1 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
#sibling2 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sibling1"></div>
|
||||
<div id="sibling2"></div>
|
||||
</body>
|
||||
</html>
|
29
layout/reftests/margin-collapsing/block-sibling-1a-dyn.html
Normal file
29
layout/reftests/margin-collapsing/block-sibling-1a-dyn.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#sibling1 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#sibling2 {
|
||||
display: none;
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('sibling2').style.display = 'block';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sibling1"></div>
|
||||
<div id="sibling2"></div>
|
||||
</body>
|
||||
</html>
|
29
layout/reftests/margin-collapsing/block-sibling-1b-dyn.html
Normal file
29
layout/reftests/margin-collapsing/block-sibling-1b-dyn.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#sibling1 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#sibling2 {
|
||||
display: none;
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('sibling2').style.display = 'block';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sibling1"></div>
|
||||
<div id="sibling2"></div>
|
||||
</body>
|
||||
</html>
|
29
layout/reftests/margin-collapsing/block-sibling-1c-dyn.html
Normal file
29
layout/reftests/margin-collapsing/block-sibling-1c-dyn.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#sibling1 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#sibling2 {
|
||||
display: none;
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('sibling2').style.display = 'block';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sibling1"></div>
|
||||
<div id="sibling2"></div>
|
||||
</body>
|
||||
</html>
|
40
layout/reftests/margin-collapsing/block-sibling-2-dyn.html
Normal file
40
layout/reftests/margin-collapsing/block-sibling-2-dyn.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#sibling1 {
|
||||
height: 20px;
|
||||
background-color: red;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#sibling2 {
|
||||
display: none;
|
||||
height: 20px;
|
||||
background-color: blue;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
top: 40px;
|
||||
}
|
||||
#sibling3 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 20px;
|
||||
position: relative;
|
||||
top: -40px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('sibling2').style.display = 'block';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sibling1"></div>
|
||||
<div id="sibling2"></div>
|
||||
<div id="sibling3"></div>
|
||||
</body>
|
||||
</html>
|
26
layout/reftests/margin-collapsing/block-sibling-2-noref.html
Normal file
26
layout/reftests/margin-collapsing/block-sibling-2-noref.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#a {
|
||||
height: 20px;
|
||||
background-color: red;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
#b {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#c {
|
||||
height: 20px;
|
||||
background-color: blue;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="a"></div>
|
||||
<div id="b"></div>
|
||||
<div id="c"></div>
|
||||
</body>
|
||||
</html>
|
35
layout/reftests/margin-collapsing/block-sibling-3-dyn.html
Normal file
35
layout/reftests/margin-collapsing/block-sibling-3-dyn.html
Normal file
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#sibling1 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#sibling2 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#sibling3 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('sibling2').style.display = 'none';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sibling1"></div>
|
||||
<div id="sibling2"></div>
|
||||
<div id="sibling3"></div>
|
||||
</body>
|
||||
</html>
|
29
layout/reftests/margin-collapsing/block-sibling-3.html
Normal file
29
layout/reftests/margin-collapsing/block-sibling-3.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#sibling1 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#sibling2 {
|
||||
display: none;
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#sibling3 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sibling1"></div>
|
||||
<div id="sibling2"></div>
|
||||
<div id="sibling3"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- dbaron thinks the validity of this test is questionable, see
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=477462#c20 and #c21 -->
|
||||
<style type="text/css">
|
||||
#table {
|
||||
width: 100px;
|
||||
}
|
||||
#caption1 {
|
||||
height: 20px;
|
||||
background-color: red;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
#caption2 {
|
||||
height: 20px;
|
||||
background-color: blue;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
#caption3 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="table">
|
||||
<div id="caption1"></div>
|
||||
<div id="caption2"></div>
|
||||
<div id="caption3"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- dbaron thinks the validity of this test is questionable, see
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=477462#c20 and #c21 -->
|
||||
<style type="text/css">
|
||||
#table {
|
||||
width: 100px;
|
||||
}
|
||||
#caption1 {
|
||||
height: 20px;
|
||||
background-color: red;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
#caption2 {
|
||||
height: 20px;
|
||||
background-color: blue;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
#caption3 {
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="table">
|
||||
<div id="caption1"></div>
|
||||
<div id="caption2"></div>
|
||||
<div id="caption3"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<!-- dbaron thinks the validity of this test is questionable, see
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=477462#c20 and #c21 -->
|
||||
<style type="text/css">
|
||||
#table {
|
||||
display: table;
|
||||
width: 100px;
|
||||
}
|
||||
#caption1 {
|
||||
display: table-caption;
|
||||
height: 20px;
|
||||
background-color: red;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#caption2 {
|
||||
display: none;
|
||||
height: 20px;
|
||||
background-color: blue;
|
||||
margin: 20px 0;
|
||||
}
|
||||
#caption3 {
|
||||
display: table-caption;
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('caption2').style.display = 'table-caption';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="table">
|
||||
<div id="caption1"></div>
|
||||
<div id="caption2"></div>
|
||||
<div id="caption3"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<!-- dbaron thinks the validity of this test is questionable, see
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=477462#c20 and #c21 -->
|
||||
<style type="text/css">
|
||||
#table {
|
||||
display: table;
|
||||
width: 100px;
|
||||
}
|
||||
#caption1 {
|
||||
display: table-caption;
|
||||
height: 20px;
|
||||
background-color: red;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#caption2 {
|
||||
display: none;
|
||||
height: 20px;
|
||||
background-color: blue;
|
||||
margin: 20px 0;
|
||||
}
|
||||
#caption3 {
|
||||
display: table-caption;
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('caption2').style.display = 'table-caption';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="table">
|
||||
<div id="caption1"></div>
|
||||
<div id="caption2"></div>
|
||||
<div id="caption3"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<!-- dbaron thinks the validity of this test is questionable, see
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=477462#c20 and #c21 -->
|
||||
<style type="text/css">
|
||||
#table {
|
||||
display: table;
|
||||
width: 100px;
|
||||
}
|
||||
#caption1 {
|
||||
display: table-caption;
|
||||
height: 20px;
|
||||
background-color: red;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#caption2 {
|
||||
display: none;
|
||||
height: 20px;
|
||||
background-color: blue;
|
||||
margin: 10px 0;
|
||||
}
|
||||
#caption3 {
|
||||
display: table-caption;
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('caption2').style.display = 'table-caption';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="table">
|
||||
<div id="caption1"></div>
|
||||
<div id="caption2"></div>
|
||||
<div id="caption3"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
46
layout/reftests/margin-collapsing/caption-sibling-2-dyn.html
Normal file
46
layout/reftests/margin-collapsing/caption-sibling-2-dyn.html
Normal file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<!-- dbaron thinks the validity of this test is questionable, see
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=477462#c20 and #c21 -->
|
||||
<style type="text/css">
|
||||
#table {
|
||||
display: table;
|
||||
width: 100px;
|
||||
}
|
||||
#caption1 {
|
||||
display: table-caption;
|
||||
height: 20px;
|
||||
background-color: red;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#caption2 {
|
||||
display: table-caption;
|
||||
height: 20px;
|
||||
background-color: blue;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#caption3 {
|
||||
display: table-caption;
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('caption2').style.display = 'none';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="table">
|
||||
<div id="caption1"></div>
|
||||
<div id="caption2"></div>
|
||||
<div id="caption3"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- dbaron thinks the validity of this test is questionable, see
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=477462#c20 and #c21 -->
|
||||
<style type="text/css">
|
||||
#table {
|
||||
display: table;
|
||||
width: 100px;
|
||||
}
|
||||
#caption1 {
|
||||
display: block;
|
||||
height: 20px;
|
||||
background-color: red;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
#caption3 {
|
||||
display: block;
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="table">
|
||||
<div id="caption1"></div>
|
||||
<div id="caption2"></div>
|
||||
<div id="caption3"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
31
layout/reftests/margin-collapsing/caption-sibling-2-ref.html
Normal file
31
layout/reftests/margin-collapsing/caption-sibling-2-ref.html
Normal file
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- dbaron thinks the validity of this test is questionable, see
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=477462#c20 and #c21 -->
|
||||
<style type="text/css">
|
||||
#table {
|
||||
display: table;
|
||||
width: 100px;
|
||||
}
|
||||
#caption1 {
|
||||
display: block;
|
||||
height: 20px;
|
||||
background-color: red;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#caption3 {
|
||||
display: block;
|
||||
height: 20px;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="table">
|
||||
<div id="caption1"></div>
|
||||
<div id="caption2"></div>
|
||||
<div id="caption3"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#ib1 {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
}
|
||||
#ib2 {
|
||||
display: none;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('ib2').style.display = 'inline-block';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div><span id="ib1">Hello</span><span id="ib2">Kitty</span></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#ib1 {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
#ib2 {
|
||||
display: none;
|
||||
margin-left: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
#ib3 {
|
||||
display: inline-block;
|
||||
margin-left: 40px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('ib2').style.display = 'inline-block';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div><span id="ib1">Hello<span id="ib2">my</span></span><span id="ib3">Kitty</span></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
span {
|
||||
display: inline-block;
|
||||
}
|
||||
#ib2 {
|
||||
margin-left: 10px;
|
||||
margin-right: 40px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div><span id="ib1">Hello<span id="ib2">my</span></span><span id="ib3">Kitty</span></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
span {
|
||||
display: inline-block;
|
||||
}
|
||||
#ib2 {
|
||||
margin-left: 10px;
|
||||
margin-right: 70px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div><span id="ib1">Hello<span id="ib2">my</span></span><span id="ib3">Kitty</span></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#ib1 {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
#ib2 {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
#ib3 {
|
||||
display: inline-block;
|
||||
margin-left: 40px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div><span id="ib1">Hello<span id="ib2">my</span></span><span id="ib3">Kitty</span></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#inline1 {
|
||||
margin-right: 10px;
|
||||
}
|
||||
#inline2 {
|
||||
display: none;
|
||||
margin-left: 20px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('inline2').style.display = 'inline';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div><span id="inline1">Hello</span><span id="inline2">Kitty</span></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#inline1 {
|
||||
margin-right: 10px;
|
||||
}
|
||||
#inline2 {
|
||||
display: none;
|
||||
margin-left: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
#inline3 {
|
||||
margin-left: 40px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function test() {
|
||||
document.getElementById('inline2').style.display = 'inline';
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
document.addEventListener('MozReftestInvalidate', test, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div><span id="inline1">Hello<span id="inline2">my</span></span><span id="inline3">Kitty</span></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#inline2 {
|
||||
margin-left: 10px;
|
||||
margin-right: 40px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div><span id="inline1">Hello<span id="inline2">my</span></span><span id="inline3">Kitty</span></div>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user