/src/mozilla-central/dom/script/ScriptTrace.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "ScriptTrace.h" |
8 | | |
9 | | namespace mozilla { |
10 | | namespace dom { |
11 | | namespace script { |
12 | | |
13 | | static nsresult |
14 | | TestingDispatchEvent(nsIScriptElement* aScriptElement, |
15 | | const nsAString& aEventType) |
16 | 0 | { |
17 | 0 | static bool sExposeTestInterfaceEnabled = false; |
18 | 0 | static bool sExposeTestInterfacePrefCached = false; |
19 | 0 | if (!sExposeTestInterfacePrefCached) { |
20 | 0 | sExposeTestInterfacePrefCached = true; |
21 | 0 | Preferences::AddBoolVarCache(&sExposeTestInterfaceEnabled, |
22 | 0 | "dom.expose_test_interfaces", |
23 | 0 | false); |
24 | 0 | } |
25 | 0 | if (!sExposeTestInterfaceEnabled) { |
26 | 0 | return NS_OK; |
27 | 0 | } |
28 | 0 | |
29 | 0 | nsCOMPtr<nsINode> target(do_QueryInterface(aScriptElement)); |
30 | 0 | if (!target) { |
31 | 0 | return NS_OK; |
32 | 0 | } |
33 | 0 | |
34 | 0 | RefPtr<AsyncEventDispatcher> dispatcher = |
35 | 0 | new AsyncEventDispatcher(target, |
36 | 0 | aEventType, |
37 | 0 | CanBubble::eYes, |
38 | 0 | ChromeOnlyDispatch::eNo); |
39 | 0 | return dispatcher->PostDOMEvent(); |
40 | 0 | } |
41 | | |
42 | | } // script namespace |
43 | | } // dom namespace |
44 | | } // mozilla namespace |