Changeset 67642 in webkit


Ignore:
Timestamp:
Sep 16, 2010 11:19:03 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-09-16 Patrick Gansterer <paroga@paroga.com>

Reviewed by Darin Adler.

[Mac] Always use a valid string when setting WebKitUserStyleSheetLocationPreferenceKey.
https://bugs.webkit.org/show_bug.cgi?id=41510

  • platform/mac/fast/loader/user-stylesheet-fast-path-expected.txt:
  • platform/mac/fast/loader/user-stylesheet-fast-path.html:

2010-09-16 Patrick Gansterer <paroga@paroga.com>

Reviewed by Darin Adler.

Always use a valid string when setting WebKitUserStyleSheetLocationPreferenceKey.
https://bugs.webkit.org/show_bug.cgi?id=41510

This prevents usage of nil value, which would cause an uncaught exception.

  • WebView/WebPreferences.mm: (-[WebPreferences setUserStyleSheetLocation:]):
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r67640 r67642  
     12010-09-16  Patrick Gansterer  <paroga@paroga.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        [Mac] Always use a valid string when setting WebKitUserStyleSheetLocationPreferenceKey.
     6        https://bugs.webkit.org/show_bug.cgi?id=41510
     7
     8        * platform/mac/fast/loader/user-stylesheet-fast-path-expected.txt:
     9        * platform/mac/fast/loader/user-stylesheet-fast-path.html:
     10
    1112010-09-16  Zhenyao Mo  <zmo@google.com>
    212
  • trunk/LayoutTests/platform/mac/fast/loader/user-stylesheet-fast-path-expected.txt

    r43672 r67642  
    11This tests that when the user style sheet location is set to a data: URL with base64-encoded UTF-8 data, the style sheet is processed synchronously, instead of invoking the asynchronous loader.
    22
    3 PASS
     3PASS 100px
     4PASS 140px
     5PASS 150px
     6PASS 160px
     7
  • trunk/LayoutTests/platform/mac/fast/loader/user-stylesheet-fast-path.html

    r43672 r67642  
    44    synchronously, instead of invoking the asynchronous loader.
    55</p>
    6 <p id="result"></p>
    76<script>
    8     var result = document.getElementById("result");
     7    var testObjects = [
     8        {result:true,  size:"100px", url:"data:text/css;charset=utf-8;base64,Ym9keSB7Zm9udC1zaXplOiAxMDBweH0="},
     9        {result:false, size:"140px", url:"data:text/css;charset=utf-8;base64,Ym9k$#eSB7Zm#9ud(C1zaXp)lOiAxNDBweH0="},
     10        {result:false, size:"150px", url:"data:text/css;charset=utf-8;base64,Ym9ke%00SB7Z%20m9udC1z\n\taXplO#iAx%03NTBw%eH0="},
     11        {result:false, size:"160px", url:"%50%30%10%00%20%40"}
     12    ];
    913
    1014    if (window.layoutTestController) {
    1115        layoutTestController.dumpAsText();
    1216        layoutTestController.setUserStyleSheetEnabled(true);
    13         layoutTestController.setUserStyleSheetLocation("data:text/css;charset=utf-8;base64,Ym9keSB7Zm9udC1zaXplOiAxMDBweH0=");
    1417
    15         document.body.offsetTop;
    16         if (getComputedStyle(document.body).fontSize == "100px")
    17             result.innerText = "PASS";
    18         else
    19             result.innerText = "FAIL";
     18        for (var i = 0; i < testObjects.length; i++) {
     19            var obj = testObjects[i];
     20            layoutTestController.setUserStyleSheetLocation(obj.url);
     21
     22            document.body.offsetTop;
     23            var result = getComputedStyle(document.body).fontSize == obj.size;
     24            document.write((result == obj.result ? "PASS" : "FAIL") + " " + obj.size + "<br>");
     25
     26            layoutTestController.setUserStyleSheetLocation("");
     27        }
    2028    } else
    21         result.innerText = "This test can only be run in DumpRenderTree.";
     29        document.write("This test can only be run in DumpRenderTree.");
    2230</script>
  • trunk/WebKit/mac/ChangeLog

    r67639 r67642  
     12010-09-16  Patrick Gansterer  <paroga@paroga.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Always use a valid string when setting WebKitUserStyleSheetLocationPreferenceKey.
     6        https://bugs.webkit.org/show_bug.cgi?id=41510
     7
     8        This prevents usage of nil value, which would cause an uncaught exception.
     9
     10        * WebView/WebPreferences.mm:
     11        (-[WebPreferences setUserStyleSheetLocation:]):
     12
    1132010-09-16  Dan Bernstein  <mitz@apple.com>
    214
  • trunk/WebKit/mac/WebView/WebPreferences.mm

    r67518 r67642  
    642642        locationString = [URL _web_originalDataAsString];
    643643    }
    644    
     644
     645    if (!locationString)
     646        locationString = @"";
     647
    645648    [self _setStringValue:locationString forKey: WebKitUserStyleSheetLocationPreferenceKey];
    646649}
Note: See TracChangeset for help on using the changeset viewer.