Bugs :  K-Meleon Web Browser Forum
You can talk about issues with k-meleon here.  
Pages: 12Next
Current Page: 1 of 2
javascript permissions without any effect
Posted by: norbert.ma
Date: December 24, 2014 03:45PM

Version 74, 740RC2, 75b1 - XP SP3
******english*****
Hi, my problem is that the JavaScript permission list has got *no effect*, no matter what I set it up
for.
What I've tried is:
- Globally allowing AND forbidding JavaScripts, which works fine
- Set up separate permissions per site, is not working
Please try:
- Disable Javascript globally (Tools -> Privacy -> Block Javascript)
- Setup allowing rule (e.g. for www.gmx.com) (Edit[F2] -> JavaScript -> Permissions)
- try www.gmx.com, it tells you "Please enable JavaScript" although you have allowed it before

*******german******
F2 > JavaScript > Berechtigungen KEINE Reaktion.
Egal ob in den Berechtigungen verboten oder erlaubt ist, wenn JavaScript ein ist funktioniert es, wenn es aus ist ist auch JavaScript aus.



Edited 3 time(s). Last edit at 12/24/2014 04:03PM by norbert.ma.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: guenter
Date: December 24, 2014 04:01PM

I confirm for test URL: kmeleon.sourceforge.net. 74 on XP SP3 if that matters.

If You globally forbid JavaScript but add a exception that allows script for that site it does not work. JS is still off.

If You globally allow JavaScript but add a negative exception that forbids script for that site the feature does work. JS is off.

That is my result for this short test.

So it seems that more vital feature globally forbid and opt in on some sites is broken. Can any other confirm my readings.

I normally have JS on for all sites but opt out on certain sites.

BTW. Merry Xms, Frohe Weihnachten.

p.s. Nu das garnix geht, kann ich nicht finden. Aber verbieten und einige Seiten positiv schalten, macht eigentl. mehr Sinn.



Edited 2 time(s). Last edit at 12/24/2014 04:16PM by guenter.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JohnHell
Date: December 24, 2014 04:29PM

Global javascript.enabled preference, when set to false, has been over per site options ever, or am I wrong?

I'd bet for has been this way ever.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: siria
Date: December 24, 2014 04:41PM

My memory is already fading about this, but didn't Mozilla abolish the "capabilities" system (CAPS), except for the part about reading local files? Since then all that exception stuff didn't work anymore, but I might confuse it meanwhile, not sure ;-)



Edited 3 time(s). Last edit at 12/24/2014 05:24PM by siria.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JohnHell
Date: December 24, 2014 04:56PM

Never used CAPS and when I decided to, they removed XD

So I can't confirm that.

Off topic:
BTW I didn't asked to the mozilla community yet about javascript working after disable it after load the page. It's driving me crazy. In K-meleon 75.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: siria
Date: December 24, 2014 05:27PM

Quote
JohnHell
BTW I didn't asked to the mozilla community yet about javascript working after disable it after load the page. It's driving me crazy. In K-meleon 75.

Yeah, it's a no-go for me too. Just hoping dorian or someone figures out how to change that again. Just curious, did you try if injectjs can overrule it now?

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JohnHell
Date: December 24, 2014 05:59PM

Quote
siria
Quote
JohnHell
BTW I didn't asked to the mozilla community yet about javascript working after disable it after load the page. It's driving me crazy. In K-meleon 75.

Yeah, it's a no-go for me too. Just hoping dorian or someone figures out how to change that again. Just curious, did you try if injectjs can overrule it now?

Yes, injectJS was fixed in K-meleon 75 beta 1 update 1

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: siria
Date: December 24, 2014 06:54PM

Okay, thanks! I read about it, just wasn't quite sure how far that fix helps. And it also helps to return again a variable into a macro var?

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JohnHell
Date: December 24, 2014 08:36PM

Quote
siria
Okay, thanks! I read about it, just wasn't quite sure how far that fix helps. And it also helps to return again a variable into a macro var?

Not fully working. JamesD tested it, and I tried too, but no luck.

Read about it here:
http://kmeleonbrowser.org/forum/read.php?8,131009,131398,page=4#msg-131332

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: guenter
Date: December 24, 2014 10:13PM

Quote
JohnHell
Global javascript.enabled preference, when set to false, has been over per site options ever, or am I wrong?

No You are not.

http://www-archive.mozilla.org/projects/security/components/ConfigPolicy.html

Quote
Configurable Security Policies
Also note that this preference:

   user_pref("javascript.enabled", false);

overrides all capability.policy prefs, including capability.policy.default.javascript.enabled, for all sites.

p.s. No idea how we can reach policies which should be in permissions data base by now.
Maybe we can think of something in a joint effort.
But we have to go to try without touching this user_pref / with leaving it true.


