Permalink
Browse files

Merge the last PGO-green inbound changeset to m-c.

  • Loading branch information...
2 parents eda85e3 + 48684a1 commit c4d52ce2d321fb9012af10611a8b9c3753d5ab86 @rvandermeulen rvandermeulen committed Mar 26, 2013
Showing with 7,015 additions and 4,644 deletions.
  1. +1 −1 browser/base/content/browser-social.js
  2. +1 −1 browser/base/content/test/social/blocklist.xml
  3. +52 −41 browser/base/content/test/social/browser_addons.js
  4. +29 −23 browser/base/content/test/social/browser_blocklist.js
  5. +8 −0 browser/base/content/test/social/head.js
  6. +1 −1 browser/extensions/pdfjs/README.mozilla
  7. +155 −0 browser/extensions/pdfjs/components/PdfRedirector.js
  8. +15 −16 browser/extensions/pdfjs/components/PdfStreamConverter.js
  9. +23 −4 browser/extensions/pdfjs/content/PdfJs.jsm
  10. +260 −65 browser/extensions/pdfjs/content/build/pdf.js
  11. +5 −0 browser/extensions/pdfjs/content/web/viewer.css
  12. +46 −49 browser/extensions/pdfjs/content/web/viewer.js
  13. +1 −0 browser/extensions/pdfjs/extension-files
  14. +103 −64 browser/metro/base/content/contenthandlers/SelectionHandler.js
  15. +2 −2 browser/modules/Social.jsm
  16. +22 −6 build/mobile/sutagent/android/DoCommand.java
  17. +2 −3 configure.in
  18. +9 −0 content/base/public/nsContentUtils.h
  19. +6 −0 content/base/public/nsIDocument.h
  20. +1 −1 content/base/src/DocumentFragment.cpp
  21. +12 −0 content/base/src/DocumentFragment.h
  22. +36 −12 content/base/src/Element.cpp
  23. +22 −0 content/base/src/nsContentUtils.cpp
  24. +33 −0 content/base/src/nsDocument.cpp
  25. +6 −0 content/base/src/nsDocument.h
  26. +3 −1 content/base/src/nsDocumentEncoder.cpp
  27. +4 −2 content/base/src/nsINode.cpp
  28. +43 −0 content/base/src/nsNodeUtils.cpp
  29. +16 −0 content/base/src/nsNodeUtils.h
  30. +7 −2 content/html/content/public/nsITextControlElement.h
  31. +94 −0 content/html/content/src/HTMLTemplateElement.cpp
  32. +59 −0 content/html/content/src/HTMLTemplateElement.h
  33. +9 −0 content/html/content/src/HTMLTextAreaElement.cpp
  34. +1 −0 content/html/content/src/HTMLTextAreaElement.h
  35. +2 −0 content/html/content/src/Makefile.in
  36. +1 −0 content/html/content/src/nsGenericHTMLElement.h
  37. +14 −0 content/html/content/src/nsHTMLInputElement.cpp
  38. +1 −0 content/html/content/src/nsHTMLInputElement.h
  39. +3 −1 content/html/content/src/nsTextEditorState.cpp
  40. +2 −0 content/html/content/src/nsTextEditorState.h
  41. +1 −0 content/html/content/test/test_bug389797.html
  42. +53 −68 content/html/document/src/nsHTMLDocument.cpp
  43. +4 −4 content/html/document/src/nsHTMLDocument.h
  44. +3 −4 content/html/document/src/nsIHTMLDocument.h
  45. +1 −1 content/media/webaudio/AudioContext.cpp
  46. +1 −1 content/media/webaudio/test/test_delayNode.html
  47. +2 −2 db/sqlite3/README.MOZILLA
  48. +1,309 −614 db/sqlite3/src/sqlite3.c
  49. +14 −4 db/sqlite3/src/sqlite3.h
  50. +16 −13 dom/alarm/test/test_alarm_non_permitted_app.html
  51. +0 −1 dom/alarm/test/test_alarm_permitted_app.html
  52. +39 −10 dom/apps/src/FreeSpaceWatcher.jsm
  53. +4 −0 dom/apps/src/Webapps.js
  54. +40 −18 dom/apps/src/Webapps.jsm
  55. +4 −3 dom/base/nsDOMClassInfo.cpp
  56. +6 −0 dom/bindings/Bindings.conf
  57. +1 −0 dom/bluetooth/BluetoothOppManager.cpp
  58. +29 −19 dom/bluetooth/linux/BluetoothDBusService.cpp
  59. +17 −14 dom/mms/src/ril/MmsService.js
  60. +2 −1 dom/power/moz.build
  61. +5 −5 dom/power/test/test_power_basics.html
  62. +1 −0 dom/tests/browser/browser_bug396843.js
  63. +1 −0 dom/tests/mochitest/bugs/test_bug396843.html
  64. +1 −0 dom/tests/mochitest/webcomponents/Makefile.in
  65. +145 −0 dom/tests/mochitest/webcomponents/test_template.html
  66. +15 −0 dom/webidl/HTMLTemplateElement.webidl
  67. +1 −0 dom/webidl/WebIDL.mk
  68. +1 −0 editor/libeditor/html/nsHTMLEditUtils.cpp
  69. +2 −0 gfx/cairo/README
  70. +9 −1 gfx/cairo/cairo/src/cairo-xlib-surface.c
  71. +66 −0 gfx/cairo/xlib-flush-glyphs.patch
  72. +11 −1 gfx/thebes/gfxPlatform.cpp
  73. +1 −0 ipc/ipdl/ipdl/builtin.py
  74. +10 −3 ipc/ipdl/ipdl/lower.py
  75. +6 −2 js/public/MemoryMetrics.h
  76. +5 −5 js/src/Makefile.in
  77. +4 −4 js/src/builtin/ParallelArray.cpp
  78. +15 −0 js/src/configure.in
  79. +1 −1 js/src/frontend/Parser-inl.h
  80. +34 −11 js/src/frontend/Parser.cpp
  81. +10 −4 js/src/frontend/Parser.h
  82. +41 −1 js/src/frontend/TokenStream.h
  83. +1 −1 js/src/gc/Barrier.h
  84. +32 −0 js/src/jit-test/tests/asm.js/testBasic.js
  85. +1 −1 js/src/jit-test/tests/auto-regress/bug680797.js
  86. +6 −0 js/src/jit-test/tests/basic/bug854137.js
  87. +1 −1 js/src/jsfun.h
  88. +37 −0 js/src/jsobj.cpp
  89. +1 −1 js/src/jsobj.h
  90. +1 −36 js/src/jsobjinlines.h
  91. +0 −1 js/src/jstypedarray.cpp
  92. +23 −5 js/xpconnect/src/XPCJSRuntime.cpp
  93. 0 layout/base/crashtests/317934-1-inner.html
  94. 0 layout/forms/crashtests/317502-1.xhtml
  95. 0 layout/generic/crashtests/289864-1.html
  96. BIN layout/generic/crashtests/289864-1.jpg
  97. 0 layout/generic/crashtests/592118.html
  98. +48 −2 layout/generic/nsContainerFrame.cpp
  99. 0 layout/generic/test/file_bug514732_window.xul
  100. +1 −0 layout/moz.build
  101. BIN layout/reftests/backgrounds/green-circle-alpha-32x32.png
  102. BIN layout/reftests/fonts/sil/PigLatinBenchmark_v3.ttf
  103. BIN layout/reftests/fonts/sil/Scheherazade-R 2012-07-03c.ttf
  104. 0 layout/style/crashtests/592698-1.html
  105. +1 −1 layout/style/html.css
  106. 0 layout/svg/crashtests/322215-1.svg
  107. +4 −1 layout/svg/nsSVGTextFrame2.cpp
  108. 0 layout/tables/crashtests/308752-1-inner.html
  109. 0 layout/tables/crashtests/308752-2-inner.html
  110. 0 layout/tables/crashtests/316636-1.html
  111. +19 −0 layout/tools/recording/Makefile.in
  112. +4 −0 layout/tools/recording/jar.mn
  113. +6 −0 layout/tools/recording/moz.build
  114. +73 −0 layout/tools/recording/recording-cmdline.js
  115. +3 −0 layout/tools/recording/recording-cmdline.manifest
  116. +53 −0 layout/tools/recording/recording.js
  117. +22 −0 layout/tools/recording/recording.xul
  118. 0 layout/xul/grid/crashtests/311710-1.xul
  119. 0 layout/xul/grid/crashtests/312784-1.xul
  120. 0 layout/xul/grid/crashtests/313173-1-inner.xul
  121. +1 −1 media/libcubeb/README_MOZILLA
  122. +9 −3 media/libcubeb/src/cubeb_opensl.c
  123. +1 −1 media/libcubeb/update.sh
  124. +32 −10 media/mtransport/nricectx.cpp
  125. +3 −0 media/mtransport/nricectx.h
  126. +5 −4 media/mtransport/test/transport_unittests.cpp
  127. +90 −21 media/mtransport/transportflow.cpp
  128. +12 −5 media/mtransport/transportflow.h
  129. +23 −20 media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
  130. +54 −40 media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
  131. +17 −13 media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
  132. +19 −45 media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
  133. +2 −2 media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
  134. +99 −25 media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
  135. +34 −32 media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
  136. +20 −6 media/webrtc/signaling/test/mediapipeline_unittest.cpp
  137. +9 −25 media/webrtc/signaling/test/signaling_unittests.cpp
  138. +101 −76 mfbt/TypeTraits.h
  139. +19 −3 mobile/android/base/GeckoApp.java
  140. +10 −4 mobile/android/base/GeckoAppShell.java
  141. +3 −5 mobile/android/base/TextSelection.java
  142. +29 −18 mobile/android/base/WebAppAllocator.java
  143. +1 −1 mobile/android/build.mk
  144. +103 −0 mobile/android/chrome/content/ConsoleAPI.js
  145. +64 −0 mobile/android/chrome/content/MemoryObserver.js
  146. +55 −72 mobile/android/chrome/content/SelectionHandler.js
  147. +100 −0 mobile/android/chrome/content/WebrtcUI.js
  148. +104 −345 mobile/android/chrome/content/browser.js
  149. +3 −0 mobile/android/chrome/jar.mn
  150. +2 −0 mobile/android/installer/package-manifest.in
  151. +1 −1 netwerk/base/src/nsMediaFragmentURIParser.cpp
  152. +25 −1 netwerk/sctp/datachannel/DataChannel.cpp
  153. +10 −5 parser/html/javasrc/ElementName.java
  154. +6 −4 parser/html/javasrc/MetaScanner.java
  155. +6 −4 parser/html/javasrc/Tokenizer.java
  156. +399 −197 parser/html/javasrc/TreeBuilder.java
  157. +6 −0 parser/html/nsHtml5ArrayCopy.h
  158. +4 −4 parser/html/nsHtml5AtomList.h
  159. +1 −1 parser/html/nsHtml5AttributeName.cpp
  160. +83 −79 parser/html/nsHtml5ElementName.cpp
  161. +1 −0 parser/html/nsHtml5ElementName.h
  162. +4 −4 parser/html/nsHtml5MetaScanner.cpp
  163. +10 −10 parser/html/nsHtml5Tokenizer.cpp
  164. +302 −84 parser/html/nsHtml5TreeBuilder.cpp
  165. +25 −14 parser/html/nsHtml5TreeBuilder.h
  166. +10 −0 parser/html/nsHtml5TreeBuilderCppSupplement.h
  167. +2 −0 parser/html/nsHtml5TreeBuilderHSupplement.h
  168. +9 −0 parser/html/nsHtml5TreeOperation.cpp
  169. +1 −0 parser/html/nsHtml5TreeOperation.h
  170. +1 −0 parser/htmlparser/public/nsHTMLTagList.h
  171. +9 −0 parser/htmlparser/src/nsElementTable.cpp
  172. +2 −0 parser/htmlparser/src/nsHTMLTags.cpp
  173. +21 −15 security/manager/boot/src/nsSTSPreloadList.errors
  174. +33 −6 security/manager/boot/src/nsSTSPreloadList.inc
  175. +10 −6 services/datareporting/policy.jsm
  176. +2 −1 services/datareporting/tests/xpcshell/test_policy.js
  177. +3 −0 testing/mochitest/Makefile.in
  178. +0 −2 testing/mochitest/b2g.json
  179. +6 −6 toolkit/components/social/SocialService.jsm
  180. +0 −9 toolkit/content/widgets/textbox.xml
  181. +303 −0 tools/profiler/BreakpadSampler.cpp
  182. +14 −29 tools/profiler/GeckoProfilerFunc.h
  183. +14 −65 tools/profiler/GeckoProfilerImpl.h
  184. +3 −2 tools/profiler/Makefile.in
  185. +120 −38 tools/profiler/{ProfileEntry2.cpp → ProfileEntry.cpp}
  186. +29 −18 tools/profiler/{ProfileEntry2.h → ProfileEntry.h}
  187. +111 −0 tools/profiler/SaveProfileTask.h
  188. +19 −841 tools/profiler/TableTicker.cpp
  189. +105 −0 tools/profiler/TableTicker.h
  190. +0 −1,007 tools/profiler/TableTicker2.cpp
  191. +37 −37 tools/profiler/UnwinderThread2.cpp
  192. +4 −4 tools/profiler/UnwinderThread2.h
  193. +451 −0 tools/profiler/platform.cpp
  194. +17 −1 tools/profiler/platform.h
  195. +14 −0 uriloader/exthandler/nsExternalHelperAppService.cpp
  196. +1 −1 widget/xpwidgets/nsNativeTheme.h
  197. +363 −208 xpcom/base/nsCycleCollector.cpp
  198. +8 −1 xpcom/base/nsCycleCollector.h
  199. +8 −2 xpcom/build/nsXPComInit.cpp
