js/src/tests/js1_8/regress/regress-459389.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_8/regress/regress-459389.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,120 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +//-----------------------------------------------------------------------------
    1.10 +var BUGNUMBER = 459389;
    1.11 +var summary = 'Do not crash with JIT';
    1.12 +var actual = '';
    1.13 +var expect = '';
    1.14 +
    1.15 +printBugNumber(BUGNUMBER);
    1.16 +printStatus (summary);
    1.17 + 
    1.18 +print('mmmm, food!');
    1.19 +
    1.20 +jit(true);
    1.21 +
    1.22 +var SNI = {};
    1.23 +SNI.MetaData={};
    1.24 +SNI.MetaData.Parameter=function()
    1.25 +{
    1.26 +var parameters={}; 
    1.27 +this.addParameter=function(key,value)
    1.28 +{
    1.29 +parameters[key]=[];
    1.30 +parameters[key].push(value);
    1.31 +};
    1.32 +this.getParameter=function(key,separator){
    1.33 +if(!parameters[key])
    1.34 +{
    1.35 +return;
    1.36 +} 
    1.37 +return parameters[key].join(separator);
    1.38 +};
    1.39 +this.getKeys=function()
    1.40 +{
    1.41 +return parameters;
    1.42 +};
    1.43 +};
    1.44 +SNI.MetaData.Manager=function(){
    1.45 +var m=new SNI.MetaData.Parameter(); 
    1.46 +this.getParameter=m.getParameter; 
    1.47 +};
    1.48 +var MetaDataManager=SNI.MetaData.Manager;
    1.49 +SNI.Ads={ };
    1.50 +SNI.Ads.Url=function(){
    1.51 +var p=new SNI.MetaData.Parameter();
    1.52 +this.addParameter=p.addParameter;
    1.53 +this.getParameter=p.getParameter;
    1.54 +};
    1.55 +function Ad() {
    1.56 +var url=new SNI.Ads.Url();
    1.57 +this.addParameter=url.addParameter;
    1.58 +this.getParameter=url.getParameter;
    1.59 +}
    1.60 +function DartAd()
    1.61 +AdUrl.prototype=new Ad();
    1.62 +function AdUrl() { }
    1.63 +function AdRestriction() {
    1.64 +var p=new SNI.MetaData.Parameter();
    1.65 +this.addParameter=p.addParameter;
    1.66 +this.getParameter=p.getParameter;
    1.67 +this.getKeys=p.getKeys;
    1.68 +}
    1.69 +function AdRestrictionManager(){
    1.70 +this.restriction=[];
    1.71 +this.isActive=isActive;
    1.72 +this.isMatch=isMatch;
    1.73 +this.startMatch=startMatch;
    1.74 +function isActive(ad,mdm){
    1.75 +var value=false;
    1.76 +for(var i=0;i<this.restriction.length;i++)
    1.77 +{
    1.78 +adRestriction=this.restriction[i];
    1.79 +value=this.startMatch(ad,mdm,adRestriction);
    1.80 +} 
    1.81 +}
    1.82 +function startMatch(ad,mdm,adRestriction){
    1.83 +for(var key in adRestriction.getKeys()){
    1.84 +var restrictions=adRestriction.getParameter(key,',');
    1.85 +var value=mdm.getParameter(key,'');
    1.86 +match=this.isMatch(value,restrictions);
    1.87 +if(!match){
    1.88 +value=ad.getParameter(key,'')
    1.89 +match=this.isMatch(value,restrictions);
    1.90 +} 
    1.91 +} 
    1.92 +}
    1.93 +function isMatch(value,restrictions){
    1.94 +var match=false;
    1.95 +if(value)
    1.96 +{
    1.97 +splitValue=value.split('');
    1.98 +for(var x=0;x<splitValue.length;x++){
    1.99 +for(var a;a<restrictions.length;a++){ }
   1.100 +}
   1.101 +} 
   1.102 +return match;
   1.103 +}
   1.104 +}
   1.105 +var adRestrictionManager = new AdRestrictionManager();
   1.106 +var restrictionLeader6 = new AdRestriction();
   1.107 +restrictionLeader6.addParameter("", "");
   1.108 +adRestrictionManager.restriction.push(restrictionLeader6);
   1.109 +var restrictionLeader7 = new AdRestriction();
   1.110 +restrictionLeader7.addParameter("", "");
   1.111 +adRestrictionManager.restriction.push(restrictionLeader7);
   1.112 +function FoodAd(adtype)
   1.113 +{
   1.114 +  ad=new DartAd()
   1.115 +  ad.addParameter("",adtype)
   1.116 +  adRestrictionManager.isActive(ad,	mdManager)
   1.117 +}
   1.118 +var mdManager = new MetaDataManager() ;
   1.119 +  FoodAd('P')
   1.120 +
   1.121 +jit(false);
   1.122 +
   1.123 +reportCompare(expect, actual, summary);

mercurial