Browse Source

revert getURL changes

Nicolas Cannasse 13 years ago
parent
commit
09ce6695e0
7 changed files with 6 additions and 25 deletions
  1. 0 1
      doc/CHANGES.txt
  2. 1 1
      genswf8.ml
  3. 1 0
      main.ml
  4. 1 0
      std/flash/Boot.hx
  5. 1 11
      std/flash/Lib.hx
  6. 1 0
      std/flash9/Boot.hx
  7. 1 12
      std/flash9/Lib.hx

+ 0 - 1
doc/CHANGES.txt

@@ -16,7 +16,6 @@
 	all : allowed @:extern on static methods (no generate + no closure + force inlining)
 	all : allowed @:extern on static methods (no generate + no closure + force inlining)
 	all : added documentation in --display infos + display overloads in completion
 	all : added documentation in --display infos + display overloads in completion
 	js : removed --js-namespace, added $hxClasses
 	js : removed --js-namespace, added $hxClasses
-	flash : flash.Lib.getURL now disallow javascript urls by default (security)
 
 
 2011-09-25: 2.08
 2011-09-25: 2.08
 	js : added js.JQuery
 	js : added js.JQuery

+ 1 - 1
genswf8.ml

@@ -1552,11 +1552,11 @@ let generate com =
 	ctx.reg_count <- 0;
 	ctx.reg_count <- 0;
 	(* ---- *)
 	(* ---- *)
 	List.iter (fun t -> gen_type_def ctx t) com.types;
 	List.iter (fun t -> gen_type_def ctx t) com.types;
+	let global_try = gen_try ctx in
 	gen_boot ctx;
 	gen_boot ctx;
 	List.iter (fun m -> gen_movieclip ctx m) ctx.movieclips;
 	List.iter (fun m -> gen_movieclip ctx m) ctx.movieclips;
 	ctx.static_init <- true;
 	ctx.static_init <- true;
 	List.iter (gen_expr ctx false) (List.rev ctx.inits);
 	List.iter (gen_expr ctx false) (List.rev ctx.inits);
-	let global_try = gen_try ctx in
 	List.iter (gen_class_static_init ctx) (List.rev ctx.statics);
 	List.iter (gen_class_static_init ctx) (List.rev ctx.statics);
 	(match com.main with
 	(match com.main with
 	| None -> ()
 	| None -> ()

+ 1 - 0
main.ml

@@ -539,6 +539,7 @@ try
 	in
 	in
 	Arg.parse_argv ~current args (basic_args_spec @ adv_args_spec) args_callback usage;
 	Arg.parse_argv ~current args (basic_args_spec @ adv_args_spec) args_callback usage;
 	add_libs com (!cp_libs) neko_libs;
 	add_libs com (!cp_libs) neko_libs;
+	(try ignore(Common.find_file com "mt/Include.hx"); Common.define com "mt"; with Not_found -> ());
 	if com.display then begin
 	if com.display then begin
 		xml_out := None;
 		xml_out := None;
 		no_output := true;
 		no_output := true;

+ 1 - 0
std/flash/Boot.hx

@@ -273,6 +273,7 @@ class Boot {
 		// fix firefox default alignement
 		// fix firefox default alignement
 		if( _global["Stage"]["align"] == "" )
 		if( _global["Stage"]["align"] == "" )
 			_global["Stage"]["align"] = "LT";
 			_global["Stage"]["align"] = "LT";
+		#if mt mt.flash.Init.check(); #end
 	}
 	}
 
 
 }
 }

+ 1 - 11
std/flash/Lib.hx

@@ -39,17 +39,7 @@ class Lib {
 		return untyped __eval__(str);
 		return untyped __eval__(str);
 	}
 	}
 
 
-	public static function getURL( url : String, ?target : String, ?allowScripts ) {
-		if( !allowScripts ) {
-			while( true ) {
-				var c = url.charCodeAt(0);
-				if( c == ' '.code || c == '\n'.code || c == '\r'.code || c == '\t'.code )
-					url = url.substr(1);
-				else break;
-			}
-			if( url.toLowerCase().substr(0,11) == "javascript:" )
-				throw "Scripts not allowed in URL";
-		}
+	public static function getURL( url : String, ?target : String ) {
 		untyped __geturl__(url,if( target == null ) "_self" else target);
 		untyped __geturl__(url,if( target == null ) "_self" else target);
 	}
 	}
 
 

+ 1 - 0
std/flash9/Boot.hx

@@ -53,6 +53,7 @@ class Boot extends flash.display.MovieClip {
 	public static var skip_constructor = false;
 	public static var skip_constructor = false;
 
 
 	function start() {
 	function start() {
+		#if mt mt.flash.Init.check(); #end
 		#if dontWaitStage
 		#if dontWaitStage
 			init();
 			init();
 		#else
 		#else

+ 1 - 12
std/flash9/Lib.hx

@@ -52,18 +52,7 @@ class Lib {
 		return o;
 		return o;
 	}
 	}
 
 
-	public static function getURL( url : flash.net.URLRequest, ?target : String, ?allowScripts : Bool ) {
-		if( !allowScripts && url != null ) {
-			var url = url.url;
-			while( true ) {
-				var c = url.charCodeAt(0);
-				if( c == ' '.code || c == '\n'.code || c == '\r'.code || c == '\t'.code )
-					url = url.substr(1);
-				else break;
-			}
-			if( url.toLowerCase().substr(0,11) == "javascript:" )
-				throw "Scripts not allowed in URL";
-		}
+	public static function getURL( url : flash.net.URLRequest, ?target : String ) {
 		var f = untyped __global__["flash.net.navigateToURL"];
 		var f = untyped __global__["flash.net.navigateToURL"];
 		if( target == null )
 		if( target == null )
 			f(url);
 			f(url);