"Expected expression" error in FiddlerScript

1 Answer 145 Views
Fiddler Classic
Thibault
Top achievements
Rank 1
Thibault asked on 27 Nov 2023, 01:56 PM | edited on 27 Nov 2023, 01:57 PM


I'm trying to add a function that enables me to programatically hide certain domains and retain such list as a BindPref.

However the function generates an unexpected error "Expected expression".

 

 

I've ran the function on jsFiddle.net and it works very well in their javascript engine, hence I suspect an issue with FiddlerScript.



class Handlers
{
[...]

static function OnPeekAtRequestHeaders(oSession: Session) {
	if(containsIgnoreDomain(oSession)) oSession["ui-hide"] = "yup";
}

static function ContainsIgnoreDomain(oSession: Session) {
        var ignoreDomains = [ "micosoft.com", "google.com", "googleapis.com", "gstatic.com", "gvt2.com", "gvt3.com"];
	
	const present = ignoreDomains.filter( domain => oSession.url.endsWith(domain) );  //   <<<<=== ERROR HERE 

	if(present.length > 0) return true;
	else return false;
}

[...]
}


1 Answer, 1 is accepted

Sort by
0
Nick Iliev
Telerik team
answered on 27 Nov 2023, 02:21 PM

Hello Thibault,

 

It's worth noting that FiddlerScript is based on JScript.NET, which is essentially a .NET version of JavaScript. However, it's important to keep in mind that the language is a bit older, and as such, it does not support arrow functions (which were only introduced in the ES6 version of JavaScript). To address this issue, it is recommended to use the traditional function expression instead.

 

Regards,
Nick Iliev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Fiddler Classic
Asked by
Thibault
Top achievements
Rank 1
Answers by
Nick Iliev
Telerik team
Share this question
or