nsWebBrowserPersist gives me <window>, not <html> - any way to get <html>?

Is there supposed to be a way to use the saveDocument method in 
nsIWebBrowserPersist, from JavaScipt, that can give one the page source?

I have also seen this question prefaced with "I am a <insert word that 
rhymes with ruby>, but...", which is probably a good way to not get an 
answer. Well, I am not new. Do I understand everything I see in FF, or 
know where _all_ the documentation is? No. Do I have those dragon-shaped 
scars on my forehead that people outside Mountain View get as they bang 
their head against this stuff? Yes. I do.

I am using the nsIWebBrowserPersist interface, from an extension after 
the DocumentLoaded event, in a way similar to what I have decoded from 
responses to other questions. I get a <window>. I want the <html>. The 
<html> is not inside the <window>....

FYI, if I figure this out, it will definitely go into a snippet. Given 
that so many people have asked this and it has never, AFAIK, actually 
gotten a complete answer....

I also see that:

- Firefox itself does not use the saveDocument method in the 
nsWebBrowserPersist interface from JavaScript. It does the 'View Source' 
stuff in C++. Why? It looks as though there is an idl sitting there to 
use with JavaScript. Has it been found to not work?

- I see the three files:

http://mxr.mozilla.org/mozilla/source/embedding/qa/jstests/nsIWebBrowserPersistTest1.txt
http://mxr.mozilla.org/mozilla/source/embedding/qa/jstests/nsIWebBrowserPersistTest2.txt
http://mxr.mozilla.org/mozilla/source/embedding/qa/jstests/nsIWebBrowserPersistTest3.txt

I do not see this being used in any test that actually gets called. I do 
not see the test which includes it referred to in tinderbox logs. Is 
something that uses saveDocument from JavaScript actually getting run? 
Where?

Any suggestions? Any suggestions pointing to code last used after SeaMonkey?

thanx - ray
0
Ray
8/29/2007 5:48:38 PM
mozilla.dev.apps.firefox 3660 articles. 0 followers. Post Follow

2 Replies
919 Views

Similar Articles

[PageSpeed] 50
Get it on Google Play
Get it on Apple App Store

Ray Kiddy wrote:
> Is there supposed to be a way to use the saveDocument method in 
> nsIWebBrowserPersist, from JavaScipt, that can give one the page source?

Well webbrowserpersist saves to a file. If you just want the data in 
memory, it's not the best solution, which is why view source doesn't use it.

> http://mxr.mozilla.org/mozilla/source/embedding/qa/jstests/nsIWebBrowserPersistTest1.txt 
> http://mxr.mozilla.org/mozilla/source/embedding/qa/jstests/nsIWebBrowserPersistTest2.txt 
> http://mxr.mozilla.org/mozilla/source/embedding/qa/jstests/nsIWebBrowserPersistTest3.txt 
> 
> I do not see this being used in any test that actually gets called. I do 
> not see the test which includes it referred to in tinderbox logs.

Yeah, those tests aren't used.

> Is 
> something that uses saveDocument from JavaScript actually getting run? 
> Where?

contentAreaUtils.js, whenever you use File|Save Page As, Save Link 
Target As, etc.

But saveDocument is not what you want for something view source like, 
because that saves a serialization of the DOM, not what the original 
HTML looked like. You'd want to use saveURI instead.
0
Christian
8/29/2007 6:45:24 PM
Christian Biesinger wrote:
> Ray Kiddy wrote:
>> Is there supposed to be a way to use the saveDocument method in 
>> nsIWebBrowserPersist, from JavaScipt, that can give one the page source?
> 
> Well webbrowserpersist saves to a file. If you just want the data in 
> memory, it's not the best solution, which is why view source doesn't use 
> it.
> 
>> http://mxr.mozilla.org/mozilla/source/embedding/qa/jstests/nsIWebBrowserPersistTest1.txt 
>> http://mxr.mozilla.org/mozilla/source/embedding/qa/jstests/nsIWebBrowserPersistTest2.txt 
>> http://mxr.mozilla.org/mozilla/source/embedding/qa/jstests/nsIWebBrowserPersistTest3.txt 
>>
>> I do not see this being used in any test that actually gets called. I 
>> do not see the test which includes it referred to in tinderbox logs.
> 
> Yeah, those tests aren't used.
> 
>> Is something that uses saveDocument from JavaScript actually getting 
>> run? Where?
> 
> contentAreaUtils.js, whenever you use File|Save Page As, Save Link 
> Target As, etc.
> 
> But saveDocument is not what you want for something view source like, 
> because that saves a serialization of the DOM, not what the original 
> HTML looked like. You'd want to use saveURI instead.