Any ideas how to toggle.

user_pref("capability.policy.default.javascript.enabled", "noAccess");

to allAccess. And then add white and/or blacklist via a policy?

Or anything derived from this first idea?



Edited 1 time(s). Last edit at 12/24/2014 10:33PM by guenter.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: siria
Date: December 24, 2014 10:47PM

Those caps-policies have been removed by Mozilla, so we as non-devs can do nothing.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: siria
Date: December 24, 2014 10:57PM

Quote
JohnHell
Quote
siria
it also helps to return again a variable into a macro var?

Not fully working. JamesD tested it, and I tried too, but no luck.

Read about it here:
http://kmeleonbrowser.org/forum/read.php?8,131009,131398,page=4#msg-131332

Quote
JamesD
I ran a macro with the following code. The first alert was correct and showed the datetime. Before the second alert could display my KM 75 failed with an error.

$_Datetime_Value = injectJS( "Date()"); 
alert( $_Datetime_Value, "datestring", INFO);

$_Datetime_Date = injectJS( "var d = new Date(); function returnVar(d){return d;} returnVar(d);");
alert( $_Datetime_Date, "Date()", INFO);

I think this code ran correctly in an earlier KM version.

Hey, but that sounds promising, if the first code works already :-)
Hm, have you tried injecting the second code as macro var, like $_code="..."; $_Datetime_Date=injectJS($_code)? Sometimes that helps.



Edited 2 time(s). Last edit at 12/24/2014 10:59PM by siria.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JohnHell
Date: December 24, 2014 11:42PM

That doesn't work either.

For me doesn't crash as for JamesD, just shows the alert but with 3 unknown characters (you know, the bolded tall line characters when unknown).

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: George Hall
Date: December 25, 2014 12:50AM

Quote
siria
Those caps-policies have been removed by Mozilla, so we as non-devs can do nothing.

Those cap policies might be able to be restored with components from Firefox 28.0 and earlier.

The files for CAPS may be in the root omni.ja and/or browser omni.ja So adding them to K-Meleon 75.0 Beta 1 root omni.ja and/or browser omn.ja may return thos cap policies to K-Meleon 75.0 Beta 1.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JamesD
Date: December 25, 2014 03:06AM

Quote
siria
My memory is already fading about this, but didn't Mozilla abolish the "capabilities" system (CAPS), except for the part about reading local files? Since then all that exception stuff didn't work anymore, but I might confuse it meanwhile, not sure ;-)

That is my understanding also.

I had to build a system, macro module and pref, to check the site against a list at OnLoad event. If site is on the list and JS is off, change JS to on and reload site. It is crude, but it is all I can do since I don't know the site prior to OnLoad.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: guenter
Date: December 25, 2014 02:23PM

Since NoScript seems to work it might be no needed to fix / opt in?

http://kmeleonbrowser.org/forum/read.php?9,131284

p.s. John Hall - I compared files/names in omni.ja that fell away but found no likely candidates.

So for 75 there seems no way like I thought to work around the limitation/bug.



Edited 2 time(s). Last edit at 12/25/2014 06:20PM by guenter.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JohnHell
Date: December 25, 2014 04:01PM

I'm lost, what are you replying me about?

If you mean javascript working after toggle javascript that's a GRE feature, happening too in Firefox.



Edited 1 time(s). Last edit at 12/25/2014 04:02PM by JohnHell.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: guenter
Date: December 25, 2014 06:23PM

Sorry mixed up something. Senior moment. Anyway I tried to find the code - but did not.



Edited 1 time(s). Last edit at 12/25/2014 06:24PM by guenter.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JohnHell
Date: April 16, 2015 10:20PM

Quote
JamesD
I ran a macro with the following code. The first alert was correct and showed the datetime. Before the second alert could display my KM 75 failed with an error.

$_Datetime_Value = injectJS( "Date()"); 
alert( $_Datetime_Value, "datestring", INFO);

$_Datetime_Date = injectJS( "var d = new Date(); function returnVar(d){return d;} returnVar(d);");
alert( $_Datetime_Date, "Date()", INFO);


Sorry to make a revival of this thread.

Did you solve the problem with the second alert?

Because I did and I don't know if the solution was already in the forum. I haven't found the answer.

And maybe I just re-invented the wheel, with my knowledge of macros confused smiley and I broke my head until I found the answer for nothing confused smiley

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: siria
Date: April 16, 2015 11:01PM

Quote
JohnHell
And maybe I just re-invented the wheel, with my knowledge of macros confused smiley and I broke my head until I found the answer for nothing confused smiley

