diff --git a/content/base/src/nsINode.cpp b/content/base/src/nsINode.cpp index 919e94c659bc..ac121f4d58a7 100644 --- a/content/base/src/nsINode.cpp +++ b/content/base/src/nsINode.cpp @@ -1817,11 +1817,6 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, * actual document fragment). */ if (nodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) { - uint32_t count = fragChildren.ref().Length(); - if (!count) { - return NS_OK; - } - if (!aReplace) { mb.Init(this, true, true); } @@ -1832,6 +1827,11 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, mutationBatch->SetNextSibling(GetChildAt(insPos)); } + uint32_t count = fragChildren.ref().Length(); + if (!count) { + return NS_OK; + } + bool appending = !IsNodeOfType(eDOCUMENT) && uint32_t(insPos) == GetChildCount(); int32_t firstInsPos = insPos; diff --git a/content/base/test/test_mutationobservers.html b/content/base/test/test_mutationobservers.html index 3a48bc787e6c..42f5763e0652 100644 --- a/content/base/test/test_mutationobservers.html +++ b/content/base/test/test_mutationobservers.html @@ -316,6 +316,7 @@ function testChildList5() { var c4 = document.createElement("div"); var c5 = document.createElement("div"); var df = document.createDocumentFragment(); + var emptyDF = document.createDocumentFragment(); var dfc1 = df.appendChild(document.createElement("div")); var dfc2 = df.appendChild(document.createElement("div")); var dfc3 = df.appendChild(document.createElement("div")); @@ -358,6 +359,7 @@ function testChildList5() { div.appendChild(c4); div.appendChild(c5); div.replaceChild(df, c4); + div.appendChild(emptyDF); // empty document shouldn't cause mutation records } function testAdoptNode() { @@ -385,8 +387,9 @@ function testOuterHTML() { var d1 = doc.body.appendChild(document.createElement("div")); var d2 = doc.body.appendChild(document.createElement("div")); var d3 = doc.body.appendChild(document.createElement("div")); + var d4 = doc.body.appendChild(document.createElement("div")); m = new M(function(records, observer) { - is(records.length, 3, "Should have 1 record"); + is(records.length, 4, "Should have 1 record"); is(records[0].removedNodes.length, 1, "Should have 1 removed nodes"); is(records[0].addedNodes.length, 2, "Should have 2 added nodes"); is(records[0].previousSibling, null, ""); @@ -398,7 +401,11 @@ function testOuterHTML() { is(records[2].removedNodes.length, 1, "Should have 1 removed nodes"); is(records[2].addedNodes.length, 2, "Should have 2 added nodes"); is(records[2].previousSibling, records[1].addedNodes[1], ""); - is(records[2].nextSibling, null, ""); + is(records[2].nextSibling, d4, ""); + is(records[3].removedNodes.length, 1, "Should have 1 removed nodes"); + is(records[3].addedNodes.length, 0); + is(records[3].previousSibling, records[2].addedNodes[1], ""); + is(records[3].nextSibling, null, ""); observer.disconnect(); then(testInsertAdjacentHTML); m = null; @@ -407,6 +414,7 @@ function testOuterHTML() { d1.outerHTML = "
1
1
"; d2.outerHTML = "
2
2
"; d3.outerHTML = "
3
3
"; + d4.outerHTML = ""; } function testInsertAdjacentHTML() { diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index b65e5f44a4b4..c685fd69e4c6 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -3257,11 +3257,17 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, if (mDocument && fm) { nsCOMPtr currentWindow; fm->GetFocusedWindow(getter_AddRefs(currentWindow)); - if (currentWindow && currentWindow != mDocument->GetWindow() && + if (currentWindow && mDocument->GetWindow() && + currentWindow != mDocument->GetWindow() && !nsContentUtils::IsChromeDoc(mDocument)) { + nsCOMPtr currentTop; + nsCOMPtr newTop; + currentWindow->GetScriptableTop(getter_AddRefs(currentTop)); + mDocument->GetWindow()->GetScriptableTop(getter_AddRefs(newTop)); nsCOMPtr win = do_QueryInterface(currentWindow); nsCOMPtr currentDoc = do_QueryInterface(win->GetExtantDocument()); - if (nsContentUtils::IsChromeDoc(currentDoc)) { + if (nsContentUtils::IsChromeDoc(currentDoc) || + (currentTop && newTop && currentTop != newTop)) { fm->SetFocusedWindow(mDocument->GetWindow()); } } diff --git a/dom/tests/mochitest/chrome/Makefile.in b/dom/tests/mochitest/chrome/Makefile.in index a740bab5660e..d9a4ccc46ae0 100644 --- a/dom/tests/mochitest/chrome/Makefile.in +++ b/dom/tests/mochitest/chrome/Makefile.in @@ -48,6 +48,8 @@ MOCHITEST_CHROME_FILES = \ test_sandbox_bindings.xul \ test_selectAtPoint.html \ selectAtPoint.html \ + test_bug799299.xul \ + file_bug799299.xul \ $(NULL) ifeq (WINNT,$(OS_ARCH)) diff --git a/dom/tests/mochitest/chrome/file_bug799299.xul b/dom/tests/mochitest/chrome/file_bug799299.xul new file mode 100644 index 000000000000..62fd20ddd9e6 --- /dev/null +++ b/dom/tests/mochitest/chrome/file_bug799299.xul @@ -0,0 +1,62 @@ + + + + + + + + + + + diff --git a/dom/tests/mochitest/chrome/test_bug799299.xul b/dom/tests/mochitest/chrome/test_bug799299.xul new file mode 100644 index 000000000000..9819f95a1d30 --- /dev/null +++ b/dom/tests/mochitest/chrome/test_bug799299.xul @@ -0,0 +1,31 @@ + + + + + + + diff --git a/python/mach/mach/mixin/process.py b/python/mach/mach/mixin/process.py index 50d4e68f69a8..b504f0b78cb0 100644 --- a/python/mach/mach/mixin/process.py +++ b/python/mach/mach/mixin/process.py @@ -123,3 +123,4 @@ class ProcessExecutionMixin(LoggingMixin): # '-c' and pass all the arguments as one argument because that is # how sh works. cline = subprocess.list2cmdline([prog] + args[1:]) + return [_current_shell, '-c', cline] diff --git a/python/mozbuild/README.rst b/python/mozbuild/README.rst index 7256b9ee0f5f..bd621fae3550 100644 --- a/python/mozbuild/README.rst +++ b/python/mozbuild/README.rst @@ -10,5 +10,4 @@ Modules Overview * mozbuild.compilation -- Functionality related to compiling. This includes managing compiler warnings. -* mozbuild.testing -- Interfaces for running tests. diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index ab69115655d9..17ec445200be 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -267,8 +267,6 @@ class MozbuildObject(ProcessExecutionMixin): def _run_command_in_objdir(self, **args): self.run_process(cwd=self.topobjdir, **args) - return [_current_shell, '-c', cline] - def _is_windows(self): return os.name in ('nt', 'ce') diff --git a/python/mozbuild/mozbuild/test/test_base.py b/python/mozbuild/mozbuild/test/test_base.py index 5206492a98ab..5b9f0fdf3425 100644 --- a/python/mozbuild/mozbuild/test/test_base.py +++ b/python/mozbuild/mozbuild/test/test_base.py @@ -9,10 +9,12 @@ import unittest from tempfile import NamedTemporaryFile -from mozbuild.base import BuildConfig -from mozbuild.base import MozbuildObject -from mozbuild.config import ConfigSettings -from mozbuild.logger import LoggingManager +from mach.logging import LoggingManager + +from mozbuild.base import ( + BuildConfig, + MozbuildObject, +) curdir = os.path.dirname(__file__) @@ -20,20 +22,9 @@ topsrcdir = os.path.normpath(os.path.join(curdir, '..', '..', '..', '..')) log_manager = LoggingManager() -class TestBuildConfig(unittest.TestCase): - def test_basic(self): - c = ConfigSettings() - c.register_provider(BuildConfig) - - c.build.threads = 6 - - class TestMozbuildObject(unittest.TestCase): def get_base(self): - settings = ConfigSettings() - settings.register_provider(BuildConfig) - - return MozbuildObject(topsrcdir, settings, log_manager) + return MozbuildObject(topsrcdir, None, log_manager) def test_mozconfig_parsing(self): with NamedTemporaryFile(mode='wt') as mozconfig: diff --git a/testing/marionette/client/marionette/emulator.py b/testing/marionette/client/marionette/emulator.py index 35d2c2071aa0..396082b417e1 100644 --- a/testing/marionette/client/marionette/emulator.py +++ b/testing/marionette/client/marionette/emulator.py @@ -333,6 +333,7 @@ class Emulator(object): # need to remount so we can write to /system/b2g self._run_adb(['remount']) self._run_adb(['shell', 'stop', 'b2g']) + self._run_adb(['shell', 'rm', '-rf', '/system/b2g/*.so']) print 'installing gecko binaries' self._run_adb(['push', self.gecko_path, '/system/b2g']) print 'restarting B2G'