edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [edbrowse-dev] window.location.search and String.search
@ 2019-06-02  0:42 Kevin Carhart
  2019-06-02  6:43 ` Karl Dahlke
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Carhart @ 2019-06-02  0:42 UTC (permalink / raw)
  To: edbrowse-dev


Thanks for the clarification!
This is very fun.  I think I already used breakpoint and snapshot to raise 
something in particular.  Since the homepage of baseball is appearing, I 
tried to load the Players, and I got an error around here:

     xf = /#|$/;
     yf = function (a, b) {
         var c = a.search(xf);

Thanks to the breakpoint I was able to echo local 'a' and 'b' !
'a' is an object and is definitely window.location.  You can tell by its 
member names.
b is a string.  xf is a regular expression.
So look what it does next.  It seems like we have a collision between 
location.search and String.search(//).  When it tries to a.search(xf), it 
crashes:
TypeError: '' not callable (property 'search' of [object Object])


Karl, you talk about this at line 701 in startwindow.
/*
Can't turn URL.search into String.search, because search is already a 
property
of URL, that is, the search portion of the URL.
mw0.URL.prototype.search = function(s) {
return this.toString().search(s);
}
*/

Can the getter handle both things by differentiating on whether or not 
anything was sent in?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [edbrowse-dev] window.location.search and String.search
  2019-06-02  0:42 [edbrowse-dev] window.location.search and String.search Kevin Carhart
@ 2019-06-02  6:43 ` Karl Dahlke
  2019-06-02  7:10   ` Kevin Carhart
  0 siblings, 1 reply; 4+ messages in thread
From: Karl Dahlke @ 2019-06-02  6:43 UTC (permalink / raw)
  To: edbrowse-dev

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

I guess you would have to show me where the location.search(stuff) as a function is, because I find it as a string all over, even in the baseball site.
cloud.js lines 42, 589, 1551, 6062, etc.
If you stretch your mind to the limit you could imagine the getter returning a function that is string.match but it has a toString() function that is the string you want,
so if the code coerces it to a string it will be right, but that's the only way,
and most of the time the code doesn't coerce it to a string so it will be an object and blow up.
So no you can't have your cake and eat it too.
More likely there's something wrong with the parameters being passed in,
like maybe the location object should have been coererced to string before it was passed.
Anyways I'd have to look at it for real.

Karl Dahlke

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edbrowse-dev] window.location.search and String.search
  2019-06-02  6:43 ` Karl Dahlke
@ 2019-06-02  7:10   ` Kevin Carhart
  2019-06-02 12:50     ` Karl Dahlke
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Carhart @ 2019-06-02  7:10 UTC (permalink / raw)
  To: Karl Dahlke; +Cc: edbrowse-dev


Oops, you're right, I should have given a file and line number!

If you 
load https://www.baseball-reference.com/players/, it's in one of the 
advertising js files, pubads_impl_2019052302.js at line 1854 after demin.

I don't know if it's responsible for inhibiting content from loading such 
as Players, but it's the first runtime that occurs.  Hooray, first piece 
of find & fix that would probably not have been coherent to isolate and 
work on without the breakpoint!







On Sun, 2 Jun 2019, Karl Dahlke wrote:

> I guess you would have to show me where the location.search(stuff) as a function is, because I find it as a string all over, even in the baseball site.
> cloud.js lines 42, 589, 1551, 6062, etc.
> If you stretch your mind to the limit you could imagine the getter returning a function that is string.match but it has a toString() function that is the string you want,
> so if the code coerces it to a string it will be right, but that's the only way,
> and most of the time the code doesn't coerce it to a string so it will be an object and blow up.
> So no you can't have your cake and eat it too.
> More likely there's something wrong with the parameters being passed in,
> like maybe the location object should have been coererced to string before it was passed.
> Anyways I'd have to look at it for real.
>
> Karl Dahlke
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [edbrowse-dev] window.location.search and String.search
  2019-06-02  7:10   ` Kevin Carhart
@ 2019-06-02 12:50     ` Karl Dahlke
  0 siblings, 0 replies; 4+ messages in thread
From: Karl Dahlke @ 2019-06-02 12:50 UTC (permalink / raw)
  To: edbrowse-dev

Ok this is fun, isn't it?

It took me a while even to replicate your situation.

The js you refer to comes from a domain doubleclick.net, which I supressed long ago.
It's adds, so I don't care about it.

nojs = doubleclick.net

I commented out the whole nojs block so I could run all the javascript.
I still didn't get your file, at all.
I realized I routinely spoof the internet by pretending I am internet explorere.
	(If I don't do this there are no h3 headins on google search)
The website doesn't even go down this path for IE.
So I set ua0 so I'm back to edbrowse.
Now, finally, I fetch the same scripts as you and see the same error.

snapshot()

Now I can replicated here on my machine and put in breakpoints etc.
eval($bp) as you suggest.
Yes I'm calling search on a url object. Oops.
It's not window location as you thought.

a === window.location
false

Not document.location either.
It's document.URL.
A little more internet research, and document.URL is suppose to be a string, not a URL, its name notwithstanding.
So I was right to think we were barking up the wrong tree, don't mess with overlaid search functions,
what is passed in shouldn't be a URL at all.
It's a one line fix in ebjs.c line 795.
Now the error goes away.
But no worries, I'm sure you'll find plenty more.

Karl Dahlke

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-02 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-02  0:42 [edbrowse-dev] window.location.search and String.search Kevin Carhart
2019-06-02  6:43 ` Karl Dahlke
2019-06-02  7:10   ` Kevin Carhart
2019-06-02 12:50     ` Karl Dahlke

edbrowse-dev - development list for edbrowse

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/edbrowse-dev

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 edbrowse-dev edbrowse-dev/ http://inbox.vuxu.org/edbrowse-dev \
		edbrowse-dev@edbrowse.org
	public-inbox-index edbrowse-dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.edbrowse.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git