No, what I was looking for is the _4_ lines of code that is in the Code 
Snippets, under "Miscellaneous".

After I stop being t-eed off, I am going to try to think of where to put 
this so that if you search for something having to do with saving the 
html of a page, it actually finds this somewhere in the first pages of 
the results and it is named in a slightly obvious manner.

I know I have a way of missing the obvious sometimes, but MoCo also has 
a habit of hiding things that they think should be "obvious to everyone".

Or maybe I need to figure out the secret handshake. We'll see.

thanx anyway - ray
0
Ray
8/29/2007 10:54:24 PM
Reply:

Similar Artilces:

How to strip a string of <html>, ,</html>, <body>, </body>, <form ... >, </form> tags?
I have stream which is the HTML input of a page. Now I want to use only that part of this page, that is within <form .....> and </form> tags, and excluding these tags.How would I go about stripping <html>, ,</html>, <body>, </body>, <form ... >, </form>, <head> and </head> tags? I have to make sure that <head ...javascript..> and its corresponding </head> tags are not stripped in this process.sun21170    Wait... you said you wanted to strip the head tags, and you're also saying you need to NOT strip the ...

<html:html><html:body><html:input xul:persist="value">
I have an HTML administration and I'd like make it use of XUL's @persist great feature without andy browser-dependant conditions. Is there a way how to take advantage of @persist in normal HTML page viewed by Mozilla? Requirements: 1. HTML elements must not include namespace prefix - it must stay 'html', 'body' etc. 2. No extra XUL elements such as root xul:window etc. - still have fully IE compatible code. 3. Try to avoid Javascript magic that appends XUL xul:window element etc. Is possible something like this? --- <html xmlns="h...

>>>> Heads up <<<<
I just got a warning from Norton that "PamelaSetup-Basic.exe" has a virus in it. The name is "VirusBurst" Luckily, I did not install this software and Norton's quarantined it so I could delte it, which I have done. Symantec has not completed analysis of this particular piece of garbage but it did catch the sig. If you have installed Pamela, you may be in trouble. Duffy wrote: > I just got a warning from Norton that "PamelaSetup-Basic.exe" has a virus > in it. The name is "VirusBurst" > > Luckily, I did not install...

superreview granted: [Bug 57717] view-source on blank page shows <html><body></body></html> : [Attachment 150636] remove the generated stuff
Boris Zbarsky <bzbarsky@mit.edu> has granted Boris Zbarsky <bzbarsky@mit.edu>'s request for superreview: Bug 57717: view-source on blank page shows <html><body></body></html> http://bugzilla.mozilla.org/show_bug.cgi?id=57717 Attachment 150636: remove the generated stuff http://bugzilla.mozilla.org/attachment.cgi?id=150636&action=edit ------- Additional Comments from Boris Zbarsky <bzbarsky@mit.edu> Looks good. ...

Should I remove the <!doctype>, <meta>, <head> when I insert html in the Text/Html module?
Hello, I would like to know if I have to remove the tags such as , , ,.. when I insert html in the Text/Html module? I would also like if I can set a in this html editor. And if not, where can I set them? Up until now I set my CSS with the html code. So There was a CSS per module. Is it better to define only one CSS per page? Where can I set the in this case? Thank you. ****************************************- I don’t write plumbing code anymore- I use PostSharp- And you?http://www.postsharp.org/**************************************** do not insert complete pages, only html fra...