@@ -226,7 +226,7 @@ let SocialUI = {
return;
}
}
- Social.installProvider(targetDoc.location.href, data, function(manifest) {
+ Social.installProvider(targetDoc, data, function(manifest) {
this.doActivation(manifest.origin);
}.bind(this));
},
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
<emItems>
- <emItem blockID="s1" id="bad.com@services.mozilla.org"></emItem>
+ <emItem blockID="s1" id="test1.example.com@services.mozilla.org"></emItem>
</emItems>
</blocklist>
@@ -17,10 +17,10 @@ let manifest = { // normal provider
};
let manifest2 = { // used for testing install
name: "provider 2",
- origin: "https://example1.com",
- sidebarURL: "https://example1.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example1.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example1.com/browser/browser/base/content/test/moz.png"
+ origin: "https://test1.example.com",
+ sidebarURL: "https://test1.example.com/browser/browser/base/content/test/social/social_sidebar.html",
+ workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js",
+ iconURL: "https://test1.example.com/browser/browser/base/content/test/moz.png"
};
function test() {
@@ -174,62 +174,73 @@ var tests = {
// we expect the addon install dialog to appear, we need to accept the
// install from the dialog.
- let windowListener = {
+ info("Waiting for install dialog");
+ Services.wm.addListener({
onWindowTitleChange: function() {},
onCloseWindow: function() {},
- onOpenWindow: function(window) {
- var domwindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ onOpenWindow: function(xulwindow) {
+ Services.wm.removeListener(this);
+ var domwindow = xulwindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow);
- var self = this;
waitForFocus(function() {
- self.windowReady(domwindow);
- }, domwindow);
- },
- windowReady: function(window) {
- if (window.document.location.href == XPINSTALL_URL) {
+ info("Saw install dialog");
+ is(domwindow.document.location.href, XPINSTALL_URL, "Should have seen the right window open");
// Initially the accept button is disabled on a countdown timer
- var button = window.document.documentElement.getButton("accept");
+ var button = domwindow.document.documentElement.getButton("accept");
button.disabled = false;
- window.document.documentElement.acceptDialog();
- Services.wm.removeListener(windowListener);
- }
+ domwindow.document.documentElement.acceptDialog();
+ }, domwindow);
}
- };
- Services.wm.addListener(windowListener);
-
- let installFrom = "https://example1.com";
- Services.prefs.setCharPref("social.whitelist", "");
- is(SocialService.getOriginActivationType(installFrom), "foreign", "testing foriegn install");
- Social.installProvider(installFrom, manifest2, function(addonManifest) {
- Services.prefs.clearUserPref("social.whitelist");
- SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
- Social.uninstallProvider(addonManifest.origin);
+ });
+
+ let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html"
+ addTab(activationURL, function(tab) {
+ let doc = tab.linkedBrowser.contentDocument;
+ let installFrom = doc.nodePrincipal.origin;
+ Services.prefs.setCharPref("social.whitelist", "");
+ is(SocialService.getOriginActivationType(installFrom), "foreign", "testing foriegn install");
+ Social.installProvider(doc, manifest2, function(addonManifest) {
+ Services.prefs.clearUserPref("social.whitelist");
+ SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
+ Social.uninstallProvider(addonManifest.origin);
+ gBrowser.removeTab(tab);
+ });
});
});
},
testWhitelistInstall: function(next) {
AddonManager.addAddonListener(installListener(next));
- let installFrom = "https://example1.com";
- Services.prefs.setCharPref("social.whitelist", installFrom);
- is(SocialService.getOriginActivationType(installFrom), "whitelist", "testing whitelist install");
- Social.installProvider(installFrom, manifest2, function(addonManifest) {
- Services.prefs.clearUserPref("social.whitelist");
- SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
- Social.uninstallProvider(addonManifest.origin);
+ let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html"
+ addTab(activationURL, function(tab) {
+ let doc = tab.linkedBrowser.contentDocument;
+ let installFrom = doc.nodePrincipal.origin;
+ Services.prefs.setCharPref("social.whitelist", installFrom);
+ is(SocialService.getOriginActivationType(installFrom), "whitelist", "testing whitelist install");
+ Social.installProvider(doc, manifest2, function(addonManifest) {
+ Services.prefs.clearUserPref("social.whitelist");
+ SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
+ Social.uninstallProvider(addonManifest.origin);
+ gBrowser.removeTab(tab);
+ });
});
});
},
testDirectoryInstall: function(next) {
AddonManager.addAddonListener(installListener(next));
- let installFrom = "https://addons.allizom.org";
- Services.prefs.setCharPref("social.directories", installFrom);
- is(SocialService.getOriginActivationType(installFrom), "directory", "testing directory install");
- Social.installProvider(installFrom, manifest2, function(addonManifest) {
- Services.prefs.clearUserPref("social.directories");
- SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
- Social.uninstallProvider(addonManifest.origin);
+ let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html"
+ addTab(activationURL, function(tab) {
+ let doc = tab.linkedBrowser.contentDocument;
+ let installFrom = doc.nodePrincipal.origin;
+ Services.prefs.setCharPref("social.directories", installFrom);
+ is(SocialService.getOriginActivationType(installFrom), "directory", "testing directory install");
+ Social.installProvider(doc, manifest2, function(addonManifest) {
+ Services.prefs.clearUserPref("social.directories");
+ SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
+ Social.uninstallProvider(addonManifest.origin);
+ gBrowser.removeTab(tab);
+ });
});
});
}
@@ -11,18 +11,18 @@ let blocklistURL = "http://test:80/browser/browser/base/content/test/social/bloc
let blocklistEmpty = "http://test:80/browser/browser/base/content/test/social/blocklistEmpty.xml";
let manifest = { // normal provider
- name: "provider 1",
+ name: "provider ok",
origin: "https://example.com",
sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
};
let manifest_bad = { // normal provider
- name: "provider 1",
- origin: "https://bad.com",
- sidebarURL: "https://bad.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://bad.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://bad.com/browser/browser/base/content/test/moz.png"
+ name: "provider blocked",
+ origin: "https://test1.example.com",
+ sidebarURL: "https://test1.example.com/browser/browser/base/content/test/social/social_sidebar.html",
+ workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js",
+ iconURL: "https://test1.example.com/browser/browser/base/content/test/moz.png"
};
function test() {
@@ -40,10 +40,10 @@ var tests = {
var blocklist = Components.classes["@mozilla.org/extensions/blocklist;1"]
.getService(Components.interfaces.nsIBlocklistService);
setAndUpdateBlocklist(blocklistURL, function() {
- ok(blocklist.isAddonBlocklisted("bad.com@services.mozilla.org", "0", "0", "0"), "blocking 'blocked'");
- ok(!blocklist.isAddonBlocklisted("good.cpm@services.mozilla.org", "0", "0", "0"), "not blocking 'good'");
+ ok(blocklist.isAddonBlocklisted("test1.example.com@services.mozilla.org", "0", "0", "0"), "blocking 'blocked'");
+ ok(!blocklist.isAddonBlocklisted("example.com@services.mozilla.org", "0", "0", "0"), "not blocking 'good'");
setAndUpdateBlocklist(blocklistEmpty, function() {
- ok(!blocklist.isAddonBlocklisted("bad.com@services.mozilla.org", "0", "0", "0"), "blocklist cleared");
+ ok(!blocklist.isAddonBlocklisted("test1.example.com@services.mozilla.org", "0", "0", "0"), "blocklist cleared");
next();
});
});
@@ -102,20 +102,26 @@ var tests = {
Services.prefs.clearUserPref("social.whitelist");
setAndUpdateBlocklist(blocklistEmpty, next);
}
- let installFrom = "https://bad.com";
- // whitelist to avoid the 3rd party install dialog, we only want to test
- // the blocklist inside installProvider.
- Services.prefs.setCharPref("social.whitelist", installFrom);
- setAndUpdateBlocklist(blocklistURL, function() {
- try {
- // expecting an exception when attempting to install a hard blocked
- // provider
- Social.installProvider(installFrom, manifest_bad, function(addonManifest) {
- finish(false);
- });
- } catch(e) {
- finish(true);
- }
+ let activationURL = manifest_bad.origin + "/browser/browser/base/content/test/social/social_activate.html"
+ addTab(activationURL, function(tab) {
+ let doc = tab.linkedBrowser.contentDocument;
+ let installFrom = doc.nodePrincipal.origin;
+ // whitelist to avoid the 3rd party install dialog, we only want to test
+ // the blocklist inside installProvider.
+ Services.prefs.setCharPref("social.whitelist", installFrom);
+ setAndUpdateBlocklist(blocklistURL, function() {
+ try {
+ // expecting an exception when attempting to install a hard blocked
+ // provider
+ Social.installProvider(doc, manifest_bad, function(addonManifest) {
+ gBrowser.removeTab(tab);
+ finish(false);
+ });
+ } catch(e) {
+ gBrowser.removeTab(tab);
+ finish(true);
+ }
+ });
});
},
testBlockingExistingProvider: function(next) {
@@ -251,3 +251,11 @@ function addWindowListener(aURL, aCallback) {
onWindowTitleChange: function(aXULWindow, aNewTitle) { }
});
}
+
+function addTab(url, callback) {
+ let tab = gBrowser.selectedTab = gBrowser.addTab(url, {skipAnimation: true});
+ tab.linkedBrowser.addEventListener("load", function tabLoad(event) {
+ tab.linkedBrowser.removeEventListener("load", tabLoad, true);
+ executeSoon(function() {callback(tab)});
+ }, true);
+}
@@ -1,4 +1,4 @@
This is the pdf.js project output, https://github.com/mozilla/pdf.js
-Current extension version is: 0.7.337
+Current extension version is: 0.7.390
@@ -0,0 +1,155 @@
+/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
+/* Copyright 2012 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* jshint esnext:true */
+/* globals Components, Services, XPCOMUtils, NetUtil, dump */
+
+'use strict';
+
+var EXPORTED_SYMBOLS = ['PdfRedirector'];
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cr = Components.results;
+const Cu = Components.utils;
+
+const PDF_CONTENT_TYPE = 'application/pdf';
+const FIREFOX_ID = '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}';
+
+Cu.import('resource://gre/modules/XPCOMUtils.jsm');
+Cu.import('resource://gre/modules/Services.jsm');
+Cu.import('resource://gre/modules/NetUtil.jsm');
+
+
+function getDOMWindow(aChannel) {
+ var requestor = aChannel.notificationCallbacks ?
+ aChannel.notificationCallbacks :
+ aChannel.loadGroup.notificationCallbacks;
+ var win = requestor.getInterface(Components.interfaces.nsIDOMWindow);
+ return win;
+}
+
+function getObjectUrl(window) {
+ var url;
+ var element = window.frameElement;
+ var isOverlay = false;
+ var params = {};
+ if (element) {
+ var tagName = element.nodeName;
+ while (tagName != 'EMBED' && tagName != 'OBJECT') {
+ // plugin overlay skipping until the target plugin is found
+ isOverlay = true;
+ element = element.parentNode;
+ if (!element)
+ throw 'Plugin element is not found';
+ tagName = element.nodeName;
+ }
+ if (tagName == 'EMBED') {
+ for (var i = 0; i < element.attributes.length; ++i) {
+ params[element.attributes[i].localName] = element.attributes[i].value;
+ }
+ url = params.src;
+ } else {
+ for (var i = 0; i < element.childNodes.length; ++i) {
+ var paramElement = element.childNodes[i];
+ if (paramElement.nodeType != Ci.nsIDOMNode.ELEMENT_NODE ||
+ paramElement.nodeName != 'PARAM') {
+ continue;
+ }
+
+ params[paramElement.getAttribute('name')] =
+ paramElement.getAttribute('value');
+ }
+ var dataAttribute = element.getAttribute('data');
+ url = dataAttribute || params.movie || params.src;
+ }
+ }
+ if (!url) {
+ return url; // src is not specified
+ }
+
+ var element = window.frameElement;
+ // XXX base uri?
+ var baseUri = !element ? null :
+ Services.io.newURI(element.ownerDocument.location.href, null, null);
+
+ return Services.io.newURI(url, null, baseUri).spec;
+}
+
+function PdfRedirector() {
+}
+
+PdfRedirector.prototype = {
+
+ // properties required for XPCOM registration:
+ classID: Components.ID('{8cbfd8d0-2042-4976-b3ef-d9dee1efb975}'),
+ classDescription: 'pdf.js Redirector',
+ contractID:
+ '@mozilla.org/streamconv;1?from=application/x-moz-playpreview-pdfjs&to=*/*',
+
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.nsIStreamConverter,
+ Ci.nsIStreamListener,
+ Ci.nsIRequestObserver
+ ]),
+
+ // nsIStreamConverter::convert
+ convert: function(aFromStream, aFromType, aToType, aCtxt) {
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ },
+
+ // nsIStreamConverter::asyncConvertData
+ asyncConvertData: function(aFromType, aToType, aListener, aCtxt) {
+ // Store the listener passed to us
+ this.listener = aListener;
+ },
+
+ // nsIStreamListener::onDataAvailable
+ onDataAvailable: function(aRequest, aContext, aInputStream, aOffset, aCount) {
+ // Do nothing since all the data loading is handled by the viewer.
+ },
+
+ // nsIRequestObserver::onStartRequest
+ onStartRequest: function(aRequest, aContext) {
+ // Setup the request so we can use it below.
+ aRequest.QueryInterface(Ci.nsIChannel);
+ // Cancel the request so the viewer can handle it.
+ aRequest.cancel(Cr.NS_BINDING_ABORTED);
+
+ var domWindow = getDOMWindow(aRequest);
+ var pdfUrl = getObjectUrl(domWindow);
+ if (!pdfUrl) {
+ Services.console.logStringMessage(
+ 'PdfRedirector.js: PDF location is not specified for OBJECT/EMBED tag');
+ return;
+ }
+
+ // Create a new channel that is viewer loaded as a resource.
+ var ioService = Services.io;
+ var channel = ioService.newChannel(pdfUrl, null, null);
+
+ channel.loadGroup = aRequest.loadGroup;
+
+ channel.asyncOpen(this.listener, aContext);
+ },
+
+ // nsIRequestObserver::onStopRequest
+ onStopRequest: function(aRequest, aContext, aStatusCode) {
+ // Do nothing
+ }
+};
+
+var NSGetFactory = XPCOMUtils.generateNSGetFactory([PdfRedirector]);
Oops, something went wrong.

0 comments on commit c4d52ce

Please sign in to comment.