ROFL - *exactly* my feelings everytime I struggle with javascript for AGES and then finally turns out half a line is the solution!! grinning smiley But the prob is always the scripts, not the macro.

In general, after having finally found a working solution to return a value, since then now just copy it over whenever needed. The simplest form e.g. in linktoggle macro:
$_x=injectJS("(function(){return linktext;})() ");
(with linktext being a var already created earlier and attached to the document or wherever simple vars hang around :coolsmiling smiley
Now I suppose that Date() thing is more complicated but perhaps could be inserted before "return", but just a wild guess.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JohnHell
Date: April 17, 2015 12:16AM

Well, I'll tell winking smiley, I was waiting to confirm by JamesD, but... we live in different time zones so, too much suspense.

In fact, Siria, isn't a JavaScript error but a macro error and, probably an injectJS bug or normal behavior (I hadn't used this in the past until I knew, thanks to you, that javascript could run without javascript enabled by this function).

One way or another, the problem is not if you create the variable from injectJS or the variable already exists in the document.

The problem is the typeof() of the returned value by the function, any function actually, by injectJS.

To let macro language handle the returned values correctly they MUST BE strings.

It's kind of the same problem I asked 6 years ago about numbers comparison ( < > ), that, by default, they only compare strings, not numbers, and for numbers the value must be converted to a number by adding +0 to the value.

So, if the returned value is an object, as it is new Date(), or it is a number, the returned value is empty.

So, to fix it, in the javascript code the returned value must be converted to a string with one of this methods (using the code by JamesD):
d = d.toString(); return d;
or
d = d+''; return d;
As simple as that.

Note that I said above numbers. Yes, numbers aren't returned either. That is what made me to discover it. I was making some operations with numbers and it was weird that the return was empty when a second earlier the text I tested was.

Then, the bulb over my head switched on and I found that it needed to be converted to an string before being used by macros.

And despite numbers are converted to string, still can be used to make operations in macros. But to be sure, is not a bad idea to, even, convert them to numbers by adding to the value (in macro language) +0.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JamesD
Date: April 17, 2015 02:17AM

@ JohnHell

I just now saw your post. I will work on strings as soon as I can, but that may be a couple of days. Thanks for the info.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JamesD
Date: April 19, 2015 03:07PM

@ JohnHell

You are spot on right. I made the change of adding "+''" to each variable to be returned in my test macro and I got an answer every time.

That 'string only' type of requirement has only just started in KM 75. My old code ran in an earlier version. 1.6 ver, I think.

I think this information should be added to the MacroLanguage2 documentation. Most people will not realize that it is a requirement unless it is there for them to see.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JohnHell
Date: April 19, 2015 04:02PM

Nice you have confirmed it! smiling smiley

Yes, better added to the docs, because even when it is clear enough, sometimes we have to struggle to find out how things work xD Or maybe is only me tongue sticking out smiley

Just would be interesting to know Dorian's opinion. If it is a new Gecko/ECMA "feature" or a change in K-meleon code or a mix of both.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JamesD
Date: April 19, 2015 04:23PM

I do not know why the change, but I am very happy that you have discovered it and found a fix.

Datetime functions and reporting them back to the macros are a bit tricky. Some functions are zero based. I will post my revised macro so novice users who read this might understand better.

Datetime.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage2)
#
# ---------- Datetime.kmm
# ---------- Test for obtaining system date / time information  ---------------
# ---------- For KM 75 -- injectJS() must return a STRING variable -- add +'' to ensure 'type of' is string
# ---------- In JavaScript, both month and day are zero based 
#
# Dependencies        : main.kmm
# Resources           : -  
# Preferences         : -
# Version             : 2.0   2015-04-19  JamesD 
# --------------------------------------------------------------------------------