>>>> ROOT Exploit in SAMBA <<<<<<
"A flaw has been detected in the Samba main smbd code which could allow an external attacker to remotely and anonymously gain Super User (root) privileges on a server running a Samba server. This flaw exists in previous versions of Samba from 2.0.x to 2.2.7a inclusive. This is a serious problem and all sites should either upgrade to Samba 2.2.8 immediately or prohibit access to TCP ports 139 and 445." http://us3.samba.org/samba/samba.html Binaries are available from Samba for RedHat, and some other distributions. So far as I can tell, the RedHat update mirrors I norm...

>>>> BUY RAM <<<<
.. ~~~*@@@*~~~ ================================================== ================================================== ENTER HERE: >>> http://web-for-you.cn/about/buy-ram <<< ================================================== ================================================== .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ...

>>>> CAPITALS GAMES <<<<
.. ~~~!!!~~~ ================================================== ================================================== CLICK HERE TO ENTER: >>> http://web-paradise.cn/3/capitals-games <<< ================================================== ================================================== .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....

C<< >> vs C<< >> vs C<< x >>
Ugh. So we all know that there's this syntax for formatting codes (n=E9s "interio= r sequences") like C<< x >>. And that tokenizes as three tokens: "C<< ", open-C code "x", content " >>" close-code matching the C open-code And this is explicated by what I wrote in perlpodspec where I say that such a code... * starts with a capital letter (just US-ASCII [A-Z]) followed by two or more "<"'s, one or more whitespace characters, * any number of characters * one or more whit...

Hey <html></html>
What for using html tags <html> // Enter Your Code Here </html> Hi, and welcome to these forums. Could you please be some more specific because I don't really have clue what you're asking for. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons. Hello, check this tutorial: HTML Tutorial regardsBilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP those tags define the boundarys of a document that contains HyperText Markup Language the tag with the slash -> / indica...

Spam? <html> and </html>
Hi All I've just received about a dozen e-mails, to various e-dresses, with the above titles. Thanks to various people here they've gone straight into my Spam folder but I'm just wondering if using a HTML tag as a subject line is some kind of trick to trap the unwary into opening the msg. I've not opened any of the msgs but a quick look at the msg properties of one e-mail (I've xxx'ed some of the information) gave: Return-Path: <xxx@hotmail.ru> Received: from dgvif (208.133.193.31) by mk-cpfrontend.uk.tiscali.com (6.0.053) id 3D8FAB5100B38D3...

>>>> BLU-RAY MOVIES <<<<
.. ~~~!!!~~~ ================================================== ================================================== CLICK HERE TO ENTER: >>> http://web-paradise.cn/2/blu-ray-movies <<< ================================================== ================================================== .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....

[PATCH] correctly handle C<< >> and C<<< >>> in diagnostics
This is just a quick hack; ideally someone would make it use an actual pod parser. --- perl/lib/diagnostics.pm.orig 2003-12-30 15:48:47.000000000 -0800 +++ perl/lib/diagnostics.pm 2004-05-25 01:54:31.735904000 -0700 @@ -314,10 +314,10 @@ sub noop { return $_[0] } # spensive for a noop sub bold { my $str =$_[0]; $str =~ s/(.)/$1\b$1/g; return $str; } sub italic { my $str = $_[0]; $str =~ s/(.)/_\b$1/g; return $str; } - s/[BC]<(.*?)>/bold($1)/ges; + s/C<<< (.*?) >>>|C<< (.*?) >>|[BC]<(.*?)>/bold($+)/ges; ...

<window>, <iframe> and <page>
High, is there somewhere in the net an example for this? And for the application shell, too? I like to have a small app.xul with a login.xul, a main.xul, a pref.xul and something more like this. Now I have a remote version, where I have resolved this problem with a <deck>. But for <keyset>, <commands> and the other fine things in XUL I prefer a better solution. Some working examples will be the best for me, I think. Thanks in advance Andreas FYI Here is a very simple PHP application that use a few different features for subwindows http://www.servicio...

Web resources about - nsWebBrowserPersist gives me <window>, not <html> - any way to get <html>? - mozilla.dev.apps.firefox

Resources last updated: 12/21/2015 12:32:36 AM