зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1438579 - Refer to the tabbrowser element as gBrowser instead of #content;r=dao
Since gBrowser is going to become a plain JS object instead of a DOM node, we don't want any callers directly referring to the DOM node to get ahold of it. MozReview-Commit-ID: KbE5dlTWmS --HG-- extra : rebase_source : ef4caea778db406205b58b9f007846dabb062978
This commit is contained in:
Родитель
ad499c708e
Коммит
1477c8b486
|
@ -640,7 +640,6 @@
|
|||
#endif
|
||||
|
||||
<tabs id="tabbrowser-tabs"
|
||||
tabbrowser="content"
|
||||
flex="1"
|
||||
setfocus="false"
|
||||
tooltip="tabbrowser-tab-tooltip"
|
||||
|
|
|
@ -6456,7 +6456,7 @@
|
|||
</destructor>
|
||||
|
||||
<field name="tabbrowser" readonly="true">
|
||||
document.getElementById(this.getAttribute("tabbrowser"));
|
||||
gBrowser;
|
||||
</field>
|
||||
|
||||
<field name="tabbox" readonly="true">
|
||||
|
|
|
@ -1332,7 +1332,7 @@ BrowserGlue.prototype = {
|
|||
var browser = browserEnum.getNext();
|
||||
if (!PrivateBrowsingUtils.isWindowPrivate(browser))
|
||||
allWindowsPrivate = false;
|
||||
var tabbrowser = browser.document.getElementById("content");
|
||||
var tabbrowser = browser.ownerGlobal.gBrowser;
|
||||
if (tabbrowser)
|
||||
pagecount += tabbrowser.browsers.length - tabbrowser._numPinnedTabs;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ var FormValidationHandler =
|
|||
|
||||
_onPopupHiding(aEvent) {
|
||||
aEvent.originalTarget.removeEventListener("popuphiding", this, true);
|
||||
let tabBrowser = aEvent.originalTarget.ownerDocument.getElementById("content");
|
||||
let tabBrowser = aEvent.originalTarget.ownerGlobal.gBrowser;
|
||||
tabBrowser.selectedBrowser.removeEventListener("scroll", this, true);
|
||||
tabBrowser.selectedBrowser.removeEventListener("FullZoomChange", this);
|
||||
tabBrowser.selectedBrowser.removeEventListener("TextZoomChange", this);
|
||||
|
|
|
@ -154,7 +154,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
// bug 1331449.
|
||||
win.document.getElementById("browser-bottombox")
|
||||
.setAttribute("devtoolstheme", devtoolsTheme);
|
||||
win.document.getElementById("content")
|
||||
win.document.getElementById("appcontent")
|
||||
.setAttribute("devtoolstheme", devtoolsTheme);
|
||||
},
|
||||
|
||||
|
|
|
@ -15,18 +15,18 @@ add_task(function* testDevtoolsTheme() {
|
|||
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
|
||||
is(document.getElementById("browser-bottombox").getAttribute("devtoolstheme"), "light",
|
||||
"The element has an attribute based on devtools theme.");
|
||||
is(document.getElementById("content").getAttribute("devtoolstheme"), "light",
|
||||
is(document.getElementById("appcontent").getAttribute("devtoolstheme"), "light",
|
||||
"The element has an attribute based on devtools theme.");
|
||||
|
||||
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
|
||||
is(document.getElementById("browser-bottombox").getAttribute("devtoolstheme"), "dark",
|
||||
"The element has an attribute based on devtools theme.");
|
||||
is(document.getElementById("content").getAttribute("devtoolstheme"), "dark",
|
||||
is(document.getElementById("appcontent").getAttribute("devtoolstheme"), "dark",
|
||||
"The element has an attribute based on devtools theme.");
|
||||
|
||||
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "firebug");
|
||||
is(document.getElementById("browser-bottombox").getAttribute("devtoolstheme"), "light",
|
||||
"The element has 'light' as a default for the devtoolstheme attribute.");
|
||||
is(document.getElementById("content").getAttribute("devtoolstheme"), "light",
|
||||
is(document.getElementById("appcontent").getAttribute("devtoolstheme"), "light",
|
||||
"The element has 'light' as a default for the devtoolstheme attribute.");
|
||||
});
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
--devtools-splitter-inline-end-width: 4px;
|
||||
}
|
||||
|
||||
#content[devtoolstheme="light"] {
|
||||
#appcontent[devtoolstheme="light"] {
|
||||
/* These variables are used in browser.xul but inside the toolbox they are overridden by --theme-splitter-color */
|
||||
--devtools-splitter-color: #dde1e4;
|
||||
}
|
||||
|
||||
#content[devtoolstheme="dark"] {
|
||||
#appcontent[devtoolstheme="dark"] {
|
||||
--devtools-splitter-color: #42484f;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ class TestSafeBrowsingNotificationBar(PuppeteerMixin, MarionetteTestCase):
|
|||
with self.marionette.using_context('chrome'):
|
||||
# TODO: update to use safe browsing notification bar class when bug 1139544 lands
|
||||
label = self.browser.localize_property(button_property)
|
||||
button = (self.marionette.find_element(By.ID, 'content')
|
||||
button = (self.marionette.find_element(By.TAG_NAME, 'tabbrowser')
|
||||
.find_element('anon attribute', {'label': label}))
|
||||
|
||||
self.browser.tabbar.open_tab(lambda _: button.click())
|
||||
|
@ -132,7 +132,7 @@ class TestSafeBrowsingNotificationBar(PuppeteerMixin, MarionetteTestCase):
|
|||
with self.marionette.using_context('chrome'):
|
||||
# TODO: update to use safe browsing notification bar class when bug 1139544 lands
|
||||
label = self.browser.localize_property('safebrowsing.getMeOutOfHereButton.label')
|
||||
button = (self.marionette.find_element(By.ID, 'content')
|
||||
button = (self.marionette.find_element(By.TAG_NAME, 'tabbrowser')
|
||||
.find_element('anon attribute', {'label': label}))
|
||||
button.click()
|
||||
|
||||
|
@ -144,7 +144,7 @@ class TestSafeBrowsingNotificationBar(PuppeteerMixin, MarionetteTestCase):
|
|||
def check_x_button(self):
|
||||
with self.marionette.using_context('chrome'):
|
||||
# TODO: update to use safe browsing notification bar class when bug 1139544 lands
|
||||
button = (self.marionette.find_element(By.ID, 'content')
|
||||
button = (self.marionette.find_element(By.TAG_NAME, 'tabbrowser')
|
||||
.find_element('anon attribute', {'value': 'blocked-badware-page'})
|
||||
.find_element('anon attribute',
|
||||
{'class': 'messageCloseButton close-icon tabbable'}))
|
||||
|
|
|
@ -883,7 +883,7 @@ SimpleTest.waitForFocus = function (callback, targetWindow, expectBlankPage) {
|
|||
if (isWrapper) {
|
||||
// Look for a tabbrowser and see if targetWindow corresponds to one
|
||||
// within that tabbrowser. If not, just return.
|
||||
var tabBrowser = document.getElementsByTagName("tabbrowser")[0] || null;
|
||||
var tabBrowser = window.gBrowser || null;
|
||||
browser = tabBrowser ? tabBrowser.getBrowserForContentWindow(targetWindow.top) : null;
|
||||
if (!browser) {
|
||||
SimpleTest.info("child process window cannot be focused");
|
||||
|
|
|
@ -410,9 +410,10 @@
|
|||
<method name="getTabBrowser">
|
||||
<body>
|
||||
<![CDATA[
|
||||
for (let node = this.parentNode; node instanceof Element; node = node.parentNode) {
|
||||
if (node.localName == "tabbrowser")
|
||||
return node;
|
||||
if (this.ownerGlobal.gBrowser &&
|
||||
this.ownerGlobal.gBrowser.getTabForBrowser &&
|
||||
this.ownerGlobal.gBrowser.getTabForBrowser(this)) {
|
||||
return this.ownerGlobal.gBrowser;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
|
|
Загрузка…
Ссылка в новой задаче