_Datetime_RunCode {

$_Datetime_Value = injectJS( "Date()"); 
alert( $_Datetime_Value, "datestring", INFO);

$_Datetime_Date = injectJS( "var d = new Date()+''; function returnVar(d){return d;} returnVar(d);");
alert( $_Datetime_Date, "Date()", INFO);

$_Datetime_Year = injectJS( "var d = new Date(); dm = d.getFullYear()+'';  function returnVar(dm){return dm;} returnVar(dm);");
alert( $_Datetime_Year, "d.getFullYear()", INFO);
 
$_Datetime_Month = injectJS( "var d = new Date(); dm = d.getMonth()+'';  function returnVar(dm){return dm;} returnVar(dm);");
$_Datetime_Month + 1 == 1 ? $_EnMonth = "January" :0;     $_Datetime_Month + 1 == 7 ? $_EnMonth = "July" :0;
$_Datetime_Month + 1 == 2 ? $_EnMonth = "February" :0;    $_Datetime_Month + 1 == 8 ? $_EnMonth = "August" :0;
$_Datetime_Month + 1 == 3 ? $_EnMonth = "March" :0;       $_Datetime_Month + 1 == 9 ? $_EnMonth = "September" :0;
$_Datetime_Month + 1 == 4 ? $_EnMonth = "April" :0;       $_Datetime_Month + 1 == 10 ? $_EnMonth = "October" :0;
$_Datetime_Month + 1 == 5 ? $_EnMonth = "May" :0;         $_Datetime_Month + 1 == 11 ? $_EnMonth = "Novenber" :0;
$_Datetime_Month + 1 == 6 ? $_EnMonth = "June" :0;        $_Datetime_Month + 1 == 12 ? $_EnMonth = "December" :0;
alert( $_Datetime_Month + 1 ."\n". $_EnMonth , "d.getMonth() +1", INFO);

$_Datetime_Day = injectJS( "var d = new Date(); dm = d.getDate()+'';  function returnVar(dm){return dm;} returnVar(dm);");
alert( $_Datetime_Day, "d.getDate()", INFO);

$_Datetime_WeekDay = injectJS( "var d = new Date(); dm = d.getDay()+'';  function returnVar(dm){return dm;} returnVar(dm);");
$_Datetime_WeekDay == "1" ? $_EnDay = "Monday" :0;       $_Datetime_WeekDay == "5" ? $_EnDay = "Friday" :0;
$_Datetime_WeekDay == "2" ? $_EnDay = "Tuesday" :0;      $_Datetime_WeekDay == "6" ? $_EnDay = "Saturday" :0;
$_Datetime_WeekDay == "3" ? $_EnDay = "Wednesday" :0;    $_Datetime_WeekDay == "0" ? $_EnDay = "Sunday" :0;
$_Datetime_WeekDay == "4" ? $_EnDay = "Thursday" :0;      
alert( $_Datetime_WeekDay ."\n". $_EnDay , "d.getDay()", INFO);

$_Datetime_DateString = injectJS( "var d = new Date(); dm = d.toDateString()+'';  function returnVar(dm){return dm;} returnVar(dm);");
alert( $_Datetime_DateString, "d.toDateString()", INFO);
}

_Datetime_BuildMenu {
	# add another option to Tools menu
	setmenu("&Tools",macro,"Datetime Testing","_Datetime_RunCode",Misc);
}
# ----------------------------------------------------------------------
$OnInit=$OnInit."_Datetime_BuildMenu;";
$macroModules=$macroModules."Datetime;";


Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: rodocop
Date: April 20, 2015 02:52PM

I can't help much with JS, but I should say that all per-site permissions are handled in Firefox by new Permissions manager, available at
about:Ñ€ermissions
No glue whether does it work or not, but you can open it and play with settings for your sites.

They should be stored in profile's permissions.sqlite, I think.

Cannot help more. If this doesn't have effect in KM - then we need Dorian's side to adapt this feature.
This one along with 'PageInfo' and 'newtab' features are most needed (IMHO) in order to make KM more attractable for mass user.

UPD.: Sorry - my bad! There isn't any js-management too. But quick test have shown that at least some permissions management works there (cookies)... May be useful for someone...



Edited 2 time(s). Last edit at 04/20/2015 03:00PM by rodocop.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JamesD
Date: April 20, 2015 06:34PM

Quote
rodocop
This one along with 'PageInfo' and 'newtab' features are most needed (IMHO) in order to make KM more attractable for mass user.

Can you explain more about the 'PageInfo' and 'newtab' features you desire?

Just to note that the injectJS() items run without the need for the page itself to have JS enabled.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: rodocop
Date: April 21, 2015 03:30PM

Quote
JamesD
Can you explain more about the 'PageInfo' and 'newtab' features you desire?

Well the are just 2 more FF-inbuilt chrome-features, which were partly adapted by naruman in his "74+1"-build.

'newtab' is speeddial page for new tabs and 'pageinfo' is xul-window called from context-menu with a lot of information about content like this (click for fullsize):





Edited 2 time(s). Last edit at 04/21/2015 03:31PM by rodocop.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JamesD
Date: April 21, 2015 06:07PM

CHROME

I will try to have a look. I seldom have success working with the chrome.

I don't think that I kept a 74 from naruman.

Options: ReplyQuote
Re: javascript permissions / opt in broken?
Posted by: JamesD
Date: April 22, 2015 03:40PM

@ rodocop

I have gotten and installed naruman's code. I see the "View Page Info" in the document popup menu. I just have not yet been able to trace the origin of that item.

The string "View Page Info" does not appear in menus.cfg or main.kmm.

Do you know where that menu item is coded?

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


K-Meleon forum is powered by Phorum.