зеркало из https://github.com/mozilla/gecko-dev.git
Bug 479408 - search engine discovery code doesn't properly handle frames ("browser is null" in BrowserSearch::addEngine). r=gavin
This commit is contained in:
Родитель
3c2c814d1a
Коммит
a6523317b2
|
@ -2903,6 +2903,9 @@ const BrowserSearch = {
|
|||
return;
|
||||
|
||||
var browser = gBrowser.getBrowserForDocument(targetDoc);
|
||||
// ignore search engines from subframes (see bug 479408)
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
// Check to see whether we've already added an engine with this title
|
||||
if (browser.engines) {
|
||||
|
@ -2914,8 +2917,8 @@ const BrowserSearch = {
|
|||
// Use documentURIObject in the check for shouldLoadFavIcon so that we
|
||||
// do the right thing with about:-style error pages. Bug 453442
|
||||
var iconURL = null;
|
||||
if (gBrowser.shouldLoadFavIcon(browser.contentDocument.documentURIObject))
|
||||
iconURL = browser.currentURI.prePath + "/favicon.ico";
|
||||
if (gBrowser.shouldLoadFavIcon(targetDoc.documentURIObject))
|
||||
iconURL = targetDoc.documentURIObject.prePath + "/favicon.ico";
|
||||
|
||||
var hidden = false;
|
||||
// If this engine (identified by title) is already in the list, add it
|
||||
|
@ -6090,7 +6093,7 @@ var FeedHandler = {
|
|||
// find which tab this is for, and set the attribute on the browser
|
||||
var browserForLink = gBrowser.getBrowserForDocument(targetDoc);
|
||||
if (!browserForLink) {
|
||||
// ??? this really shouldn't happen..
|
||||
// ignore feeds loaded in subframes (see bug 305472)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6100,7 +6103,7 @@ var FeedHandler = {
|
|||
|
||||
feeds.push(feed);
|
||||
browserForLink.feeds = feeds;
|
||||
if (browserForLink == gBrowser || browserForLink == gBrowser.mCurrentBrowser) {
|
||||
if (browserForLink == gBrowser.mCurrentBrowser) {
|
||||
var feedButton = document.getElementById("feed-button");
|
||||
if (feedButton)
|
||||
feedButton.collapsed = false;
|
||||
|
|
|
@ -89,6 +89,8 @@ _BROWSER_FILES = browser_bug321000.js \
|
|||
browser_sanitize-sitepermissions.js \
|
||||
browser_bug356571.js \
|
||||
browser_sanitize-passwordDisabledHosts.js \
|
||||
browser_bug479408.js \
|
||||
browser_bug479408_sample.html \
|
||||
$(NULL)
|
||||
|
||||
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
function test() {
|
||||
waitForExplicitFinish();
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab(
|
||||
"http://localhost:8888/browser/browser/base/content/test/browser_bug479408_sample.html");
|
||||
|
||||
gBrowser.addEventListener("DOMLinkAdded", function(aEvent) {
|
||||
gBrowser.removeEventListener("DOMLinkAdded", arguments.callee, true);
|
||||
|
||||
executeSoon(function() {
|
||||
ok(!tab.linkedBrowser.engines,
|
||||
"the subframe's search engine wasn't detected");
|
||||
|
||||
gBrowser.removeTab(tab);
|
||||
finish();
|
||||
});
|
||||
}, true);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Testcase for bug 479408</title>
|
||||
|
||||
<iframe src='data:text/html,<link%20rel="search"%20type="application/opensearchdescription+xml"%20title="Search%20bug%20479408"%20href="http://example.com/search.xml">'>
|
Загрузка…
Ссылка в новой задаче